test bold parseDOM rules

This commit is contained in:
Hans Pagel
2020-10-08 03:51:39 +02:00
parent 2d82e4e1a7
commit 78cc76c1a6

View File

@@ -10,6 +10,36 @@ context('/api/extensions/bold', () => {
})
})
it('b tags should be transformed 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>')
})
})
it('b tags with normal font weight inline style should be omitted', () => {
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>')
})
})
it('generic tags with bold inline style should be transformed 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>')
editor.setContent('<p><span style="font-weight: bolder">Example Text</span></p>')
expect(editor.html()).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>')
editor.setContent('<p><span style="font-weight: 900">Example Text</span></p>')
expect(editor.html()).to.eq('<p><strong>Example Text</strong></p>')
})
})
it('the button should make the selected text bold', () => {
cy.get('.demo__preview button:first')
.click()