mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-23 17:36:41 +02:00
fix test
This commit is contained in:
@@ -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
|
// 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) {
|
func AssertHTMLElement[T int | bool](t testing.TB, doc *HTMLDoc, selector string, checkExists T) {
|
||||||
|
t.Helper()
|
||||||
sel := doc.doc.Find(selector)
|
sel := doc.doc.Find(selector)
|
||||||
switch v := any(checkExists).(type) {
|
switch v := any(checkExists).(type) {
|
||||||
case bool:
|
case bool:
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ func TestUserSettingsAccount(t *testing.T) {
|
|||||||
|
|
||||||
AssertHTMLElement(t, doc, "#password", true)
|
AssertHTMLElement(t, doc, "#password", true)
|
||||||
AssertHTMLElement(t, doc, "#email", 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) {
|
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, "#password", false)
|
||||||
AssertHTMLElement(t, doc, "#email", 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) {
|
t.Run("deletion disabled", func(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user