diff --git a/docs/src/demos/Examples/Basic/index.spec.js b/docs/src/demos/Examples/Basic/index.spec.js new file mode 100644 index 00000000..d4d07290 --- /dev/null +++ b/docs/src/demos/Examples/Basic/index.spec.js @@ -0,0 +1,22 @@ +context('/examples/basic', () => { + before(() => { + cy.visit('/examples/basic') + }) + + beforeEach(() => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('

Example Text

') + editor.commands.selectAll() + }) + }) + + it('should apply the paragraph style when the keyboard shortcut is pressed', () => { + cy.get('.ProseMirror h1').should('exist') + cy.get('.ProseMirror p').should('not.exist') + + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, altKey: true, key: '0' }) + .find('p') + .should('contain', 'Example Text') + }) +}) diff --git a/docs/src/demos/Examples/CollaborativeEditing/index.spec.js b/docs/src/demos/Examples/CollaborativeEditing/index.spec.js index 678f86ad..124cd47e 100644 --- a/docs/src/demos/Examples/CollaborativeEditing/index.spec.js +++ b/docs/src/demos/Examples/CollaborativeEditing/index.spec.js @@ -2,4 +2,6 @@ context('/examples/collaborative-editing', () => { before(() => { cy.visit('/examples/collaborative-editing') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Examples/CollaborativeEditingWs/index.spec.js b/docs/src/demos/Examples/CollaborativeEditingWs/index.spec.js deleted file mode 100644 index 3d46c471..00000000 --- a/docs/src/demos/Examples/CollaborativeEditingWs/index.spec.js +++ /dev/null @@ -1,5 +0,0 @@ -context('/examples/collaborative-editing-ws', () => { - before(() => { - cy.visit('/examples/collaborative-editing-ws') - }) -}) diff --git a/docs/src/demos/Examples/Formatting/index.spec.js b/docs/src/demos/Examples/Formatting/index.spec.js new file mode 100644 index 00000000..2b2d1895 --- /dev/null +++ b/docs/src/demos/Examples/Formatting/index.spec.js @@ -0,0 +1,7 @@ +context('/examples/formatting', () => { + before(() => { + cy.visit('/examples/formatting') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/Links/index.spec.js b/docs/src/demos/Examples/Links/index.spec.js new file mode 100644 index 00000000..6a8317b5 --- /dev/null +++ b/docs/src/demos/Examples/Links/index.spec.js @@ -0,0 +1,7 @@ +context('/examples/links', () => { + before(() => { + cy.visit('/examples/links') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/Examples/Minimalist/index.spec.js b/docs/src/demos/Examples/Minimalist/index.spec.js index 2dc1118f..a995196f 100644 --- a/docs/src/demos/Examples/Minimalist/index.spec.js +++ b/docs/src/demos/Examples/Minimalist/index.spec.js @@ -2,4 +2,6 @@ context('/examples/minimalist', () => { before(() => { cy.visit('/examples/minimalist') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Examples/TodoApp/index.spec.js b/docs/src/demos/Examples/TodoApp/index.spec.js index ee7cbc0b..a6d923c5 100644 --- a/docs/src/demos/Examples/TodoApp/index.spec.js +++ b/docs/src/demos/Examples/TodoApp/index.spec.js @@ -2,4 +2,6 @@ context('/examples/todo-app', () => { before(() => { cy.visit('/examples/todo-app') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Examples/VModel/index.spec.js b/docs/src/demos/Examples/VModel/index.spec.js new file mode 100644 index 00000000..adf1c621 --- /dev/null +++ b/docs/src/demos/Examples/VModel/index.spec.js @@ -0,0 +1,7 @@ +context('/examples/v-model', () => { + before(() => { + cy.visit('/examples/v-model') + }) + + // TODO: Write tests +}) diff --git a/docs/src/demos/ExtensionConfiguration/index.vue b/docs/src/demos/ExtensionConfiguration/index.vue deleted file mode 100644 index 01231a4f..00000000 --- a/docs/src/demos/ExtensionConfiguration/index.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - diff --git a/docs/src/demos/Extensions/Collaboration/index.spec.js b/docs/src/demos/Extensions/Collaboration/index.spec.js index cb36824e..b2c7c082 100644 --- a/docs/src/demos/Extensions/Collaboration/index.spec.js +++ b/docs/src/demos/Extensions/Collaboration/index.spec.js @@ -2,4 +2,6 @@ context('/api/extensions/collaboration', () => { before(() => { cy.visit('/api/extensions/collaboration') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Extensions/CollaborationCursor/index.spec.js b/docs/src/demos/Extensions/CollaborationCursor/index.spec.js index 77c2a808..911e121e 100644 --- a/docs/src/demos/Extensions/CollaborationCursor/index.spec.js +++ b/docs/src/demos/Extensions/CollaborationCursor/index.spec.js @@ -2,4 +2,6 @@ context('/api/extensions/collaboration-cursor', () => { before(() => { cy.visit('/api/extensions/collaboration-cursor') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Extensions/Dropcursor/index.spec.js b/docs/src/demos/Extensions/Dropcursor/index.spec.js index 4b9ff4ee..78f0c995 100644 --- a/docs/src/demos/Extensions/Dropcursor/index.spec.js +++ b/docs/src/demos/Extensions/Dropcursor/index.spec.js @@ -2,4 +2,6 @@ context('/examples/dropcursor', () => { before(() => { cy.visit('/examples/dropcursor') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Extensions/FontFamily/index.spec.js b/docs/src/demos/Extensions/FontFamily/index.spec.js index 66cd612e..8c83ec8f 100644 --- a/docs/src/demos/Extensions/FontFamily/index.spec.js +++ b/docs/src/demos/Extensions/FontFamily/index.spec.js @@ -2,4 +2,6 @@ context('/api/extensions/font-family', () => { before(() => { cy.visit('/api/extensions/font-family') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Extensions/Gapcursor/index.spec.js b/docs/src/demos/Extensions/Gapcursor/index.spec.js index 3adf87fd..cea47a83 100644 --- a/docs/src/demos/Extensions/Gapcursor/index.spec.js +++ b/docs/src/demos/Extensions/Gapcursor/index.spec.js @@ -2,4 +2,6 @@ context('/examples/gapcursor', () => { before(() => { cy.visit('/examples/gapcursor') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Extensions/TextAlign/index.spec.js b/docs/src/demos/Extensions/TextAlign/index.spec.js index a31d7c4f..94c31e74 100644 --- a/docs/src/demos/Extensions/TextAlign/index.spec.js +++ b/docs/src/demos/Extensions/TextAlign/index.spec.js @@ -81,4 +81,32 @@ context('/api/extensions/text-align', () => { .find('p') .should('have.css', 'text-align', 'left') }) + + it('aligns the text left when pressing the keyboard shortcut', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: 'l' }) + .find('p') + .should('have.css', 'text-align', 'left') + }) + + it('aligns the text center when pressing the keyboard shortcut', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: 'e' }) + .find('p') + .should('have.css', 'text-align', 'center') + }) + + it('aligns the text right when pressing the keyboard shortcut', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: 'r' }) + .find('p') + .should('have.css', 'text-align', 'right') + }) + + it('aligns the text justified when pressing the keyboard shortcut', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: 'j' }) + .find('p') + .should('have.css', 'text-align', 'justify') + }) }) diff --git a/docs/src/demos/Guide/BuildYourEditor/index.vue b/docs/src/demos/Guide/BuildYourEditor/index.vue deleted file mode 100644 index 75baf3b5..00000000 --- a/docs/src/demos/Guide/BuildYourEditor/index.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - diff --git a/docs/src/demos/Guide/GettingStarted/VueCLI/index.vue b/docs/src/demos/Guide/GettingStarted/VueCLI/index.vue deleted file mode 100644 index 511d9e98..00000000 --- a/docs/src/demos/Guide/GettingStarted/VueCLI/index.vue +++ /dev/null @@ -1,30 +0,0 @@ - - - diff --git a/docs/src/demos/Marks/TextStyle/index.spec.js b/docs/src/demos/Marks/TextStyle/index.spec.js index e5e31a5b..0a7f2c37 100644 --- a/docs/src/demos/Marks/TextStyle/index.spec.js +++ b/docs/src/demos/Marks/TextStyle/index.spec.js @@ -2,4 +2,6 @@ context('/api/marks/text-style', () => { before(() => { cy.visit('/api/marks/text-style') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Nodes/BulletList/index.spec.js b/docs/src/demos/Nodes/BulletList/index.spec.js index 5d57b192..b38b0986 100644 --- a/docs/src/demos/Nodes/BulletList/index.spec.js +++ b/docs/src/demos/Nodes/BulletList/index.spec.js @@ -79,6 +79,13 @@ context('/api/nodes/bullet-list', () => { .should('contain', 'Paragraph') }) + it('should make the paragraph a bullet list keyboard shortcut is pressed', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: '8' }) + .find('ul li') + .should('contain', 'Example Text') + }) + it('should make a bullet list from an asterisk', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.commands.clearContent() diff --git a/docs/src/demos/Nodes/Heading/index.spec.js b/docs/src/demos/Nodes/Heading/index.spec.js index def5515b..94ac41a3 100644 --- a/docs/src/demos/Nodes/Heading/index.spec.js +++ b/docs/src/demos/Nodes/Heading/index.spec.js @@ -86,7 +86,28 @@ context('/api/nodes/heading', () => { .should('not.exist') }) - it('should make a heading from the default markdown shortcut', () => { + it('should make the paragraph a h1 keyboard shortcut is pressed', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, altKey: true, key: '1' }) + .find('h1') + .should('contain', 'Example Text') + }) + + it('should make the paragraph a h2 keyboard shortcut is pressed', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, altKey: true, key: '2' }) + .find('h2') + .should('contain', 'Example Text') + }) + + it('should make the paragraph a h3 keyboard shortcut is pressed', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, altKey: true, key: '3' }) + .find('h3') + .should('contain', 'Example Text') + }) + + it('should make a h1 from the default markdown shortcut', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.commands.clearContent() }) @@ -96,4 +117,26 @@ context('/api/nodes/heading', () => { .find('h1') .should('contain', 'Headline') }) + + it('should make a h2 from the default markdown shortcut', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.clearContent() + }) + + cy.get('.ProseMirror') + .type('## Headline') + .find('h2') + .should('contain', 'Headline') + }) + + it('should make a h3 from the default markdown shortcut', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.clearContent() + }) + + cy.get('.ProseMirror') + .type('### Headline') + .find('h3') + .should('contain', 'Headline') + }) }) diff --git a/docs/src/demos/Nodes/ListItem/index.spec.js b/docs/src/demos/Nodes/ListItem/index.spec.js index f8b0c6be..97366e4c 100644 --- a/docs/src/demos/Nodes/ListItem/index.spec.js +++ b/docs/src/demos/Nodes/ListItem/index.spec.js @@ -2,4 +2,48 @@ context('/api/nodes/list-item', () => { before(() => { cy.visit('/api/nodes/list-item') }) + + beforeEach(() => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('') + }) + }) + + it('should add a new list item on Enter', () => { + cy.get('.ProseMirror') + .type('{enter}2nd Item') + + cy.get('.ProseMirror') + .find('li:nth-child(1)') + .should('contain', 'Example Text') + + cy.get('.ProseMirror') + .find('li:nth-child(2)') + .should('contain', '2nd Item') + }) + + it('should sink the list item on Tab', () => { + cy.get('.ProseMirror') + .type('{enter}') + .trigger('keydown', { key: 'Tab' }) + + cy.get('.ProseMirror').type('2nd Level') + + cy.get('.ProseMirror') + .find('li:nth-child(1) li') + .should('contain', '2nd Level') + }) + + it('should lift the list item on Shift+Tab', () => { + cy.get('.ProseMirror') + .type('{enter}') + .trigger('keydown', { key: 'Tab' }) + .trigger('keydown', { shiftKey: true, key: 'Tab' }) + + cy.get('.ProseMirror').type('1st Level') + + cy.get('.ProseMirror') + .find('li:nth-child(2)') + .should('contain', '1st Level') + }) }) diff --git a/docs/src/demos/Nodes/ListItem/index.vue b/docs/src/demos/Nodes/ListItem/index.vue index 41490aab..31b858cd 100644 --- a/docs/src/demos/Nodes/ListItem/index.vue +++ b/docs/src/demos/Nodes/ListItem/index.vue @@ -71,3 +71,50 @@ export default { }, } + + diff --git a/docs/src/demos/Nodes/OrderedList/index.spec.js b/docs/src/demos/Nodes/OrderedList/index.spec.js index b5f16049..55fa91f2 100644 --- a/docs/src/demos/Nodes/OrderedList/index.spec.js +++ b/docs/src/demos/Nodes/OrderedList/index.spec.js @@ -61,6 +61,13 @@ context('/api/nodes/ordered-list', () => { .should('not.exist') }) + it('should make the paragraph an ordered list keyboard shortcut is pressed', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: '7' }) + .find('ol li') + .should('contain', 'Example Text') + }) + it('should leave the list with double enter', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.commands.clearContent() diff --git a/docs/src/demos/Nodes/TaskItem/index.spec.js b/docs/src/demos/Nodes/TaskItem/index.spec.js index eed0a538..72f9e608 100644 --- a/docs/src/demos/Nodes/TaskItem/index.spec.js +++ b/docs/src/demos/Nodes/TaskItem/index.spec.js @@ -2,4 +2,6 @@ context('/api/nodes/task-item', () => { before(() => { cy.visit('/api/nodes/task-item') }) + + // TODO: Write tests }) diff --git a/docs/src/demos/Nodes/TaskList/index.spec.js b/docs/src/demos/Nodes/TaskList/index.spec.js index 8d7db95e..1fad8082 100644 --- a/docs/src/demos/Nodes/TaskList/index.spec.js +++ b/docs/src/demos/Nodes/TaskList/index.spec.js @@ -61,6 +61,13 @@ context('/api/nodes/task-list', () => { .should('not.exist') }) + it('should make the paragraph a task list when the keyboard shortcut is pressed', () => { + cy.get('.ProseMirror') + .trigger('keydown', { modKey: true, shiftKey: true, key: 'l' }) + .find('ul li') + .should('contain', 'Example Text') + }) + it('should leave the list with double enter', () => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.commands.clearContent() diff --git a/docs/src/demos/Overview/Installation/index.spec.js b/docs/src/demos/Overview/Installation/index.spec.js new file mode 100644 index 00000000..da07d3c5 --- /dev/null +++ b/docs/src/demos/Overview/Installation/index.spec.js @@ -0,0 +1,5 @@ +context('/overview/installation', () => { + before(() => { + cy.visit('/overview/installation') + }) +}) diff --git a/docs/src/demos/SimpleMenuBar/index.vue b/docs/src/demos/SimpleMenuBar/index.vue deleted file mode 100644 index c6c3c025..00000000 --- a/docs/src/demos/SimpleMenuBar/index.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - diff --git a/docs/src/docPages/api/keyboard-shortcuts.md b/docs/src/docPages/api/keyboard-shortcuts.md index 5788b315..2700e454 100644 --- a/docs/src/docPages/api/keyboard-shortcuts.md +++ b/docs/src/docPages/api/keyboard-shortcuts.md @@ -48,7 +48,7 @@ Most of the core extensions register their own keyboard shortcuts. Depending on | Center align | `Control` `Shift` `E` | `Cmd` `Shift` `E` | | Right align | `Control` `Shift` `R` | `Cmd` `Shift` `R` | | Justify | `Control` `Shift` `J` | `Cmd` `Shift` `J` | -| Task list | `Control` `Shift` `L` | `Cmd` `Shift` `L` | +| Task list | `Control` `Shift` `L` | `Cmd` `Shift` `L` (TODO: Conflict!) | | Code block | `Control` `Alt` `C` | `Cmd` `Alt` `C` | diff --git a/docs/src/docPages/guide/create-your-editor.md b/docs/src/docPages/guide/create-your-editor.md index 3f0f831a..4ef38766 100644 --- a/docs/src/docPages/guide/create-your-editor.md +++ b/docs/src/docPages/guide/create-your-editor.md @@ -1,8 +1,10 @@ -# Create your editor +# Create a new toolbar ## toc -## Introduction +TODO + + diff --git a/docs/src/docPages/guide/getting-started/vue-cli.md b/docs/src/docPages/guide/getting-started/vue-cli.md index 172f5a5f..5767664a 100644 --- a/docs/src/docPages/guide/getting-started/vue-cli.md +++ b/docs/src/docPages/guide/getting-started/vue-cli.md @@ -55,7 +55,38 @@ To actually start using tiptap, you’ll need to add a new component to your app This is the fastest way to get tiptap up and running with Vue. It will give you a very basic version of tiptap, without any buttons. No worries, you will be able to add more functionality soon. - +```html + + + +``` ## 5. Add it to your app Now, let’s replace the content of `src/App.vue` with the following example code to use our new `Tiptap` component in our app. diff --git a/docs/src/demos/Examples/Basic/tests/clearContent.spec.js b/docs/src/tests/core/commands/clearContent.spec.js similarity index 100% rename from docs/src/demos/Examples/Basic/tests/clearContent.spec.js rename to docs/src/tests/core/commands/clearContent.spec.js diff --git a/docs/src/demos/Examples/Basic/tests/insertHTML.spec.js b/docs/src/tests/core/commands/insertHTML.spec.js similarity index 100% rename from docs/src/demos/Examples/Basic/tests/insertHTML.spec.js rename to docs/src/tests/core/commands/insertHTML.spec.js diff --git a/docs/src/demos/Examples/Basic/tests/setContent.spec.js b/docs/src/tests/core/commands/setContent.spec.js similarity index 100% rename from docs/src/demos/Examples/Basic/tests/setContent.spec.js rename to docs/src/tests/core/commands/setContent.spec.js