2024-04-15 20:59:26 +03:00
|
|
|
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package integration
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
2024-11-14 04:13:22 +03:00
|
|
|
|
|
|
|
"code.gitea.io/gitea/tests"
|
2024-04-15 20:59:26 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestEasyMDESwitch(t *testing.T) {
|
2024-11-14 04:13:22 +03:00
|
|
|
defer tests.PrepareTestEnv(t)()
|
2024-04-15 20:59:26 +03:00
|
|
|
session := loginUser(t, "user2")
|
|
|
|
testEasyMDESwitch(t, session, "user2/glob/issues/1", false)
|
|
|
|
testEasyMDESwitch(t, session, "user2/glob/issues/new", false)
|
|
|
|
testEasyMDESwitch(t, session, "user2/glob/wiki?action=_new", true)
|
|
|
|
testEasyMDESwitch(t, session, "user2/glob/releases/new", true)
|
2024-10-22 20:58:44 +03:00
|
|
|
testEasyMDESwitch(t, session, "user2/glob/milestones/new", true)
|
|
|
|
testEasyMDESwitch(t, session, "user2/repo1/milestones/1/edit", true)
|
2024-04-15 20:59:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func testEasyMDESwitch(t *testing.T, session *TestSession, url string, expected bool) {
|
|
|
|
t.Helper()
|
|
|
|
req := NewRequest(t, "GET", url)
|
|
|
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
|
|
|
doc := NewHTMLParser(t, resp.Body)
|
|
|
|
doc.AssertElement(t, ".combo-markdown-editor button.markdown-switch-easymde", expected)
|
|
|
|
}
|