add tests to the link extension page

This commit is contained in:
Hans Pagel
2020-09-25 19:36:43 +02:00
parent 304504da73
commit 8a0a25aeb0
3 changed files with 30 additions and 3 deletions

View File

@@ -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')
})
})

View File

@@ -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. Isnt that cool? Lets 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. Its configurable though.
</p>
`,
})