diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js
index 76d7cd68..b9c93d8b 100644
--- a/docs/src/demos/Extensions/Blockquote/index.spec.js
+++ b/docs/src/demos/Extensions/Blockquote/index.spec.js
@@ -10,6 +10,20 @@ context('/api/extensions/blockquote', () => {
})
})
+ it('should parse blockquote tags correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('
Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should parse blockquote tags without paragraphs correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should make the selected line a blockquote', () => {
cy.get('.ProseMirror blockquote')
.should('not.exist')
diff --git a/docs/src/demos/Extensions/Bold/index.spec.js b/docs/src/demos/Extensions/Bold/index.spec.js
index 7e22cda1..39ae2df1 100644
--- a/docs/src/demos/Extensions/Bold/index.spec.js
+++ b/docs/src/demos/Extensions/Bold/index.spec.js
@@ -10,21 +10,21 @@ context('/api/extensions/bold', () => {
})
})
- it('b tags should be transformed to strong tags', () => {
+ it('should transform b tags to strong tags', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('Example Text
')
expect(editor.html()).to.eq('Example Text
')
})
})
- it('b tags with normal font weight inline style should be omitted', () => {
+ it('sould omit b tags with normal font weight inline style', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('Example Text
')
expect(editor.html()).to.eq('Example Text
')
})
})
- it('generic tags with bold inline style should be transformed to strong tags', () => {
+ it('should transform any tag with bold inline style to strong tags', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('Example Text
')
expect(editor.html()).to.eq('Example Text
')
diff --git a/docs/src/demos/Extensions/BulletList/index.spec.js b/docs/src/demos/Extensions/BulletList/index.spec.js
index 2636ba56..80824278 100644
--- a/docs/src/demos/Extensions/BulletList/index.spec.js
+++ b/docs/src/demos/Extensions/BulletList/index.spec.js
@@ -10,6 +10,20 @@ context('/api/extensions/bullet-list', () => {
})
})
+ it('should parse unordered lists correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('')
+ expect(editor.html()).to.eq('')
+ })
+ })
+
+ it('should parse unordered lists without paragraphs correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('')
+ expect(editor.html()).to.eq('')
+ })
+ })
+
it('the button should make the selected line a bullet list item', () => {
cy.get('.ProseMirror ul')
.should('not.exist')
diff --git a/docs/src/demos/Extensions/Code/index.spec.js b/docs/src/demos/Extensions/Code/index.spec.js
index 2b48929d..7ecd0cc7 100644
--- a/docs/src/demos/Extensions/Code/index.spec.js
+++ b/docs/src/demos/Extensions/Code/index.spec.js
@@ -10,6 +10,16 @@ context('/api/extensions/code', () => {
})
})
+ it('should parse code tags correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+
+ editor.setContent('Example Text')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('should mark the selected text as inline code', () => {
cy.get('.demo__preview button:first')
.click()
@@ -32,4 +42,11 @@ context('/api/extensions/code', () => {
cy.get('.ProseMirror code')
.should('not.exist')
})
+
+ it('should make inline code from the markdown shortcut', () => {
+ cy.get('.ProseMirror')
+ .type('`Example`')
+ .find('code')
+ .should('contain', 'Example')
+ })
})
diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js
index 7da58542..7ad110d5 100644
--- a/docs/src/demos/Extensions/CodeBlock/index.spec.js
+++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js
@@ -10,6 +10,20 @@ context('/api/extensions/code-block', () => {
})
})
+ it('should parse code blocks correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should parse code blocks with language correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should make the selected line a code block', () => {
cy.get('.demo__preview button:first')
.click()
diff --git a/docs/src/demos/Extensions/Document/index.spec.js b/docs/src/demos/Extensions/Document/index.spec.js
index e5480a1b..66a973e6 100644
--- a/docs/src/demos/Extensions/Document/index.spec.js
+++ b/docs/src/demos/Extensions/Document/index.spec.js
@@ -2,4 +2,25 @@ context('/api/extensions/document', () => {
before(() => {
cy.visit('/api/extensions/document')
})
+
+ beforeEach(() => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('')
+ })
+ })
+
+ it('should return the document in as json', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ const json = editor.json()
+
+ expect(json).to.deep.equal({
+ type: 'document',
+ content: [
+ {
+ type: 'paragraph',
+ },
+ ],
+ })
+ })
+ })
})
diff --git a/docs/src/demos/Extensions/HardBreak/index.spec.js b/docs/src/demos/Extensions/HardBreak/index.spec.js
index 9cb12634..0e5bbdc0 100644
--- a/docs/src/demos/Extensions/HardBreak/index.spec.js
+++ b/docs/src/demos/Extensions/HardBreak/index.spec.js
@@ -9,6 +9,20 @@ context('/api/extensions/hard-break', () => {
})
})
+ it('should parse hard breaks correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example
Text
')
+ expect(editor.html()).to.eq('Example
Text
')
+ })
+ })
+
+ it('should parse hard breaks with self-closing tag correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example
Text
')
+ expect(editor.html()).to.eq('Example
Text
')
+ })
+ })
+
it('the button should add a line break', () => {
cy.get('.ProseMirror br')
.should('not.exist')
diff --git a/docs/src/demos/Extensions/Heading/index.spec.js b/docs/src/demos/Extensions/Heading/index.spec.js
index 5f9c9f9c..edb14b07 100644
--- a/docs/src/demos/Extensions/Heading/index.spec.js
+++ b/docs/src/demos/Extensions/Heading/index.spec.js
@@ -10,6 +10,31 @@ context('/api/extensions/heading', () => {
})
})
+ const headings = [
+ 'Example Text
',
+ 'Example Text
',
+ 'Example Text
',
+ 'Example Text
',
+ 'Example Text
',
+ 'Example Text
',
+ ]
+
+ headings.forEach(html => {
+ it(`should parse headings correctly (${html})`, () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent(html)
+ expect(editor.html()).to.eq(html)
+ })
+ })
+ })
+
+ it('should omit invalid headings', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should make the selected line a h1', () => {
cy.get('.ProseMirror h1')
.should('not.exist')
diff --git a/docs/src/demos/Extensions/HorizontalRule/index.spec.js b/docs/src/demos/Extensions/HorizontalRule/index.spec.js
index 0f700668..8273c7ef 100644
--- a/docs/src/demos/Extensions/HorizontalRule/index.spec.js
+++ b/docs/src/demos/Extensions/HorizontalRule/index.spec.js
@@ -9,6 +9,20 @@ context('/api/extensions/horizontal-rule', () => {
})
})
+ it('should parse horizontal rules correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should parse horizontal rules with self-closing tag correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should add a horizontal rule', () => {
cy.get('.ProseMirror hr')
.should('not.exist')
diff --git a/docs/src/demos/Extensions/Link/index.spec.js b/docs/src/demos/Extensions/Link/index.spec.js
index 29db24a4..f9102b53 100644
--- a/docs/src/demos/Extensions/Link/index.spec.js
+++ b/docs/src/demos/Extensions/Link/index.spec.js
@@ -10,6 +10,27 @@ context('/api/extensions/link', () => {
})
})
+ it('should parse a tags correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should parse a tags with target attribute correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should parse a tags with rel attribute correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should add a link to the selected text', () => {
cy.window().then(win => {
cy.stub(win, 'prompt').returns('https://tiptap.dev')
diff --git a/docs/src/demos/Extensions/OrderedList/index.spec.js b/docs/src/demos/Extensions/OrderedList/index.spec.js
index a6d58920..d1cbafb2 100644
--- a/docs/src/demos/Extensions/OrderedList/index.spec.js
+++ b/docs/src/demos/Extensions/OrderedList/index.spec.js
@@ -10,6 +10,20 @@ context('/api/extensions/ordered-list', () => {
})
})
+ it('should parse ordered lists correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should parse ordered lists without paragraphs correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('- Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should make the selected line a ordered list item', () => {
cy.get('.ProseMirror ol')
.should('not.exist')
diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js
index 734f9d31..4820826b 100644
--- a/docs/src/demos/Extensions/Paragraph/index.spec.js
+++ b/docs/src/demos/Extensions/Paragraph/index.spec.js
@@ -9,6 +9,19 @@ context('/api/extensions/paragraph', () => {
})
})
+ it('should parse paragraphs correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('text should be wrapped in a paragraph by default', () => {
cy.get('.ProseMirror')
.type('Example Text')
diff --git a/docs/src/demos/Extensions/Strike/index.spec.js b/docs/src/demos/Extensions/Strike/index.spec.js
index 54db052b..dd7140dd 100644
--- a/docs/src/demos/Extensions/Strike/index.spec.js
+++ b/docs/src/demos/Extensions/Strike/index.spec.js
@@ -10,6 +10,34 @@ context('/api/extensions/strike', () => {
})
})
+ it('should parse s tags correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should transform del tags to s tags', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
+ it('should transform strike tags to s tags', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).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
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should strike the selected text', () => {
cy.get('.demo__preview button:first')
.click()
diff --git a/docs/src/demos/Extensions/Underline/index.spec.js b/docs/src/demos/Extensions/Underline/index.spec.js
index 19a28377..bf6e1572 100644
--- a/docs/src/demos/Extensions/Underline/index.spec.js
+++ b/docs/src/demos/Extensions/Underline/index.spec.js
@@ -10,6 +10,20 @@ context('/api/extensions/underline', () => {
})
})
+ it('should parse u tags correctly', () => {
+ cy.get('.ProseMirror').then(([{ editor }]) => {
+ editor.setContent('Example Text
')
+ expect(editor.html()).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
')
+ expect(editor.html()).to.eq('Example Text
')
+ })
+ })
+
it('the button should underline the selected text', () => {
cy.get('.demo__preview button:first')
.click()