mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
Merge pull request #4639 from ueberdosis/feature/fixMarksLinkTests
fixes tests in marks/link
This commit is contained in:
commit
a38329712f
@ -7,7 +7,7 @@ context('/src/Marks/Link/React/', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.setContent('<p>Example TextDEFAULT</p>')
|
||||
cy.get('.tiptap').type('{selectall}')
|
||||
})
|
||||
})
|
||||
@ -26,27 +26,27 @@ context('/src/Marks/Link/React/', () => {
|
||||
|
||||
it('should parse a tags correctly', () => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p><a href="#">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#">Example Text1</a></p>')
|
||||
expect(editor.getHTML()).to.eq(
|
||||
'<p><a target="_blank" rel="noopener noreferrer nofollow" href="#">Example Text</a></p>',
|
||||
'<p><a target="_blank" rel="noopener noreferrer nofollow" href="#">Example Text1</a></p>',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags with target attribute correctly', () => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p><a href="#" target="_self">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#" target="_self">Example Text2</a></p>')
|
||||
expect(editor.getHTML()).to.eq(
|
||||
'<p><a target="_self" rel="noopener noreferrer nofollow" href="#">Example Text</a></p>',
|
||||
'<p><a target="_self" rel="noopener noreferrer nofollow" href="#">Example Text2</a></p>',
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags with rel attribute correctly', () => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p><a href="#" rel="follow">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#" rel="follow">Example Text3</a></p>')
|
||||
expect(editor.getHTML()).to.eq(
|
||||
'<p><a target="_blank" rel="follow" href="#">Example Text</a></p>',
|
||||
'<p><a target="_blank" rel="follow" href="#">Example Text3</a></p>',
|
||||
)
|
||||
})
|
||||
})
|
||||
@ -61,7 +61,7 @@ context('/src/Marks/Link/React/', () => {
|
||||
|
||||
cy.get('.tiptap')
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('contain', 'Example TextDEFAULT')
|
||||
.should('have.attr', 'href', 'https://tiptap.dev')
|
||||
})
|
||||
})
|
||||
@ -69,27 +69,27 @@ context('/src/Marks/Link/React/', () => {
|
||||
it('detects a pasted URL within a text', () => {
|
||||
cy.get('.tiptap')
|
||||
.paste({
|
||||
pastePayload: 'some text https://example.com around an url',
|
||||
pastePayload: 'some text https://example1.com around an url',
|
||||
pasteType: 'text/plain',
|
||||
})
|
||||
.find('a')
|
||||
.should('contain', 'https://example.com')
|
||||
.should('have.attr', 'href', 'https://example.com')
|
||||
.should('contain', 'https://example1.com')
|
||||
.should('have.attr', 'href', 'https://example1.com')
|
||||
})
|
||||
|
||||
it('detects a pasted URL', () => {
|
||||
cy.get('.tiptap')
|
||||
.paste({ pastePayload: 'https://example.com', pasteType: 'text/plain' })
|
||||
.paste({ pastePayload: 'https://example2.com', pasteType: 'text/plain' })
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('have.attr', 'href', 'https://example.com')
|
||||
.should('contain', 'https://example2.com')
|
||||
.should('have.attr', 'href', 'https://example2.com')
|
||||
})
|
||||
|
||||
it('detects a pasted URL with query params', () => {
|
||||
cy.get('.tiptap')
|
||||
.paste({ pastePayload: 'https://example.com?paramA=nice¶mB=cool', pasteType: 'text/plain' })
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('contain', 'https://example.com?paramA=nice¶mB=cool')
|
||||
.should('have.attr', 'href', 'https://example.com?paramA=nice¶mB=cool')
|
||||
})
|
||||
|
||||
|
@ -5,29 +5,29 @@ context('/src/Marks/Link/Vue/', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.setContent('<p>Example TextDEFAULT</p>')
|
||||
cy.get('.tiptap').type('{selectall}')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags correctly', () => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p><a href="#">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a target="_blank" rel="noopener noreferrer nofollow" href="#">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#">Example Text1</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a target="_blank" rel="noopener noreferrer nofollow" href="#">Example Text1</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags with target attribute correctly', () => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p><a href="#" target="_self">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a target="_self" rel="noopener noreferrer nofollow" href="#">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#" target="_self">Example Text2</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a target="_self" rel="noopener noreferrer nofollow" href="#">Example Text2</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags with rel attribute correctly', () => {
|
||||
cy.get('.tiptap').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p><a href="#" rel="follow">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a target="_blank" rel="follow" href="#">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#" rel="follow">Example Text3</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a target="_blank" rel="follow" href="#">Example Text3</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
@ -42,30 +42,30 @@ context('/src/Marks/Link/Vue/', () => {
|
||||
|
||||
cy.get('.tiptap')
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('contain', 'Example TextDEFAULT')
|
||||
.should('have.attr', 'href', 'https://tiptap.dev')
|
||||
})
|
||||
})
|
||||
|
||||
it('detects a pasted URL within a text', () => {
|
||||
cy.get('.tiptap').paste({ pastePayload: 'some text https://example.com around an url', pasteType: 'text/plain' })
|
||||
cy.get('.tiptap').paste({ pastePayload: 'some text https://example1.com around an url', pasteType: 'text/plain' })
|
||||
.find('a')
|
||||
.should('contain', 'https://example.com')
|
||||
.should('have.attr', 'href', 'https://example.com')
|
||||
.should('contain', 'https://example1.com')
|
||||
.should('have.attr', 'href', 'https://example1.com')
|
||||
})
|
||||
|
||||
it('detects a pasted URL', () => {
|
||||
cy.get('.tiptap').paste({ pastePayload: 'https://example.com', pasteType: 'text/plain' })
|
||||
cy.get('.tiptap').paste({ pastePayload: 'https://example2.com', pasteType: 'text/plain' })
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('have.attr', 'href', 'https://example.com')
|
||||
.should('contain', 'https://example2.com')
|
||||
.should('have.attr', 'href', 'https://example2.com')
|
||||
})
|
||||
|
||||
it('detects a pasted URL with query params', () => {
|
||||
cy.get('.tiptap')
|
||||
.paste({ pastePayload: 'https://example.com?paramA=nice¶mB=cool', pasteType: 'text/plain' })
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('contain', 'https://example.com?paramA=nice¶mB=cool')
|
||||
.should('have.attr', 'href', 'https://example.com?paramA=nice¶mB=cool')
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user