Merge branch 'main' into feature/vue-node-views
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }">
|
||||
code
|
||||
</button>
|
||||
<button @click="editor.chain().focus().unsetMarks().run()">
|
||||
<button @click="editor.chain().focus().unsetAllMarks().run()">
|
||||
clear marks
|
||||
</button>
|
||||
<button @click="editor.chain().focus().clearNodes().run()">
|
||||
|
||||
25
docs/src/demos/Examples/Basic/tests/clearContent.spec.js
Normal file
25
docs/src/demos/Examples/Basic/tests/clearContent.spec.js
Normal file
@@ -0,0 +1,25 @@
|
||||
context('clearContent', () => {
|
||||
before(() => {
|
||||
cy.visit('/examples/basic')
|
||||
})
|
||||
|
||||
it('returns true for the clearContent command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
const command = editor.commands.clearContent()
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('clears the content when using the clearContent command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
editor.commands.clearContent()
|
||||
|
||||
expect(editor.getHTML()).to.be.eq('<p></p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
25
docs/src/demos/Examples/Basic/tests/insertHTML.spec.js
Normal file
25
docs/src/demos/Examples/Basic/tests/insertHTML.spec.js
Normal file
@@ -0,0 +1,25 @@
|
||||
context('insertHTML', () => {
|
||||
before(() => {
|
||||
cy.visit('/examples/basic')
|
||||
})
|
||||
|
||||
it('returns true for the insertHTML command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
const command = editor.commands.insertHTML('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('appends the content when using the insertHTML command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
editor.commands.insertHTML('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(editor.getHTML()).to.be.eq('<p>Example Text</p><p>Cindy Lauper</p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
21
docs/src/demos/Examples/Basic/tests/setContent.spec.js
Normal file
21
docs/src/demos/Examples/Basic/tests/setContent.spec.js
Normal file
@@ -0,0 +1,21 @@
|
||||
context('setContent', () => {
|
||||
before(() => {
|
||||
cy.visit('/examples/basic')
|
||||
})
|
||||
|
||||
it('returns true for the setContent command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
const command = editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('clears the content when using the setContent command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(editor.getHTML()).to.be.eq('<p>Cindy Lauper</p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -13,7 +13,7 @@
|
||||
<button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }">
|
||||
code
|
||||
</button>
|
||||
<button @click="editor.chain().focus().unsetMarks().run()">
|
||||
<button @click="editor.chain().focus().unsetAllMarks().run()">
|
||||
clear marks
|
||||
</button>
|
||||
<button @click="editor.chain().focus().clearNodes().run()">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<button @click="editor.chain().focus().toggleCode().run()" :class="{ 'is-active': editor.isActive('code') }">
|
||||
code
|
||||
</button>
|
||||
<button @click="editor.chain().focus().unsetMarks().run()">
|
||||
<button @click="editor.chain().focus().unsetAllMarks().run()">
|
||||
clear marks
|
||||
</button>
|
||||
<button @click="editor.chain().focus().clearNodes().run()">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="editor">
|
||||
<button @click="editor.chain().focus().unsetMarks().run()">
|
||||
<button @click="editor.chain().focus().unsetAllMarks().run()">
|
||||
clear formatting
|
||||
</button>
|
||||
<button @click="editor.chain().focus().undo().run()">
|
||||
|
||||
@@ -56,14 +56,14 @@ context('/api/marks/bold', () => {
|
||||
cy.get('.ProseMirror strong').should('not.exist')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the selected text bold', () => {
|
||||
it('should make the selected text bold when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'b' })
|
||||
.find('strong')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text bold', () => {
|
||||
it('should toggle the selected text bold when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'b' })
|
||||
.find('strong')
|
||||
|
||||
@@ -43,6 +43,25 @@ context('/api/marks/code', () => {
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('should make the selected text bold when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'e' })
|
||||
.find('code')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('should toggle the selected text bold when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'e' })
|
||||
.find('code')
|
||||
.should('contain', 'Example Text')
|
||||
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'e' })
|
||||
|
||||
cy.get('.ProseMirror code').should('not.exist')
|
||||
})
|
||||
|
||||
it('should make inline code from the markdown shortcut', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.type('`Example`')
|
||||
|
||||
@@ -122,14 +122,14 @@ context('/api/marks/highlight', () => {
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should highlight the selected text', () => {
|
||||
it('should highlight the selected text when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, shiftKey: true, key: 'h' })
|
||||
.find('mark')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text highlighted', () => {
|
||||
it('should toggle the selected text highlighted when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, shiftKey: true, key: 'h' })
|
||||
.trigger('keydown', { modKey: true, shiftKey: true, key: 'h' })
|
||||
|
||||
@@ -62,14 +62,14 @@ context('/api/marks/strike', () => {
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should strike the selected text', () => {
|
||||
it('should strike the selected text when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, shiftKey: true, key: 'x' })
|
||||
.find('s')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text striked', () => {
|
||||
it('should toggle the selected text striked when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, shiftKey: true, key: 'x' })
|
||||
.trigger('keydown', { modKey: true, shiftKey: true, key: 'x' })
|
||||
|
||||
@@ -48,14 +48,14 @@ context('/api/marks/underline', () => {
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should underline the selected text', () => {
|
||||
it('should underline the selected text when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'u' })
|
||||
.find('u')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the selected text underline', () => {
|
||||
it('should toggle the selected text underline when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { modKey: true, key: 'u' })
|
||||
.trigger('keydown', { modKey: true, key: 'u' })
|
||||
|
||||
@@ -71,14 +71,14 @@ context('/api/nodes/blockquote', () => {
|
||||
.should('not.exist')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the selected line a blockquote', () => {
|
||||
it('should make the selected line a blockquote when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror')
|
||||
.trigger('keydown', { shiftKey: true, modKey: true, key: 'b' })
|
||||
.find('blockquote')
|
||||
.should('contain', 'Example Text')
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should toggle the blockquote', () => {
|
||||
it('should toggle the blockquote when the keyboard shortcut is pressed', () => {
|
||||
cy.get('.ProseMirror blockquote')
|
||||
.should('not.exist')
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ const MenuBar = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<button onClick={() => editor.chain().focus().unsetMarks().run()}>
|
||||
<button onClick={() => editor.chain().focus().unsetAllMarks().run()}>
|
||||
Clear formatting
|
||||
</button>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user