-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathHighlight.spec.ts
More file actions
36 lines (32 loc) · 1.07 KB
/
Highlight.spec.ts
File metadata and controls
36 lines (32 loc) · 1.07 KB
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
26
27
28
29
30
31
32
33
34
35
36
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import createCustomEditor from '../testHelpers/createCustomEditor'
import Highlight from './../../marks/Highlight'
describe('Highlight extension unit', () => {
it('exposes toMarkdown function', () => {
// @ts-expect-error - toMarkdown is a custom field not part of the official Tiptap API
const toMarkdown = Highlight.config.toMarkdown
expect(JSON.stringify(toMarkdown)).to.equal(
JSON.stringify({
open: '==',
close: '==',
mixable: true,
expelEnclosingWhitespace: true,
}),
)
})
})
describe('Highlight extension integrated in the editor', () => {
it('is not active by default', () => {
const editor = createCustomEditor('<p>Test</p>', [Highlight])
expect(editor.isActive('highlight')).to.equal(false)
editor.destroy()
})
it('is active within <mark> tags', () => {
const editor = createCustomEditor('<p><mark>Test</mark></p>', [Highlight])
expect(editor.isActive('highlight')).to.equal(true)
editor.destroy()
})
})