really fix tests
This commit is contained in:
@@ -1,85 +1,82 @@
|
||||
context('/examples/basic', () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.visit('/examples/basic')
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
editor.setContent('<p>foo</p>')
|
||||
cy.wait(10)
|
||||
})
|
||||
})
|
||||
|
||||
describe('export', () => {
|
||||
it('should return html', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
it('should return html', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
|
||||
expect(html).to.equal('<p>foo</p>')
|
||||
})
|
||||
expect(html).to.equal('<p>foo</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should return json', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const json = editor.json()
|
||||
it('should return json', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const json = editor.json()
|
||||
|
||||
expect(json).to.deep.equal({
|
||||
type: 'document',
|
||||
content: [
|
||||
{
|
||||
type: 'paragraph',
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'foo'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
expect(json).to.deep.equal({
|
||||
type: 'document',
|
||||
content: [
|
||||
{
|
||||
type: 'paragraph',
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: 'foo'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('insertText', () => {
|
||||
it('should prepend', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
it('should prepend', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
|
||||
editor.focus(1).insertText('bar')
|
||||
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')
|
||||
})
|
||||
editor.focus(1).insertText('bar')
|
||||
cy.get('.ProseMirror p:first').should('contain', 'barfoo')
|
||||
})
|
||||
})
|
||||
|
||||
describe('insertHTML', () => {
|
||||
it('should prepend', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
it('should append', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
|
||||
editor.focus('start').insertHTML('<p>bar</p>')
|
||||
cy.get('.ProseMirror p:first').should('contain', 'bar').should('not.contain', 'foo')
|
||||
cy.get('.ProseMirror p:last').should('contain', 'foo').should('not.contain', 'bar')
|
||||
})
|
||||
editor.focus('end').insertText('bar')
|
||||
cy.get('.ProseMirror p:first').should('contain', 'foobar')
|
||||
})
|
||||
})
|
||||
|
||||
it('should append', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
it('should prepend', () => {
|
||||
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')
|
||||
})
|
||||
editor.focus('start').insertHTML('<p>bar</p>')
|
||||
cy.get('.ProseMirror p:first').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')
|
||||
})
|
||||
|
||||
describe('export', () => {
|
||||
it('should return json', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const json = editor.json()
|
||||
it('should return json', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const json = editor.json()
|
||||
|
||||
expect(json).to.deep.equal({
|
||||
'type': 'document',
|
||||
'content': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': [
|
||||
{
|
||||
'type': 'text',
|
||||
'text': 'You are able to export your data as '
|
||||
},
|
||||
{
|
||||
'type': 'text',
|
||||
'marks': [
|
||||
{
|
||||
'type': 'code'
|
||||
}
|
||||
],
|
||||
'text': 'HTML'
|
||||
},
|
||||
{
|
||||
'type': 'text',
|
||||
'text': ' or '
|
||||
},
|
||||
{
|
||||
'type': 'text',
|
||||
'marks': [
|
||||
{
|
||||
'type': 'code'
|
||||
}
|
||||
],
|
||||
'text': 'JSON'
|
||||
},
|
||||
{
|
||||
'type': '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>')
|
||||
expect(json).to.deep.equal({
|
||||
'type': 'document',
|
||||
'content': [
|
||||
{
|
||||
'type': 'paragraph',
|
||||
'content': [
|
||||
{
|
||||
'type': 'text',
|
||||
'text': 'You are able to export your data as '
|
||||
},
|
||||
{
|
||||
'type': 'text',
|
||||
'marks': [
|
||||
{
|
||||
'type': 'code'
|
||||
}
|
||||
],
|
||||
'text': 'HTML'
|
||||
},
|
||||
{
|
||||
'type': 'text',
|
||||
'text': ' or '
|
||||
},
|
||||
{
|
||||
'type': 'text',
|
||||
'marks': [
|
||||
{
|
||||
'type': 'code'
|
||||
}
|
||||
],
|
||||
'text': 'JSON'
|
||||
},
|
||||
{
|
||||
'type': '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>')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,16 +1,14 @@
|
||||
context('/examples/focus', () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.visit('/examples/focus')
|
||||
})
|
||||
|
||||
describe('focus class', () => {
|
||||
it('should have class', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
editor.focus('start')
|
||||
it('should have class', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
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')
|
||||
})
|
||||
|
||||
describe('undo', () => {
|
||||
it('should not have a mistake', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
it('should not have a mistake', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
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', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
it('should have a mistake', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
|
||||
editor.insertText('Mistake')
|
||||
cy.get('.ProseMirror h2:first').should('contain', 'Mistake')
|
||||
})
|
||||
editor.insertText('Mistake')
|
||||
cy.get('.ProseMirror h2:first').should('contain', 'Mistake')
|
||||
})
|
||||
})
|
||||
|
||||
it('the mistake should be removed again', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
it('the mistake should be removed again', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
const html = editor.html()
|
||||
|
||||
editor.undo()
|
||||
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
|
||||
})
|
||||
editor.undo()
|
||||
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,100 +1,91 @@
|
||||
context('/examples/markdown-shortcuts', () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.visit('/examples/markdown-shortcuts')
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
const { editor } = window
|
||||
editor.clearContent()
|
||||
cy.wait(10)
|
||||
})
|
||||
})
|
||||
|
||||
describe('headlines', () => {
|
||||
it('should make a h1', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('# Headline', {force: true})
|
||||
.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')
|
||||
})
|
||||
it('should make a h1', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('# Headline', { force: true })
|
||||
.contains('h1', 'Headline')
|
||||
})
|
||||
|
||||
describe('code', () => {
|
||||
it('should create inline code', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('`$foobar`', {force: true})
|
||||
.contains('code', '$foobar')
|
||||
})
|
||||
it('should make a h2', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('## Headline', { force: true })
|
||||
.contains('h2', 'Headline')
|
||||
})
|
||||
|
||||
describe('code block', () => {
|
||||
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('should make a h3', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('### Headline', { force: true })
|
||||
.contains('h3', 'Headline')
|
||||
})
|
||||
|
||||
describe('bullet list', () => {
|
||||
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('should make a h4', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('#### Headline', { force: true })
|
||||
.contains('h4', 'Headline')
|
||||
})
|
||||
|
||||
describe('ordered list', () => {
|
||||
it.skip('should create a ordered list', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('1. foobar', {force: true})
|
||||
.contains('ol', 'foobar')
|
||||
})
|
||||
it('should make a h5', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('##### Headline', { force: true })
|
||||
.contains('h5', 'Headline')
|
||||
})
|
||||
|
||||
describe('blockquote', () => {
|
||||
it.skip('should create a blockquote', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('> foobar', {force: true})
|
||||
.contains('blockquote', 'foobar')
|
||||
})
|
||||
it('should make a h6', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('###### Headline', { force: true })
|
||||
.contains('h6', 'Headline')
|
||||
})
|
||||
|
||||
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')
|
||||
})
|
||||
|
||||
describe('editable', () => {
|
||||
it.skip('should be read-only', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
cy.get('#editable').uncheck()
|
||||
it.skip('should be read-only', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
cy.get('#editable').uncheck()
|
||||
|
||||
const { editor } = window
|
||||
editor.insertText('Edited: ')
|
||||
const { editor } = window
|
||||
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', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
cy.get('#editable').check()
|
||||
it.skip('should be editable', () => {
|
||||
cy.get('.ProseMirror').window().then(window => {
|
||||
cy.get('#editable').check()
|
||||
|
||||
const { editor } = window
|
||||
editor.insertText('Edited: ')
|
||||
const { editor } = window
|
||||
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', () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
cy.visit('/examples/simple')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user