This commit is contained in:
wxiaoguang
2026-06-17 15:27:16 +08:00
parent 4c2f668e94
commit 492d155fb6
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -41,6 +41,7 @@ func (doc *HTMLDoc) Find(selector string) *goquery.Selection {
// AssertHTMLElement check if the element by selector exists or does not exist depending on checkExists
func AssertHTMLElement[T int | bool](t testing.TB, doc *HTMLDoc, selector string, checkExists T) {
t.Helper()
sel := doc.doc.Find(selector)
switch v := any(checkExists).(type) {
case bool:
+2 -2
View File
@@ -70,7 +70,7 @@ func TestUserSettingsAccount(t *testing.T) {
AssertHTMLElement(t, doc, "#password", true)
AssertHTMLElement(t, doc, "#email", true)
AssertHTMLElement(t, doc, "#delete-form", true)
AssertHTMLElement(t, doc, `form[action="/user/settings/account/delete"]`, true)
})
t.Run("credentials disabled", func(t *testing.T) {
@@ -87,7 +87,7 @@ func TestUserSettingsAccount(t *testing.T) {
AssertHTMLElement(t, doc, "#password", false)
AssertHTMLElement(t, doc, "#email", false)
AssertHTMLElement(t, doc, "#delete-form", true)
AssertHTMLElement(t, doc, `form[action="/user/settings/account/delete"]`, true)
})
t.Run("deletion disabled", func(t *testing.T) {