add tests to the link extension page
This commit is contained in:
@@ -9,4 +9,28 @@ context('/api/extensions/link', () => {
|
||||
editor.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
it('the button should add a link to the selected text', () => {
|
||||
cy.window().then(win => {
|
||||
cy.stub(win, 'prompt').returns('https://tiptap.dev')
|
||||
|
||||
cy.get('.demo__preview button:first')
|
||||
.click()
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.find('a')
|
||||
.should('contain', 'Example Text')
|
||||
.should('have.attr', 'href', 'https://tiptap.dev')
|
||||
})
|
||||
})
|
||||
|
||||
it.skip('links should be auto detected', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.then($span => {
|
||||
$span.text('https://example.com')
|
||||
})
|
||||
.find('a')
|
||||
.should('contain', 'https://example.com')
|
||||
.should('have.attr', 'href', 'https://example.com')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -39,7 +39,10 @@ export default {
|
||||
],
|
||||
content: `
|
||||
<p>
|
||||
Try to add some links to the <a href="https://en.wikipedia.org/wiki/World_Wide_Web" target="_self">world wide web</a>. By default every link will get a <code>rel="noopener noreferrer nofollow"</code> attribute.
|
||||
Wow, this editor has support for links to the whole <a href="https://en.wikipedia.org/wiki/World_Wide_Web" target="_self">world wide web</a>. We tested a lot of URLs and I think you can add *every URL* you want. Isn’t that cool? Let’s try <a href="https://statamic.com/" target="_self">another one!</a> Yep, seems to work.
|
||||
</p>
|
||||
<p>
|
||||
By default every link will get a \`rel="noopener noreferrer nofollow"\` attribute. It’s configurable though.
|
||||
</p>
|
||||
`,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user