-
-
Notifications
You must be signed in to change notification settings - Fork 2k
/
index.spec.js
30 lines (24 loc) · 1.11 KB
/
index.spec.js
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
context('/src/Issues/2720/React/', () => {
before(() => {
cy.visit('/src/Issues/2720/React/')
})
beforeEach(() => {
cy.get('.tiptap').type('{selectall}{backspace}')
})
it('should insert html content correctly', () => {
cy.get('button[data-test-id="html-content"]').click()
// check if the content html is correct
cy.get('.tiptap').should('contain.html', '<h1>Tiptap</h1><p><strong>Hello World</strong></p><p>This is a paragraph<br>with a break.</p><p>And this is some additional string content.</p>')
})
it('should insert text content correctly', () => {
cy.get('button[data-test-id="text-content"]').click()
// check if the content html is correct
cy.get('.tiptap').should('contain.html', 'Hello World\nThis is content with a new line. Is this working?\n\nLets see if multiple new lines are inserted correctly')
})
it('should keep newlines in pre tag', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.setContent('<pre><code>foo\nbar</code></pre>')
cy.get('.tiptap').should('contain.html', '<pre><code>foo\nbar</code></pre>')
})
})
})