This commit is contained in:
@@ -13,14 +13,14 @@ context('/api/extensions/blockquote', () => {
|
||||
it('should parse blockquote tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<blockquote><p>Example Text</p></blockquote>')
|
||||
expect(editor.html()).to.eq('<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>')
|
||||
expect(editor.html()).to.eq('<blockquote><p>Example Text</p></blockquote>')
|
||||
expect(editor.getHTML()).to.eq('<blockquote><p>Example Text</p></blockquote>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,30 +13,30 @@ context('/api/extensions/bold', () => {
|
||||
it('should transform b tags to strong tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><b>Example Text</b></p>')
|
||||
expect(editor.html()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('sould omit b tags with normal font weight inline style', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><b style="font-weight: normal">Example Text</b></p>')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should transform any tag with bold inline style to strong tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><span style="font-weight: bold">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
|
||||
editor.setContent('<p><span style="font-weight: bolder">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
|
||||
editor.setContent('<p><span style="font-weight: 500">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
|
||||
editor.setContent('<p><span style="font-weight: 900">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ context('/api/extensions/bullet-list', () => {
|
||||
it('should parse unordered lists correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ul><li><p>Example Text</p></li></ul>')
|
||||
expect(editor.html()).to.eq('<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>')
|
||||
expect(editor.html()).to.eq('<ul><li><p>Example Text</p></li></ul>')
|
||||
expect(editor.getHTML()).to.eq('<ul><li><p>Example Text</p></li></ul>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ context('/api/extensions/code', () => {
|
||||
it('should parse code tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><code>Example Text</code></p>')
|
||||
expect(editor.html()).to.eq('<p><code>Example Text</code></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><code>Example Text</code></p>')
|
||||
|
||||
editor.setContent('<code>Example Text</code>')
|
||||
expect(editor.html()).to.eq('<p><code>Example Text</code></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><code>Example Text</code></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ context('/api/extensions/code-block', () => {
|
||||
it('should parse code blocks correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<pre><code>Example Text</code></pre>')
|
||||
expect(editor.html()).to.eq('<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>')
|
||||
expect(editor.html()).to.eq('<pre><code class="language-css">Example Text</code></pre>')
|
||||
expect(editor.getHTML()).to.eq('<pre><code class="language-css">Example Text</code></pre>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ context('/api/extensions/document', () => {
|
||||
|
||||
it('should return the document in as json', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
const json = editor.json()
|
||||
const json = editor.getJSON()
|
||||
|
||||
expect(json).to.deep.equal({
|
||||
type: 'document',
|
||||
|
||||
@@ -12,14 +12,14 @@ context('/api/extensions/hard-break', () => {
|
||||
it('should parse hard breaks correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example<br>Text</p>')
|
||||
expect(editor.html()).to.eq('<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>')
|
||||
expect(editor.html()).to.eq('<p>Example<br>Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example<br>Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ context('/api/extensions/heading', () => {
|
||||
it(`should parse headings correctly (${html})`, () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent(html)
|
||||
expect(editor.html()).to.eq(html)
|
||||
expect(editor.getHTML()).to.eq(html)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -28,7 +28,7 @@ context('/api/extensions/heading', () => {
|
||||
it('should omit disabled heading levels', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<h4>Example Text</h4>')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ context('/api/extensions/horizontal-rule', () => {
|
||||
it('should parse horizontal rules correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p><hr>')
|
||||
expect(editor.html()).to.eq('<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 />')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p><hr>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p><hr>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,21 +13,21 @@ context('/api/extensions/italic', () => {
|
||||
it('i tags should be transformed to em tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><i>Example Text</i></p>')
|
||||
expect(editor.html()).to.eq('<p><em>Example Text</em></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><em>Example Text</em></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('i tags with normal font style should be omitted', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><i style="font-style: normal">Example Text</i></p>')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('generic tags with italic style should be transformed to strong tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><span style="font-style: italic">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><em>Example Text</em></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><em>Example Text</em></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,21 +13,21 @@ context('/api/extensions/link', () => {
|
||||
it('should parse a tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><a href="#">Example Text</a></p>')
|
||||
expect(editor.html()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags with target attribute correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><a href="#" target="_self">Example Text</a></p>')
|
||||
expect(editor.html()).to.eq('<p><a href="#" target="_self" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a href="#" target="_self" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should parse a tags with rel attribute correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><a href="#" rel="follow">Example Text</a></p>')
|
||||
expect(editor.html()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ context('/api/extensions/ordered-list', () => {
|
||||
it('should parse ordered lists correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<ol><li><p>Example Text</p></li></ol>')
|
||||
expect(editor.html()).to.eq('<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>')
|
||||
expect(editor.html()).to.eq('<ol><li><p>Example Text</p></li></ol>')
|
||||
expect(editor.getHTML()).to.eq('<ol><li><p>Example Text</p></li></ol>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ context('/api/extensions/paragraph', () => {
|
||||
it('should parse paragraphs correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p>Example Text</p>')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
|
||||
editor.setContent('<p><x-unknown>Example Text</x-unknown></p>')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
|
||||
editor.setContent('<p style="display: block;">Example Text</p>')
|
||||
expect(editor.html()).to.eq('<p>Example Text</p>')
|
||||
expect(editor.getHTML()).to.eq('<p>Example Text</p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,28 +13,28 @@ context('/api/extensions/strike', () => {
|
||||
it('should parse s tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><s>Example Text</s></p>')
|
||||
expect(editor.html()).to.eq('<p><s>Example Text</s></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><s>Example Text</s></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should transform del tags to s tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><del>Example Text</del></p>')
|
||||
expect(editor.html()).to.eq('<p><s>Example Text</s></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><s>Example Text</s></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should transform strike tags to s tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><strike>Example Text</strike></p>')
|
||||
expect(editor.html()).to.eq('<p><s>Example Text</s></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><s>Example Text</s></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should transform any tag with text decoration line through to s tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><span style="text-decoration: line-through">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><s>Example Text</s></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><s>Example Text</s></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ context('/api/extensions/underline', () => {
|
||||
it('should parse u tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><u>Example Text</u></p>')
|
||||
expect(editor.html()).to.eq('<p><u>Example Text</u></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><u>Example Text</u></p>')
|
||||
})
|
||||
})
|
||||
|
||||
it('should transform any tag with text decoration underline to u tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><span style="text-decoration: underline">Example Text</span></p>')
|
||||
expect(editor.html()).to.eq('<p><u>Example Text</u></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><u>Example Text</u></p>')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user