fix tests
This commit is contained in:
@@ -5,37 +5,37 @@ context('/api/marks/bold', () => {
|
||||
|
||||
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 transform b tags to strong tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><b>Example Text</b></p>')
|
||||
editor.commands.setContent('<p><b>Example Text</b></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>')
|
||||
editor.commands.setContent('<p><b style="font-weight: normal">Example Text</b></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>')
|
||||
editor.commands.setContent('<p><span style="font-weight: bold">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
|
||||
editor.setContent('<p><span style="font-weight: bolder">Example Text</span></p>')
|
||||
editor.commands.setContent('<p><span style="font-weight: bolder">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
|
||||
editor.setContent('<p><span style="font-weight: 500">Example Text</span></p>')
|
||||
editor.commands.setContent('<p><span style="font-weight: 500">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
|
||||
editor.setContent('<p><span style="font-weight: 900">Example Text</span></p>')
|
||||
editor.commands.setContent('<p><span style="font-weight: 900">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><strong>Example Text</strong></p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,17 +5,17 @@ context('/api/marks/code', () => {
|
||||
|
||||
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 tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><code>Example Text</code></p>')
|
||||
editor.commands.setContent('<p><code>Example Text</code></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><code>Example Text</code></p>')
|
||||
|
||||
editor.setContent('<code>Example Text</code>')
|
||||
editor.commands.setContent('<code>Example Text</code>')
|
||||
expect(editor.getHTML()).to.eq('<p><code>Example Text</code></p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -5,28 +5,28 @@ context('/api/marks/italic', () => {
|
||||
|
||||
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('i tags should be transformed to em tags', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><i>Example Text</i></p>')
|
||||
editor.commands.setContent('<p><i>Example Text</i></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>')
|
||||
editor.commands.setContent('<p><i style="font-style: normal">Example Text</i></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>')
|
||||
editor.commands.setContent('<p><span style="font-style: italic">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><em>Example Text</em></p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,28 +5,28 @@ context('/api/marks/link', () => {
|
||||
|
||||
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 a tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><a href="#">Example Text</a></p>')
|
||||
editor.commands.setContent('<p><a href="#">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>')
|
||||
editor.commands.setContent('<p><a href="#" target="_self">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>')
|
||||
editor.commands.setContent('<p><a href="#" rel="follow">Example Text</a></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><a href="#" target="_blank" rel="noopener noreferrer nofollow">Example Text</a></p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,35 +5,35 @@ context('/api/marks/strike', () => {
|
||||
|
||||
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 s tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><s>Example Text</s></p>')
|
||||
editor.commands.setContent('<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>')
|
||||
editor.commands.setContent('<p><del>Example Text</del></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>')
|
||||
editor.commands.setContent('<p><strike>Example Text</strike></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>')
|
||||
editor.commands.setContent('<p><span style="text-decoration: line-through">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><s>Example Text</s></p>')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,21 +5,21 @@ context('/api/marks/underline', () => {
|
||||
|
||||
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 u tags correctly', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.setContent('<p><u>Example Text</u></p>')
|
||||
editor.commands.setContent('<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>')
|
||||
editor.commands.setContent('<p><span style="text-decoration: underline">Example Text</span></p>')
|
||||
expect(editor.getHTML()).to.eq('<p><u>Example Text</u></p>')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user