mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 10:29:48 +02:00
Added cypress test for links and markdownShortcuts (#4397)
* Added cypress test for links and markdownShortcuts * Update cypress/integration/markdownShortcuts.ts Co-authored-by: Tim Buckley <timothypbuckley@gmail.com> * Update cypress/integration/markdownShortcuts.ts Co-authored-by: Tim Buckley <timothypbuckley@gmail.com> * Update cypress/integration/links.ts Co-authored-by: Tim Buckley <timothypbuckley@gmail.com> Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
This commit is contained in:
11
cypress/integration/examples/links.ts
Normal file
11
cypress/integration/examples/links.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
describe('Links example', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('examples/links')
|
||||
})
|
||||
|
||||
it('contains link', () => {
|
||||
cy.findByRole('textbox')
|
||||
.find('a')
|
||||
.should('contain.text', 'hyperlinks')
|
||||
})
|
||||
})
|
47
cypress/integration/examples/markdownShortcuts.ts
Normal file
47
cypress/integration/examples/markdownShortcuts.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
describe('On markdown-shortcuts example', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('examples/markdown-shortcuts')
|
||||
})
|
||||
|
||||
it('contains quote', () => {
|
||||
cy.findByRole('textbox')
|
||||
.find('blockquote')
|
||||
.should('contain.text', 'A wise quote.')
|
||||
})
|
||||
|
||||
it('can add list items', () => {
|
||||
cy.findByRole('textbox')
|
||||
.find('ul')
|
||||
.should('not.exist')
|
||||
|
||||
cy.findByRole('textbox').type(
|
||||
'{movetostart}- 1st Item{enter}2nd Item{enter}3rd Item{enter}{backspace}'
|
||||
)
|
||||
|
||||
cy.get('ul > li').should('have.length', 3)
|
||||
|
||||
cy.get('ul > li')
|
||||
.eq(0)
|
||||
.should('contain.text', '1st Item')
|
||||
.get('ul > li')
|
||||
.eq(1)
|
||||
.should('contain.text', '2nd Item')
|
||||
.get('ul > li')
|
||||
.eq(2)
|
||||
.should('contain.text', '3rd Item')
|
||||
})
|
||||
|
||||
it('can add a h1 item', () => {
|
||||
cy.findByRole('textbox')
|
||||
.find('h1')
|
||||
.should('not.exist')
|
||||
|
||||
cy.findByRole('textbox').type('{enter}{leftarrow}# Heading')
|
||||
|
||||
cy.get('h1').should('have.length', 1)
|
||||
|
||||
cy.findByRole('textbox')
|
||||
.find('h1')
|
||||
.should('contain.text', 'Heading')
|
||||
})
|
||||
})
|
@@ -1,7 +1,12 @@
|
||||
describe('readonly editor', () => {
|
||||
it('should not be editable', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('examples/read-only')
|
||||
.get('[data-slate-editor="true"]')
|
||||
})
|
||||
|
||||
it('should not be editable', () => {
|
||||
const slateEditor = '[data-slate-editor="true"]'
|
||||
|
||||
cy.get(slateEditor)
|
||||
.should('not.have.attr', 'contentEditable', 'true')
|
||||
.should('not.have.attr', 'role', 'textbox')
|
||||
.click()
|
Reference in New Issue
Block a user