From 2cf8137def3109b58f2d3d5da6a69bcc55f16049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 13 Nov 2020 12:33:25 +0100 Subject: [PATCH] fix tests --- .../Examples/ExportHtmlOrJson/index.spec.js | 2 +- .../Examples/MarkdownShortcuts/index.spec.js | 2 +- docs/src/demos/Examples/ReadOnly/index.spec.js | 4 ++-- .../src/demos/Extensions/History/index.spec.js | 2 +- .../demos/Extensions/TextAlign/index.spec.js | 10 +++++----- .../demos/Extensions/Typography/index.spec.js | 2 +- docs/src/demos/Marks/Bold/index.spec.js | 16 ++++++++-------- docs/src/demos/Marks/Code/index.spec.js | 8 ++++---- docs/src/demos/Marks/Highlight/index.spec.js | 2 +- docs/src/demos/Marks/Italic/index.spec.js | 10 +++++----- docs/src/demos/Marks/Link/index.spec.js | 10 +++++----- docs/src/demos/Marks/Strike/index.spec.js | 12 ++++++------ docs/src/demos/Marks/Underline/index.spec.js | 8 ++++---- docs/src/demos/Nodes/Blockquote/index.spec.js | 12 ++++++------ docs/src/demos/Nodes/BulletList/index.spec.js | 18 +++++++++--------- docs/src/demos/Nodes/CodeBlock/index.spec.js | 18 +++++++++--------- docs/src/demos/Nodes/Document/index.spec.js | 2 +- docs/src/demos/Nodes/HardBreak/index.spec.js | 6 +++--- docs/src/demos/Nodes/Heading/index.spec.js | 10 +++++----- .../demos/Nodes/HorizontalRule/index.spec.js | 10 +++++----- docs/src/demos/Nodes/Image/index.spec.js | 4 ++-- docs/src/demos/Nodes/OrderedList/index.spec.js | 14 +++++++------- docs/src/demos/Nodes/Paragraph/index.spec.js | 8 ++++---- docs/src/demos/Nodes/TaskList/index.spec.js | 14 +++++++------- docs/src/demos/Nodes/Text/index.spec.js | 2 +- 25 files changed, 103 insertions(+), 103 deletions(-) diff --git a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js b/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js index 482e30c2..4e96f2a4 100644 --- a/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js +++ b/docs/src/demos/Examples/ExportHtmlOrJson/index.spec.js @@ -5,7 +5,7 @@ context('/examples/export-html-or-json', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') }) }) diff --git a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js index d284e7b2..2f7ec815 100644 --- a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js +++ b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js @@ -5,7 +5,7 @@ context('/examples/markdown-shortcuts', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.clearContent() + editor.commands.clearContent() }) }) diff --git a/docs/src/demos/Examples/ReadOnly/index.spec.js b/docs/src/demos/Examples/ReadOnly/index.spec.js index ed60f7c5..2b1e4789 100644 --- a/docs/src/demos/Examples/ReadOnly/index.spec.js +++ b/docs/src/demos/Examples/ReadOnly/index.spec.js @@ -7,7 +7,7 @@ context('/examples/read-only', () => { cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('#editable').uncheck() - editor.insertText('Edited: ') + editor.commands.insertText('Edited: ') cy.get('.ProseMirror p:first').should('not.contain', 'Edited: ') }) @@ -17,7 +17,7 @@ context('/examples/read-only', () => { cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('#editable').check() - editor.insertText('Edited: ') + editor.commands.insertText('Edited: ') cy.get('.ProseMirror p:first').should('contain', 'Edited: ') }) diff --git a/docs/src/demos/Extensions/History/index.spec.js b/docs/src/demos/Extensions/History/index.spec.js index ab1b18b5..da05f31a 100644 --- a/docs/src/demos/Extensions/History/index.spec.js +++ b/docs/src/demos/Extensions/History/index.spec.js @@ -5,7 +5,7 @@ context('/api/extensions/history', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Mistake

') + editor.commands.setContent('

Mistake

') }) }) diff --git a/docs/src/demos/Extensions/TextAlign/index.spec.js b/docs/src/demos/Extensions/TextAlign/index.spec.js index 3ebbd435..a31d7c4f 100644 --- a/docs/src/demos/Extensions/TextAlign/index.spec.js +++ b/docs/src/demos/Extensions/TextAlign/index.spec.js @@ -5,34 +5,34 @@ context('/api/extensions/text-align', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') }) }) it('should parse left align text correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should parse center align text correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should parse right align text correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should parse left justify text correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Extensions/Typography/index.spec.js b/docs/src/demos/Extensions/Typography/index.spec.js index af4fc82d..880d5794 100644 --- a/docs/src/demos/Extensions/Typography/index.spec.js +++ b/docs/src/demos/Extensions/Typography/index.spec.js @@ -5,7 +5,7 @@ context('/api/extensions/typography', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.clearContent() + editor.commands.clearContent() }) }) diff --git a/docs/src/demos/Marks/Bold/index.spec.js b/docs/src/demos/Marks/Bold/index.spec.js index d7d56680..afb9a369 100644 --- a/docs/src/demos/Marks/Bold/index.spec.js +++ b/docs/src/demos/Marks/Bold/index.spec.js @@ -5,37 +5,37 @@ context('/api/marks/bold', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should transform b tags to strong tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('sould omit b tags with normal font weight inline style', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should transform any tag with bold inline style to strong tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Marks/Code/index.spec.js b/docs/src/demos/Marks/Code/index.spec.js index 91e0fdd4..de958cfa 100644 --- a/docs/src/demos/Marks/Code/index.spec.js +++ b/docs/src/demos/Marks/Code/index.spec.js @@ -5,17 +5,17 @@ context('/api/marks/code', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse code tags correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') - editor.setContent('Example Text') + editor.commands.setContent('Example Text') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Marks/Highlight/index.spec.js b/docs/src/demos/Marks/Highlight/index.spec.js index fef5e42d..4a535fba 100644 --- a/docs/src/demos/Marks/Highlight/index.spec.js +++ b/docs/src/demos/Marks/Highlight/index.spec.js @@ -24,7 +24,7 @@ context('/api/marks/highlight', () => { it('should highlight the text in a specific color', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.highlight({ color: 'red' }) + editor.commands.highlight({ color: 'red' }) cy.get('.ProseMirror') .find('mark') diff --git a/docs/src/demos/Marks/Italic/index.spec.js b/docs/src/demos/Marks/Italic/index.spec.js index 1035bc9c..bb0682cf 100644 --- a/docs/src/demos/Marks/Italic/index.spec.js +++ b/docs/src/demos/Marks/Italic/index.spec.js @@ -5,28 +5,28 @@ context('/api/marks/italic', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('i tags should be transformed to em tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('i tags with normal font style should be omitted', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('generic tags with italic style should be transformed to strong tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Marks/Link/index.spec.js b/docs/src/demos/Marks/Link/index.spec.js index 4af1852d..af9bc526 100644 --- a/docs/src/demos/Marks/Link/index.spec.js +++ b/docs/src/demos/Marks/Link/index.spec.js @@ -5,28 +5,28 @@ context('/api/marks/link', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse a tags correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should parse a tags with target attribute correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should parse a tags with rel attribute correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Marks/Strike/index.spec.js b/docs/src/demos/Marks/Strike/index.spec.js index 98f40014..a61350a6 100644 --- a/docs/src/demos/Marks/Strike/index.spec.js +++ b/docs/src/demos/Marks/Strike/index.spec.js @@ -5,35 +5,35 @@ context('/api/marks/strike', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse s tags correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should transform del tags to s tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should transform strike tags to s tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should transform any tag with text decoration line through to s tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Marks/Underline/index.spec.js b/docs/src/demos/Marks/Underline/index.spec.js index bb1d5193..b4c59adb 100644 --- a/docs/src/demos/Marks/Underline/index.spec.js +++ b/docs/src/demos/Marks/Underline/index.spec.js @@ -5,21 +5,21 @@ context('/api/marks/underline', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse u tags correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should transform any tag with text decoration underline to u tags', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Nodes/Blockquote/index.spec.js b/docs/src/demos/Nodes/Blockquote/index.spec.js index e4318e0e..b456e504 100644 --- a/docs/src/demos/Nodes/Blockquote/index.spec.js +++ b/docs/src/demos/Nodes/Blockquote/index.spec.js @@ -5,21 +5,21 @@ context('/api/nodes/blockquote', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse blockquote tags correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) it('should parse blockquote tags without paragraphs correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('
Example Text
') + editor.commands.setContent('
Example Text
') expect(editor.getHTML()).to.eq('

Example Text

') }) }) @@ -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('

Example Text

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

Example Text

') + editor.commands.selectAll() }) cy.get('.demo__preview button:first') diff --git a/docs/src/demos/Nodes/BulletList/index.spec.js b/docs/src/demos/Nodes/BulletList/index.spec.js index 4d699aec..5d57b192 100644 --- a/docs/src/demos/Nodes/BulletList/index.spec.js +++ b/docs/src/demos/Nodes/BulletList/index.spec.js @@ -5,21 +5,21 @@ context('/api/nodes/bullet-list', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse unordered lists correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('') + editor.commands.setContent('') expect(editor.getHTML()).to.eq('') }) }) it('should parse unordered lists without paragraphs correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('') + editor.commands.setContent('') expect(editor.getHTML()).to.eq('') }) }) @@ -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') diff --git a/docs/src/demos/Nodes/CodeBlock/index.spec.js b/docs/src/demos/Nodes/CodeBlock/index.spec.js index aa2dd17c..5c073878 100644 --- a/docs/src/demos/Nodes/CodeBlock/index.spec.js +++ b/docs/src/demos/Nodes/CodeBlock/index.spec.js @@ -5,21 +5,21 @@ context('/api/nodes/code-block', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse code blocks correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('
Example Text
') + editor.commands.setContent('
Example Text
') expect(editor.getHTML()).to.eq('
Example Text
') }) }) it('should parse code blocks with language correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('
Example Text
') + editor.commands.setContent('
Example Text
') expect(editor.getHTML()).to.eq('
Example Text
') }) }) @@ -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('
body { display: none; }
') + editor.commands.setContent('
body { display: none; }
') 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') diff --git a/docs/src/demos/Nodes/Document/index.spec.js b/docs/src/demos/Nodes/Document/index.spec.js index 59529eed..63b24cfb 100644 --- a/docs/src/demos/Nodes/Document/index.spec.js +++ b/docs/src/demos/Nodes/Document/index.spec.js @@ -5,7 +5,7 @@ context('/api/nodes/document', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

') + editor.commands.setContent('

') }) }) diff --git a/docs/src/demos/Nodes/HardBreak/index.spec.js b/docs/src/demos/Nodes/HardBreak/index.spec.js index 86d516fd..8c834735 100644 --- a/docs/src/demos/Nodes/HardBreak/index.spec.js +++ b/docs/src/demos/Nodes/HardBreak/index.spec.js @@ -5,20 +5,20 @@ context('/api/nodes/hard-break', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') }) }) it('should parse hard breaks correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example
Text

') + editor.commands.setContent('

Example
Text

') expect(editor.getHTML()).to.eq('

Example
Text

') }) }) it('should parse hard breaks with self-closing tag correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example
Text

') + editor.commands.setContent('

Example
Text

') expect(editor.getHTML()).to.eq('

Example
Text

') }) }) diff --git a/docs/src/demos/Nodes/Heading/index.spec.js b/docs/src/demos/Nodes/Heading/index.spec.js index 70e5dcef..def5515b 100644 --- a/docs/src/demos/Nodes/Heading/index.spec.js +++ b/docs/src/demos/Nodes/Heading/index.spec.js @@ -5,8 +5,8 @@ context('/api/nodes/heading', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + 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('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) @@ -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') diff --git a/docs/src/demos/Nodes/HorizontalRule/index.spec.js b/docs/src/demos/Nodes/HorizontalRule/index.spec.js index 77442db8..4b6a4033 100644 --- a/docs/src/demos/Nodes/HorizontalRule/index.spec.js +++ b/docs/src/demos/Nodes/HorizontalRule/index.spec.js @@ -5,20 +5,20 @@ context('/api/nodes/horizontal-rule', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') }) }) it('should parse horizontal rules correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text


') + editor.commands.setContent('

Example Text


') expect(editor.getHTML()).to.eq('

Example Text


') }) }) it('should parse horizontal rules with self-closing tag correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text


') + editor.commands.setContent('

Example Text


') expect(editor.getHTML()).to.eq('

Example Text


') }) }) @@ -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') diff --git a/docs/src/demos/Nodes/Image/index.spec.js b/docs/src/demos/Nodes/Image/index.spec.js index 5740e17c..155aca81 100644 --- a/docs/src/demos/Nodes/Image/index.spec.js +++ b/docs/src/demos/Nodes/Image/index.spec.js @@ -5,8 +5,8 @@ context('/api/nodes/image', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) diff --git a/docs/src/demos/Nodes/OrderedList/index.spec.js b/docs/src/demos/Nodes/OrderedList/index.spec.js index 72c8ceec..b5f16049 100644 --- a/docs/src/demos/Nodes/OrderedList/index.spec.js +++ b/docs/src/demos/Nodes/OrderedList/index.spec.js @@ -5,21 +5,21 @@ context('/api/nodes/ordered-list', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse ordered lists correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('
  1. Example Text

') + editor.commands.setContent('
  1. Example Text

') expect(editor.getHTML()).to.eq('
  1. Example Text

') }) }) it('should parse ordered lists without paragraphs correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('
  1. Example Text
') + editor.commands.setContent('
  1. Example Text
') expect(editor.getHTML()).to.eq('
  1. Example Text

') }) }) @@ -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') diff --git a/docs/src/demos/Nodes/Paragraph/index.spec.js b/docs/src/demos/Nodes/Paragraph/index.spec.js index fd539594..1380413e 100644 --- a/docs/src/demos/Nodes/Paragraph/index.spec.js +++ b/docs/src/demos/Nodes/Paragraph/index.spec.js @@ -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('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') - editor.setContent('

Example Text

') + editor.commands.setContent('

Example Text

') expect(editor.getHTML()).to.eq('

Example Text

') }) }) diff --git a/docs/src/demos/Nodes/TaskList/index.spec.js b/docs/src/demos/Nodes/TaskList/index.spec.js index 6696b566..4be7315d 100644 --- a/docs/src/demos/Nodes/TaskList/index.spec.js +++ b/docs/src/demos/Nodes/TaskList/index.spec.js @@ -5,21 +5,21 @@ context('/api/nodes/task-list', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('

Example Text

') - editor.selectAll() + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() }) }) it('should parse unordered lists correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('') + editor.commands.setContent('') expect(editor.getHTML()).to.eq('') }) }) it('should parse unordered lists without paragraphs correctly', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.setContent('') + editor.commands.setContent('') expect(editor.getHTML()).to.eq('') }) }) @@ -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') diff --git a/docs/src/demos/Nodes/Text/index.spec.js b/docs/src/demos/Nodes/Text/index.spec.js index 125c4571..af3bb246 100644 --- a/docs/src/demos/Nodes/Text/index.spec.js +++ b/docs/src/demos/Nodes/Text/index.spec.js @@ -5,7 +5,7 @@ context('/api/nodes/text', () => { beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { - editor.clearContent() + editor.commands.clearContent() }) })