add a lot more parseDOM tests to all extensions

This commit is contained in:
Hans Pagel
2020-10-08 14:15:02 +02:00
parent 2282beae07
commit 0e48b8e6f6
14 changed files with 226 additions and 3 deletions

View File

@@ -10,6 +10,27 @@ context('/api/extensions/link', () => {
})
})
it('should parse a tags correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p><a href="#">Example Text</a></p>')
expect(editor.html()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
})
})
it('should parse a tags with target attribute correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p><a href="#" target="_self">Example Text</a></p>')
expect(editor.html()).to.eq('<p><a href="#" target="_self" rel="noopener noreferrer nofollow">Example Text</a></p>')
})
})
it('should parse a tags with rel attribute correctly', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p><a href="#" rel="follow">Example Text</a></p>')
expect(editor.html()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
})
})
it('the button should add a link to the selected text', () => {
cy.window().then(win => {
cy.stub(win, 'prompt').returns('https://tiptap.dev')