fix tests
This commit is contained in:
@@ -5,21 +5,21 @@ context('/api/nodes/blockquote', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse blockquote tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<blockquote><p>Example Text</p></blockquote>')
|
||||
editor.commands.setContent('<blockquote><p>Example Text</p></blockquote>')
|
||||
expect(editor.getHTML()).to.eq('<blockquote><p>Example Text</p></blockquote>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse blockquote tags without paragraphs correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<blockquote>Example Text</blockquote>')
|
||||
editor.commands.setContent('<blockquote>Example Text</blockquote>')
|
||||
expect(editor.getHTML()).to.eq('<blockquote><p>Example Text</p></blockquote>')
|
||||
})
|
||||
})
|
||||
@@ -38,8 +38,8 @@ context('/api/nodes/blockquote', () => {
|
||||
|
||||
it('the button should wrap all nodes in one blockquote', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p><p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p><p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
|
||||
cy.get('.demo__preview button:first')
|
||||
|
||||
@@ -5,21 +5,21 @@ context('/api/nodes/bullet-list', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse unordered lists correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ul><li><p>Example Text</p></li></ul>')
|
||||
editor.commands.setContent('<ul><li><p>Example Text</p></li></ul>')
|
||||
expect(editor.getHTML()).to.eq('<ul><li><p>Example Text</p></li></ul>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse unordered lists without paragraphs correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ul><li>Example Text</li></ul>')
|
||||
editor.commands.setContent('<ul><li>Example Text</li></ul>')
|
||||
expect(editor.getHTML()).to.eq('<ul><li><p>Example Text</p></li></ul>')
|
||||
})
|
||||
})
|
||||
@@ -63,7 +63,7 @@ context('/api/nodes/bullet-list', () => {
|
||||
|
||||
it('should leave the list with double enter', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -81,7 +81,7 @@ context('/api/nodes/bullet-list', () => {
|
||||
|
||||
it('should make a bullet list from an asterisk', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -98,7 +98,7 @@ context('/api/nodes/bullet-list', () => {
|
||||
|
||||
it('should make a bullet list from a dash', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -115,7 +115,7 @@ context('/api/nodes/bullet-list', () => {
|
||||
|
||||
it('should make a bullet list from a plus', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -132,7 +132,7 @@ context('/api/nodes/bullet-list', () => {
|
||||
|
||||
it('should remove the bullet list after pressing backspace', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
|
||||
@@ -5,21 +5,21 @@ context('/api/nodes/code-block', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse code blocks correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<pre><code>Example Text</code></pre>')
|
||||
editor.commands.setContent('<pre><code>Example Text</code></pre>')
|
||||
expect(editor.getHTML()).to.eq('<pre><code>Example Text</code></pre>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse code blocks with language correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<pre><code class="language-css">Example Text</code></pre>')
|
||||
editor.commands.setContent('<pre><code class="language-css">Example Text</code></pre>')
|
||||
expect(editor.getHTML()).to.eq('<pre><code class="language-css">Example Text</code></pre>')
|
||||
})
|
||||
})
|
||||
@@ -74,7 +74,7 @@ context('/api/nodes/code-block', () => {
|
||||
|
||||
it('should parse the language from a HTML code block', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<pre><code class="language-css">body { display: none; }</code></pre>')
|
||||
editor.commands.setContent('<pre><code class="language-css">body { display: none; }</code></pre>')
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.find('pre>code.language-css')
|
||||
@@ -84,7 +84,7 @@ context('/api/nodes/code-block', () => {
|
||||
|
||||
it('should make a code block from backtick markdown shortcuts', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.type('``` Code')
|
||||
@@ -95,7 +95,7 @@ context('/api/nodes/code-block', () => {
|
||||
|
||||
it('should make a code block from tilde markdown shortcuts', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.type('~~~ Code')
|
||||
@@ -106,7 +106,7 @@ context('/api/nodes/code-block', () => {
|
||||
|
||||
it('should make a code block for js with backticks', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.type('```js Code')
|
||||
@@ -117,7 +117,7 @@ context('/api/nodes/code-block', () => {
|
||||
|
||||
it('should make a code block for js with tildes', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.type('~~~js Code')
|
||||
|
||||
@@ -5,7 +5,7 @@ context('/api/nodes/document', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p></p>')
|
||||
editor.commands.setContent('<p></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -5,20 +5,20 @@ context('/api/nodes/hard-break', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse hard breaks correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example<br>Text</p>')
|
||||
editor.commands.setContent('<p>Example<br>Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example<br>Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse hard breaks with self-closing tag correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example<br />Text</p>')
|
||||
editor.commands.setContent('<p>Example<br />Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example<br>Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,8 +5,8 @@ context('/api/nodes/heading', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ context('/api/nodes/heading', () => {
|
||||
headings.forEach(html => {
|
||||
it(`should parse headings correctly (${html})`, () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent(html)
|
||||
editor.commands.setContent(html)
|
||||
expect(editor.getHTML()).to.eq(html)
|
||||
})
|
||||
})
|
||||
@@ -27,7 +27,7 @@ context('/api/nodes/heading', () => {
|
||||
|
||||
it('should omit disabled heading levels', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<h4>Example Text</h4>')
|
||||
editor.commands.setContent('<h4>Example Text</h4>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
@@ -88,7 +88,7 @@ context('/api/nodes/heading', () => {
|
||||
|
||||
it('should make a heading from the default markdown shortcut', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
|
||||
@@ -5,20 +5,20 @@ context('/api/nodes/horizontal-rule', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse horizontal rules correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p><hr>')
|
||||
editor.commands.setContent('<p>Example Text</p><hr>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p><hr>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse horizontal rules with self-closing tag correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p><hr />')
|
||||
editor.commands.setContent('<p>Example Text</p><hr />')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p><hr>')
|
||||
})
|
||||
})
|
||||
@@ -36,7 +36,7 @@ context('/api/nodes/horizontal-rule', () => {
|
||||
|
||||
it('the default markdown shortcut should add a horizontal rule', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
cy.get('.ProseMirror hr')
|
||||
.should('not.exist')
|
||||
@@ -51,7 +51,7 @@ context('/api/nodes/horizontal-rule', () => {
|
||||
|
||||
it('the alternative markdown shortcut should add a horizontal rule', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
|
||||
cy.get('.ProseMirror hr')
|
||||
.should('not.exist')
|
||||
|
||||
@@ -5,8 +5,8 @@ context('/api/nodes/image', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -5,21 +5,21 @@ context('/api/nodes/ordered-list', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse ordered lists correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ol><li><p>Example Text</p></li></ol>')
|
||||
editor.commands.setContent('<ol><li><p>Example Text</p></li></ol>')
|
||||
expect(editor.getHTML()).to.eq('<ol><li><p>Example Text</p></li></ol>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse ordered lists without paragraphs correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ol><li>Example Text</li></ol>')
|
||||
editor.commands.setContent('<ol><li>Example Text</li></ol>')
|
||||
expect(editor.getHTML()).to.eq('<ol><li><p>Example Text</p></li></ol>')
|
||||
})
|
||||
})
|
||||
@@ -63,7 +63,7 @@ context('/api/nodes/ordered-list', () => {
|
||||
|
||||
it('should leave the list with double enter', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -81,7 +81,7 @@ context('/api/nodes/ordered-list', () => {
|
||||
|
||||
it('should make a ordered list from a number', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -98,7 +98,7 @@ context('/api/nodes/ordered-list', () => {
|
||||
|
||||
it('should remove the ordered list after pressing backspace', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
|
||||
@@ -5,19 +5,19 @@ context('/api/nodes/paragraph', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse paragraphs correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
|
||||
editor.setContent('<p><x-unknown>Example Text</x-unknown></p>')
|
||||
editor.commands.setContent('<p><x-unknown>Example Text</x-unknown></p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
|
||||
editor.setContent('<p style="display: block;">Example Text</p>')
|
||||
editor.commands.setContent('<p style="display: block;">Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,21 +5,21 @@ context('/api/nodes/task-list', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
editor.selectAll()
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
editor.commands.selectAll()
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse unordered lists correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ul data-type="task_list"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
|
||||
editor.commands.setContent('<ul data-type="task_list"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
|
||||
expect(editor.getHTML()).to.eq('<ul data-type="task_list"><li data-checked="true" data-type="taskItem"><p>Example Text</p></li></ul>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse unordered lists without paragraphs correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ul data-type="task_list"><li data-checked="false" data-type="taskItem">Example Text</li></ul>')
|
||||
editor.commands.setContent('<ul data-type="task_list"><li data-checked="false" data-type="taskItem">Example Text</li></ul>')
|
||||
expect(editor.getHTML()).to.eq('<ul data-type="task_list"><li data-checked="false" data-type="taskItem"><p>Example Text</p></li></ul>')
|
||||
})
|
||||
})
|
||||
@@ -63,7 +63,7 @@ context('/api/nodes/task-list', () => {
|
||||
|
||||
it('should leave the list with double enter', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -81,7 +81,7 @@ context('/api/nodes/task-list', () => {
|
||||
|
||||
it('should make a task list from square brackets', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
@@ -100,7 +100,7 @@ context('/api/nodes/task-list', () => {
|
||||
|
||||
it.only('should make a task list from checked square brackets', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
|
||||
@@ -5,7 +5,7 @@ context('/api/nodes/text', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.clearContent()
|
||||
editor.commands.clearContent()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user