summaryrefslogtreecommitdiffstats
path: root/tests/integration/easymde_test.go
blob: c8203d36bebfb20476fce4e2d260e3678c3f5a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
}