really fix tests
This commit is contained in:
@@ -1,85 +1,82 @@
|
|||||||
context('/examples/basic', () => {
|
context('/examples/basic', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/examples/basic')
|
cy.visit('/examples/basic')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>foo</p>')
|
editor.setContent('<p>foo</p>')
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('export', () => {
|
it('should return html', () => {
|
||||||
it('should return html', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
const { editor } = window
|
||||||
const { editor } = window
|
const html = editor.html()
|
||||||
const html = editor.html()
|
|
||||||
|
|
||||||
expect(html).to.equal('<p>foo</p>')
|
expect(html).to.equal('<p>foo</p>')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('should return json', () => {
|
it('should return json', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
const json = editor.json()
|
const json = editor.json()
|
||||||
|
|
||||||
expect(json).to.deep.equal({
|
expect(json).to.deep.equal({
|
||||||
type: 'document',
|
type: 'document',
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: 'paragraph',
|
type: 'paragraph',
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
text: 'foo'
|
text: 'foo'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('insertText', () => {
|
it('should prepend', () => {
|
||||||
it('should prepend', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
const { editor } = window
|
||||||
const { editor } = window
|
|
||||||
|
|
||||||
editor.focus(1).insertText('bar')
|
editor.focus(1).insertText('bar')
|
||||||
cy.get('.ProseMirror p:first').should('contain', 'barfoo')
|
cy.get('.ProseMirror p:first').should('contain', 'barfoo')
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should append', () => {
|
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
|
||||||
const { editor } = window
|
|
||||||
|
|
||||||
editor.focus('end').insertText('bar')
|
|
||||||
cy.get('.ProseMirror p:first').should('contain', 'foobar')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('insertHTML', () => {
|
it('should append', () => {
|
||||||
it('should prepend', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
const { editor } = window
|
||||||
const { editor } = window
|
|
||||||
|
|
||||||
editor.focus('start').insertHTML('<p>bar</p>')
|
editor.focus('end').insertText('bar')
|
||||||
cy.get('.ProseMirror p:first').should('contain', 'bar').should('not.contain', 'foo')
|
cy.get('.ProseMirror p:first').should('contain', 'foobar')
|
||||||
cy.get('.ProseMirror p:last').should('contain', 'foo').should('not.contain', 'bar')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('should append', () => {
|
it('should prepend', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
|
|
||||||
editor.focus('end').insertHTML('<p>bar</p>')
|
editor.focus('start').insertHTML('<p>bar</p>')
|
||||||
cy.get('.ProseMirror p:first').should('contain', 'foo').should('not.contain', 'bar')
|
cy.get('.ProseMirror p:first').should('contain', 'bar').should('not.contain', 'foo')
|
||||||
cy.get('.ProseMirror p:last').should('contain', 'bar').should('not.contain', 'foo')
|
cy.get('.ProseMirror p:last').should('contain', 'foo').should('not.contain', 'bar')
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should append', () => {
|
||||||
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
|
const { editor } = window
|
||||||
|
|
||||||
|
editor.focus('end').insertHTML('<p>bar</p>')
|
||||||
|
cy.get('.ProseMirror p:first').should('contain', 'foo').should('not.contain', 'bar')
|
||||||
|
cy.get('.ProseMirror p:last').should('contain', 'bar').should('not.contain', 'foo')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -3,62 +3,60 @@ context('/examples/export-html-or-json', () => {
|
|||||||
cy.visit('/examples/export-html-or-json')
|
cy.visit('/examples/export-html-or-json')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('export', () => {
|
it('should return json', () => {
|
||||||
it('should return json', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
const { editor } = window
|
||||||
const { editor } = window
|
const json = editor.json()
|
||||||
const json = editor.json()
|
|
||||||
|
|
||||||
expect(json).to.deep.equal({
|
expect(json).to.deep.equal({
|
||||||
'type': 'document',
|
'type': 'document',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'type': 'paragraph',
|
'type': 'paragraph',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'type': 'text',
|
'type': 'text',
|
||||||
'text': 'You are able to export your data as '
|
'text': 'You are able to export your data as '
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type': 'text',
|
'type': 'text',
|
||||||
'marks': [
|
'marks': [
|
||||||
{
|
{
|
||||||
'type': 'code'
|
'type': 'code'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'text': 'HTML'
|
'text': 'HTML'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type': 'text',
|
'type': 'text',
|
||||||
'text': ' or '
|
'text': ' or '
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type': 'text',
|
'type': 'text',
|
||||||
'marks': [
|
'marks': [
|
||||||
{
|
{
|
||||||
'type': 'code'
|
'type': 'code'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'text': 'JSON'
|
'text': 'JSON'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type': 'text',
|
'type': 'text',
|
||||||
'text': '.'
|
'text': '.'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should return html', () => {
|
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
|
||||||
const { editor } = window
|
|
||||||
const html = editor.html()
|
|
||||||
|
|
||||||
expect(html).to.equal('<p>You are able to export your data as <code>HTML</code> or <code>JSON</code>.</p>')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should return html', () => {
|
||||||
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
|
const { editor } = window
|
||||||
|
const html = editor.html()
|
||||||
|
|
||||||
|
expect(html).to.equal('<p>You are able to export your data as <code>HTML</code> or <code>JSON</code>.</p>')
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
@@ -1,16 +1,14 @@
|
|||||||
context('/examples/focus', () => {
|
context('/examples/focus', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/examples/focus')
|
cy.visit('/examples/focus')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('focus class', () => {
|
it('should have class', () => {
|
||||||
it('should have class', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
const { editor } = window
|
||||||
const { editor } = window
|
editor.focus('start')
|
||||||
editor.focus('start')
|
|
||||||
|
|
||||||
cy.get('.ProseMirror p:first').should('have.class', 'has-focus')
|
cy.get('.ProseMirror p:first').should('have.class', 'has-focus')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -3,34 +3,32 @@ context('/examples/history', () => {
|
|||||||
cy.visit('/examples/history')
|
cy.visit('/examples/history')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('undo', () => {
|
it('should not have a mistake', () => {
|
||||||
it('should not have a mistake', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
const { editor } = window
|
||||||
const { editor } = window
|
const html = editor.html()
|
||||||
const html = editor.html()
|
|
||||||
|
|
||||||
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
|
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('should have a mistake', () => {
|
it('should have a mistake', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
const html = editor.html()
|
const html = editor.html()
|
||||||
|
|
||||||
editor.insertText('Mistake')
|
editor.insertText('Mistake')
|
||||||
cy.get('.ProseMirror h2:first').should('contain', 'Mistake')
|
cy.get('.ProseMirror h2:first').should('contain', 'Mistake')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('the mistake should be removed again', () => {
|
it('the mistake should be removed again', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
const html = editor.html()
|
const html = editor.html()
|
||||||
|
|
||||||
editor.undo()
|
editor.undo()
|
||||||
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
|
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,100 +1,91 @@
|
|||||||
context('/examples/markdown-shortcuts', () => {
|
context('/examples/markdown-shortcuts', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/examples/markdown-shortcuts')
|
cy.visit('/examples/markdown-shortcuts')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.clearContent()
|
editor.clearContent()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('headlines', () => {
|
it('should make a h1', () => {
|
||||||
it('should make a h1', () => {
|
cy.get('.ProseMirror')
|
||||||
cy.get('.ProseMirror')
|
.type('# Headline', { force: true })
|
||||||
.type('# Headline', {force: true})
|
.contains('h1', 'Headline')
|
||||||
.contains('h1', 'Headline')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should make a h2', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('## Headline', {force: true})
|
|
||||||
.contains('h2', 'Headline')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should make a h3', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('### Headline', {force: true})
|
|
||||||
.contains('h3', 'Headline')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should make a h4', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('#### Headline', {force: true})
|
|
||||||
.contains('h4', 'Headline')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should make a h5', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('##### Headline', {force: true})
|
|
||||||
.contains('h5', 'Headline')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should make a h6', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('###### Headline', {force: true})
|
|
||||||
.contains('h6', 'Headline')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('code', () => {
|
it('should make a h2', () => {
|
||||||
it('should create inline code', () => {
|
cy.get('.ProseMirror')
|
||||||
cy.get('.ProseMirror')
|
.type('## Headline', { force: true })
|
||||||
.type('`$foobar`', {force: true})
|
.contains('h2', 'Headline')
|
||||||
.contains('code', '$foobar')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('code block', () => {
|
it('should make a h3', () => {
|
||||||
it.skip('should create a code block without language', () => {
|
cy.get('.ProseMirror')
|
||||||
cy.get('.ProseMirror')
|
.type('### Headline', { force: true })
|
||||||
.type('``` {enter}const foo = bar{enter}```', {force: true})
|
.contains('h3', 'Headline')
|
||||||
.contains('pre', 'const foo = bar')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('bullet list', () => {
|
it('should make a h4', () => {
|
||||||
it.skip('should create a bullet list from asteriks', () => {
|
cy.get('.ProseMirror')
|
||||||
cy.get('.ProseMirror')
|
.type('#### Headline', { force: true })
|
||||||
.type('* foobar', {force: true})
|
.contains('h4', 'Headline')
|
||||||
.contains('ul', 'foobar')
|
|
||||||
})
|
|
||||||
|
|
||||||
it.skip('should create a bullet list from dashes', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('- foobar', {force: true})
|
|
||||||
.contains('ul', 'foobar')
|
|
||||||
})
|
|
||||||
|
|
||||||
it.skip('should create a bullet list from pluses', () => {
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('+ foobar', {force: true})
|
|
||||||
.contains('ul', 'foobar')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('ordered list', () => {
|
it('should make a h5', () => {
|
||||||
it.skip('should create a ordered list', () => {
|
cy.get('.ProseMirror')
|
||||||
cy.get('.ProseMirror')
|
.type('##### Headline', { force: true })
|
||||||
.type('1. foobar', {force: true})
|
.contains('h5', 'Headline')
|
||||||
.contains('ol', 'foobar')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('blockquote', () => {
|
it('should make a h6', () => {
|
||||||
it.skip('should create a blockquote', () => {
|
cy.get('.ProseMirror')
|
||||||
cy.get('.ProseMirror')
|
.type('###### Headline', { force: true })
|
||||||
.type('> foobar', {force: true})
|
.contains('h6', 'Headline')
|
||||||
.contains('blockquote', 'foobar')
|
})
|
||||||
})
|
|
||||||
|
it('should create inline code', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('`$foobar`', { force: true })
|
||||||
|
.contains('code', '$foobar')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('should create a code block without language', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('``` {enter}const foo = bar{enter}```', { force: true })
|
||||||
|
.contains('pre', 'const foo = bar')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('should create a bullet list from asteriks', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('* foobar', { force: true })
|
||||||
|
.contains('ul', 'foobar')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('should create a bullet list from dashes', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('- foobar', { force: true })
|
||||||
|
.contains('ul', 'foobar')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('should create a bullet list from pluses', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('+ foobar', { force: true })
|
||||||
|
.contains('ul', 'foobar')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('should create a ordered list', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('1. foobar', { force: true })
|
||||||
|
.contains('ol', 'foobar')
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('should create a blockquote', () => {
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('> foobar', { force: true })
|
||||||
|
.contains('blockquote', 'foobar')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -3,27 +3,25 @@ context('/examples/read-only', () => {
|
|||||||
cy.visit('/examples/read-only')
|
cy.visit('/examples/read-only')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('editable', () => {
|
it.skip('should be read-only', () => {
|
||||||
it.skip('should be read-only', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('#editable').uncheck()
|
||||||
cy.get('#editable').uncheck()
|
|
||||||
|
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.insertText('Edited: ')
|
editor.insertText('Edited: ')
|
||||||
|
|
||||||
cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ')
|
cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it.skip('should be editable', () => {
|
it.skip('should be editable', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('#editable').check()
|
cy.get('#editable').check()
|
||||||
|
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.insertText('Edited: ')
|
editor.insertText('Edited: ')
|
||||||
|
|
||||||
cy.get('.ProseMirror p:first').should('contain', 'Edited: ')
|
cy.get('.ProseMirror p:first').should('contain', 'Edited: ')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
context('/examples/simple', () => {
|
context('/examples/simple', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/examples/simple')
|
cy.visit('/examples/simple')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,55 +1,51 @@
|
|||||||
context('/api/extensions/blockquote', () => {
|
context('/api/extensions/blockquote', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/blockquote')
|
cy.visit('/api/extensions/blockquote')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('blockquote', () => {
|
it('the button should make the selected line a blockquote', () => {
|
||||||
it('the button should make the selected line a blockquote', () => {
|
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the blockquote', () => {
|
it('the button should toggle the blockquote', () => {
|
||||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror').type('{selectall}', {force: true})
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should make the selected line a blockquote', () => {
|
it('the keyboard shortcut should make the selected line a blockquote', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}{shift}9', {force: true})
|
cy.get('.ProseMirror').type('{meta}{shift}9', { force: true })
|
||||||
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the blockquote', () => {
|
it('the keyboard shortcut should toggle the blockquote', () => {
|
||||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||||
cy.get('.ProseMirror').type('{meta}{shift}9', {force: true})
|
cy.get('.ProseMirror').type('{meta}{shift}9', { force: true })
|
||||||
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
cy.get('.ProseMirror').contains('blockquote', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror').type('{selectall}', {force: true})
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
cy.get('.ProseMirror').type('{meta}{shift}9', {force: true})
|
cy.get('.ProseMirror').type('{meta}{shift}9', { force: true })
|
||||||
cy.get('.ProseMirror blockquote').should('not.exist')
|
cy.get('.ProseMirror blockquote').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a blockquote from markdown shortcuts', () => {
|
it('should make a blockquote from markdown shortcuts', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror')
|
||||||
const { editor } = window
|
.type('> Quote', { force: true })
|
||||||
editor.clearContent()
|
.contains('blockquote', 'Quote')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('> Quote', {force: true})
|
|
||||||
.contains('blockquote', 'Quote')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,45 +1,48 @@
|
|||||||
context('/api/extensions/bold', () => {
|
context('/api/extensions/bold', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/bold')
|
cy.visit('/api/extensions/bold')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('bold', () => {
|
it('the button should make the selected text bold', () => {
|
||||||
it('the button should make the selected text bold', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the selected text bold', () => {
|
it('the button should toggle the selected text bold', () => {
|
||||||
cy.get('.demo__preview button:first').dblclick({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror strong').should('not.exist')
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
})
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
|
cy.get('.ProseMirror strong').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should make the selected text bold', () => {
|
it('the keyboard shortcut should make the selected text bold', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}b', {force: true})
|
cy.get('.ProseMirror').type('{meta}b', { force: true })
|
||||||
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the selected text bold', () => {
|
it('the keyboard shortcut should toggle the selected text bold', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}b', {force: true}).type('{meta}b', {force: true})
|
cy.get('.ProseMirror').type('{meta}b', { force: true }).type('{meta}b', { force: true })
|
||||||
cy.get('.ProseMirror strong').should('not.exist')
|
cy.get('.ProseMirror strong').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a bold text from the default markdown shortcut', () => {
|
it('should make a bold text from the default markdown shortcut', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('**Bold**', {force: true})
|
.type('**Bold**', { force: true })
|
||||||
.contains('strong', 'Bold')
|
.contains('strong', 'Bold')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a bold text from the alternative markdown shortcut', () => {
|
it('should make a bold text from the alternative markdown shortcut', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('__Bold__', {force: true})
|
.type('__Bold__', { force: true })
|
||||||
.contains('strong', 'Bold')
|
.contains('strong', 'Bold')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,23 +1,26 @@
|
|||||||
context('/api/extensions/code', () => {
|
context('/api/extensions/code', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/code')
|
cy.visit('/api/extensions/code')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('code', () => {
|
it('should mark the selected text as inline code', () => {
|
||||||
it('should mark the selected text as inline code', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('code', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('code', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('should toggle the selected text as inline code', () => {
|
it('should toggle the selected text as inline code', () => {
|
||||||
cy.get('.demo__preview button:first').dblclick({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror code').should('not.exist')
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
})
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
|
cy.get('.ProseMirror code').should('not.exist')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,52 +1,48 @@
|
|||||||
context('/api/extensions/code-block', () => {
|
context('/api/extensions/code-block', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/code-block')
|
cy.visit('/api/extensions/code-block')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('code-block', () => {
|
it('the button should make the selected line a code block', () => {
|
||||||
it('the button should make the selected line a code block', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the code block', () => {
|
it('the button should toggle the code block', () => {
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror').type('{selectall}', {force: true})
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror pre').should('not.exist')
|
cy.get('.ProseMirror pre').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should make the selected line a code block', () => {
|
it('the keyboard shortcut should make the selected line a code block', () => {
|
||||||
cy.get('.ProseMirror').type('{control}{shift}\\', {force: true})
|
cy.get('.ProseMirror').type('{control}{shift}\\', { force: true })
|
||||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the code block', () => {
|
it('the keyboard shortcut should toggle the code block', () => {
|
||||||
cy.get('.ProseMirror').type('{control}{shift}\\', {force: true})
|
cy.get('.ProseMirror').type('{control}{shift}\\', { force: true })
|
||||||
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
cy.get('.ProseMirror').contains('pre', 'Example Text')
|
||||||
|
|
||||||
cy.get('.ProseMirror').type('{selectall}', {force: true})
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
cy.get('.ProseMirror').type('{control}{shift}\\', {force: true})
|
cy.get('.ProseMirror').type('{control}{shift}\\', { force: true })
|
||||||
cy.get('.ProseMirror pre').should('not.exist')
|
cy.get('.ProseMirror pre').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a code block from markdown shortcuts', () => {
|
it('should make a code block from markdown shortcuts', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror')
|
||||||
const { editor } = window
|
.type('``` {enter}Code', { force: true })
|
||||||
editor.clearContent()
|
.contains('pre', 'Code')
|
||||||
|
|
||||||
cy.get('.ProseMirror')
|
|
||||||
.type('``` {enter}Code', {force: true})
|
|
||||||
.contains('pre', 'Code')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
context('/api/extensions/document', () => {
|
context('/api/extensions/document', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/document')
|
cy.visit('/api/extensions/document')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,30 +1,30 @@
|
|||||||
context('/api/extensions/hard-break', () => {
|
context('/api/extensions/hard-break', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/hard-break')
|
cy.visit('/api/extensions/hard-break')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('hard-break', () => {
|
it('the button should add a line break', () => {
|
||||||
it('the button should add a line break', () => {
|
cy.get('.ProseMirror br').should('not.exist')
|
||||||
cy.get('.ProseMirror br').should('not.exist')
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror br').should('exist')
|
||||||
cy.get('.ProseMirror br').should('exist')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the default keyboard shortcut should add a line break', () => {
|
it('the default keyboard shortcut should add a line break', () => {
|
||||||
cy.get('.ProseMirror br').should('not.exist')
|
cy.get('.ProseMirror br').should('not.exist')
|
||||||
cy.get('.ProseMirror').type('{shift}{enter}', {force: true})
|
cy.get('.ProseMirror').type('{shift}{enter}', { force: true })
|
||||||
cy.get('.ProseMirror br').should('exist')
|
cy.get('.ProseMirror br').should('exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the alternative keyboard shortcut should add a line break', () => {
|
it('the alternative keyboard shortcut should add a line break', () => {
|
||||||
cy.get('.ProseMirror br').should('not.exist')
|
cy.get('.ProseMirror br').should('not.exist')
|
||||||
cy.get('.ProseMirror').type('{meta}{enter}', {force: true})
|
cy.get('.ProseMirror').type('{meta}{enter}', { force: true })
|
||||||
cy.get('.ProseMirror br').should('exist')
|
cy.get('.ProseMirror br').should('exist')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,31 +1,32 @@
|
|||||||
context('/api/extensions/heading', () => {
|
context('/api/extensions/heading', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/heading')
|
cy.visit('/api/extensions/heading')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('blockquote', () => {
|
it('the button should make the selected line a h1', () => {
|
||||||
it('the button should make the selected line a h1', () => {
|
cy.get('.ProseMirror h1').should('not.exist')
|
||||||
cy.get('.ProseMirror h1').should('not.exist')
|
cy.get('.demo__preview button:nth-child(1)').click({ force: true })
|
||||||
cy.get('.demo__preview button:nth-child(1)').click({ force: true })
|
cy.get('.ProseMirror').contains('h1', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('h1', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should make the selected line a h2', () => {
|
it('the button should make the selected line a h2', () => {
|
||||||
cy.get('.ProseMirror h2').should('not.exist')
|
cy.get('.ProseMirror h2').should('not.exist')
|
||||||
cy.get('.demo__preview button:nth-child(2)').click({ force: true })
|
cy.get('.demo__preview button:nth-child(2)').click({ force: true })
|
||||||
cy.get('.ProseMirror').contains('h2', 'Example Text')
|
cy.get('.ProseMirror').contains('h2', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the button should make the selected line a h3', () => {
|
it('the button should make the selected line a h3', () => {
|
||||||
cy.get('.ProseMirror h3').should('not.exist')
|
cy.get('.ProseMirror h3').should('not.exist')
|
||||||
cy.get('.demo__preview button:nth-child(3)').click({ force: true })
|
cy.get('.demo__preview button:nth-child(3)').click({ force: true })
|
||||||
cy.get('.ProseMirror').contains('h3', 'Example Text')
|
cy.get('.ProseMirror').contains('h3', 'Example Text')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,47 +1,45 @@
|
|||||||
context('/api/extensions/history', () => {
|
context('/api/extensions/history', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/history')
|
cy.visit('/api/extensions/history')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Mistake</p>')
|
editor.setContent('<p>Mistake</p>')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('undo', () => {
|
it('should make the last change undone', () => {
|
||||||
it('should make the last change undone', () => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
|
||||||
|
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the keyboard shortcut should make the last change undone', () => {
|
|
||||||
cy.get('.ProseMirror').type('{meta}z', {force: true})
|
|
||||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('redo', () => {
|
it('the keyboard shortcut should make the last change undone', () => {
|
||||||
it('should apply the last undone change again', () => {
|
cy.get('.ProseMirror').type('{meta}z', { force: true })
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
})
|
||||||
|
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
it('should apply the last undone change again', () => {
|
||||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
cy.get('.demo__preview button:nth-child(2)').click({ force: true })
|
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it.skip('the keyboard shortcut should apply the last undone change again', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror').type('{meta}z', {force: true})
|
|
||||||
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||||
|
cy.get('.demo__preview button:nth-child(2)').click({ force: true })
|
||||||
cy.get('.ProseMirror').type('{meta}{shift}z', {force: true})
|
|
||||||
cy.get('.ProseMirror').should('contain', 'Mistake')
|
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it.skip('the keyboard shortcut should apply the last undone change again', () => {
|
||||||
|
cy.get('.ProseMirror').type('{meta}z', { force: true })
|
||||||
|
cy.get('.ProseMirror').should('not.contain', 'Mistake')
|
||||||
|
|
||||||
|
cy.get('.ProseMirror').type('{meta}{shift}z', { force: true })
|
||||||
|
cy.get('.ProseMirror').should('contain', 'Mistake')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,40 +1,40 @@
|
|||||||
context('/api/extensions/horizontal-rule', () => {
|
context('/api/extensions/horizontal-rule', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/horizontal-rule')
|
cy.visit('/api/extensions/horizontal-rule')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('horizontal-rule', () => {
|
it('the button should add a horizontal rule', () => {
|
||||||
it('the button should add a horizontal rule', () => {
|
cy.get('.ProseMirror hr').should('not.exist')
|
||||||
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
|
cy.get('.ProseMirror hr').should('exist')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('the default markdown shortcut should add a horizontal rule', () => {
|
||||||
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
|
const { editor } = window
|
||||||
|
editor.clearContent()
|
||||||
|
|
||||||
cy.get('.ProseMirror hr').should('not.exist')
|
cy.get('.ProseMirror hr').should('not.exist')
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').type('---', { force: true })
|
||||||
cy.get('.ProseMirror hr').should('exist')
|
cy.get('.ProseMirror hr').should('exist')
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('the default markdown shortcut should add a horizontal rule', () => {
|
it('the alternative markdown shortcut should add a horizontal rule', () => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.clearContent()
|
editor.clearContent()
|
||||||
|
|
||||||
cy.get('.ProseMirror hr').should('not.exist')
|
cy.get('.ProseMirror hr').should('not.exist')
|
||||||
cy.get('.ProseMirror').type('---', {force: true})
|
cy.get('.ProseMirror').type('___ ', { force: true })
|
||||||
cy.get('.ProseMirror hr').should('exist')
|
cy.get('.ProseMirror hr').should('exist')
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('the alternative markdown shortcut should add a horizontal rule', () => {
|
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
|
||||||
const { editor } = window
|
|
||||||
editor.clearContent()
|
|
||||||
|
|
||||||
cy.get('.ProseMirror hr').should('not.exist')
|
|
||||||
cy.get('.ProseMirror').type('___ ', {force: true})
|
|
||||||
cy.get('.ProseMirror hr').should('exist')
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
context('/api/extensions/italic', () => {
|
context('/api/extensions/italic', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/italic')
|
cy.visit('/api/extensions/italic')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('italic', () => {
|
it('the button should make the selected text italic', () => {
|
||||||
it('the button should make the selected text italic', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('em', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('em', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the selected text italic', () => {
|
it('the button should toggle the selected text italic', () => {
|
||||||
cy.get('.demo__preview button:first').dblclick({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror em').should('not.exist')
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
})
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
|
cy.get('.ProseMirror em').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should make the selected text italic', () => {
|
it('the keyboard shortcut should make the selected text italic', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}i', {force: true})
|
cy.get('.ProseMirror').type('{meta}i', { force: true })
|
||||||
cy.get('.ProseMirror').contains('em', 'Example Text')
|
cy.get('.ProseMirror').contains('em', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the selected text italic', () => {
|
it('the keyboard shortcut should toggle the selected text italic', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}i', {force: true}).type('{meta}i', {force: true})
|
cy.get('.ProseMirror').type('{meta}i', { force: true }).type('{meta}i', { force: true })
|
||||||
cy.get('.ProseMirror em').should('not.exist')
|
cy.get('.ProseMirror em').should('not.exist')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,32 +1,33 @@
|
|||||||
context('/api/extensions/paragraph', () => {
|
context('/api/extensions/paragraph', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/paragraph')
|
cy.visit('/api/extensions/paragraph')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.clearContent()
|
editor.clearContent()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('paragraph', () => {
|
it('text should be wrapped in a paragraph by default', () => {
|
||||||
it('text should be wrapped in a paragraph by default', () => {
|
cy.get('.ProseMirror').type('Example Text', { force: true })
|
||||||
cy.get('.ProseMirror').type('Example Text', {force: true})
|
cy.get('.ProseMirror').contains('p', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('p', 'Example Text')
|
cy.get('.ProseMirror').find('p').should('have.length', 1)
|
||||||
cy.get('.ProseMirror').find('p').should('have.length', 1)
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('enter should make a new paragraph', () => {
|
it('enter should make a new paragraph', () => {
|
||||||
cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', {force: true})
|
cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true })
|
||||||
cy.get('.ProseMirror').find('p').should('have.length', 2)
|
cy.get('.ProseMirror').find('p').should('have.length', 2)
|
||||||
cy.get('.ProseMirror').contains('p:first', 'First Paragraph')
|
cy.get('.ProseMirror').contains('p:first', 'First Paragraph')
|
||||||
cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph')
|
cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('backspace should remove the second paragraph', () => {
|
it('backspace should remove the second paragraph', () => {
|
||||||
cy.get('.ProseMirror').type('{enter}', {force: true})
|
cy.get('.ProseMirror').type('{enter}', { force: true })
|
||||||
cy.get('.ProseMirror').find('p').should('have.length', 2)
|
cy.get('.ProseMirror').find('p').should('have.length', 2)
|
||||||
cy.get('.ProseMirror').type('{backspace}', {force: true})
|
cy.get('.ProseMirror').type('{backspace}', { force: true })
|
||||||
cy.get('.ProseMirror').find('p').should('have.length', 1)
|
cy.get('.ProseMirror').find('p').should('have.length', 1)
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,39 +1,42 @@
|
|||||||
context('/api/extensions/strike', () => {
|
context('/api/extensions/strike', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/strike')
|
cy.visit('/api/extensions/strike')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('strike', () => {
|
it('the button should strike the selected text', () => {
|
||||||
it('the button should strike the selected text', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('s', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('s', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the selected text striked', () => {
|
it('the button should toggle the selected text striked', () => {
|
||||||
cy.get('.demo__preview button:first').dblclick({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror s').should('not.exist')
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
})
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
|
cy.get('.ProseMirror s').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should strike the selected text', () => {
|
it('the keyboard shortcut should strike the selected text', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}d', {force: true})
|
cy.get('.ProseMirror').type('{meta}d', { force: true })
|
||||||
cy.get('.ProseMirror').contains('s', 'Example Text')
|
cy.get('.ProseMirror').contains('s', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the selected text striked', () => {
|
it('the keyboard shortcut should toggle the selected text striked', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}d', {force: true}).type('{meta}d', {force: true})
|
cy.get('.ProseMirror').type('{meta}d', { force: true }).type('{meta}d', { force: true })
|
||||||
cy.get('.ProseMirror s').should('not.exist')
|
cy.get('.ProseMirror s').should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should make a striked text from the markdown shortcut', () => {
|
it('should make a striked text from the markdown shortcut', () => {
|
||||||
cy.get('.ProseMirror')
|
cy.get('.ProseMirror')
|
||||||
.type('~Strike~', {force: true})
|
.type('~Strike~', { force: true })
|
||||||
.contains('s', 'Strike')
|
.contains('s', 'Strike')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -1,33 +1,36 @@
|
|||||||
context('/api/extensions/underline', () => {
|
context('/api/extensions/underline', () => {
|
||||||
beforeEach(() => {
|
before(() => {
|
||||||
cy.visit('/api/extensions/underline')
|
cy.visit('/api/extensions/underline')
|
||||||
|
})
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
cy.get('.ProseMirror').window().then(window => {
|
cy.get('.ProseMirror').window().then(window => {
|
||||||
const { editor } = window
|
const { editor } = window
|
||||||
editor.setContent('<p>Example Text</p>')
|
editor.setContent('<p>Example Text</p>')
|
||||||
editor.focus().selectAll()
|
editor.selectAll()
|
||||||
|
cy.wait(10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('bold', () => {
|
it('the button should underline the selected text', () => {
|
||||||
it('the button should underline the selected text', () => {
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.demo__preview button:first').click({ force: true })
|
cy.get('.ProseMirror').contains('u', 'Example Text')
|
||||||
cy.get('.ProseMirror').contains('u', 'Example Text')
|
})
|
||||||
})
|
|
||||||
|
|
||||||
it('the button should toggle the selected text underline', () => {
|
it('the button should toggle the selected text underline', () => {
|
||||||
cy.get('.demo__preview button:first').dblclick({ force: true })
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
cy.get('.ProseMirror u').should('not.exist')
|
cy.get('.ProseMirror').type('{selectall}', { force: true })
|
||||||
})
|
cy.get('.demo__preview button:first').click({ force: true })
|
||||||
|
cy.get('.ProseMirror u').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should underline the selected text', () => {
|
it('the keyboard shortcut should underline the selected text', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}u', {force: true})
|
cy.get('.ProseMirror').type('{meta}u', { force: true })
|
||||||
cy.get('.ProseMirror').contains('u', 'Example Text')
|
cy.get('.ProseMirror').contains('u', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('the keyboard shortcut should toggle the selected text underline', () => {
|
it('the keyboard shortcut should toggle the selected text underline', () => {
|
||||||
cy.get('.ProseMirror').type('{meta}u', {force: true}).type('{meta}u', {force: true})
|
cy.get('.ProseMirror').type('{meta}u', { force: true }).type('{meta}u', { force: true })
|
||||||
cy.get('.ProseMirror u').should('not.exist')
|
cy.get('.ProseMirror u').should('not.exist')
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user