summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author0ko <0ko@noreply.codeberg.org>2024-04-15 19:59:26 +0200
committer0ko <0ko@noreply.codeberg.org>2024-04-15 19:59:26 +0200
commit089e37026fdabf03f7a5d52fc869ad775a40d4ac (patch)
treec43857e1655593836062123bc3d4c3528aefb53e
parentRemove EasyMDE from various areas (diff)
downloadforgejo-089e37026fdabf03f7a5d52fc869ad775a40d4ac.tar.xz
forgejo-089e37026fdabf03f7a5d52fc869ad775a40d4ac.zip
Add integration test for EasyMDE button
-rw-r--r--tests/integration/easymde_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/integration/easymde_test.go b/tests/integration/easymde_test.go
new file mode 100644
index 0000000000..c8203d36be
--- /dev/null
+++ b/tests/integration/easymde_test.go
@@ -0,0 +1,25 @@
+// Copyright 2024 The Forgejo Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package integration
+
+import (
+ "net/http"
+ "testing"
+)
+
+func TestEasyMDESwitch(t *testing.T) {
+ 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)
+}
+
+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)
+}