mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 23:15:15 +08:00
test(extension-link): ✅ add test for autolink validation example in vue
This commit is contained in:
parent
358e315921
commit
ec4154000d
@ -3,5 +3,40 @@ context('/src/Examples/AutolinkValidation/Vue/', () => {
|
||||
cy.visit('/src/Examples/AutolinkValidation/Vue/')
|
||||
})
|
||||
|
||||
// TODO: Write tests
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').type('{selectall}{backspace}')
|
||||
})
|
||||
|
||||
const validLinks = [
|
||||
'https://tiptap.dev',
|
||||
'http://tiptap.dev',
|
||||
'https://www.tiptap.dev/',
|
||||
'http://www.tiptap.dev/',
|
||||
]
|
||||
|
||||
const invalidLinks = [
|
||||
'tiptap.dev',
|
||||
'www.tiptap.dev',
|
||||
]
|
||||
|
||||
validLinks.forEach(link => {
|
||||
it(`${link} should get autolinked`, () => {
|
||||
cy.get('.ProseMirror').type(link)
|
||||
cy.get('.ProseMirror').should('have.text', link)
|
||||
cy.get('.ProseMirror')
|
||||
.find('a')
|
||||
.should('have.length', 1)
|
||||
.should('have.attr', 'href', link)
|
||||
})
|
||||
})
|
||||
|
||||
invalidLinks.forEach(link => {
|
||||
it(`${link} should NOT get autolinked`, () => {
|
||||
cy.get('.ProseMirror').type(link)
|
||||
cy.get('.ProseMirror').should('have.text', link)
|
||||
cy.get('.ProseMirror')
|
||||
.find('a')
|
||||
.should('have.length', 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user