Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions cypress/e2e/Table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import createEditor from './../../src/tests/createEditor.js'
import EditableTable from './../../src/nodes/EditableTable.js'
import Markdown, { createMarkdownSerializer } from './../../src/extensions/Markdown.js'

import { initUserAndFiles, randHash } from '../utils/index.js'

const randUser = randHash()
const fileName = 'empty.md'

describe('ListItem extension integrated in the editor', () => {

const editor = createEditor({
Expand Down Expand Up @@ -67,3 +72,40 @@ describe('ListItem extension integrated in the editor', () => {
return serializer.serialize(editor.state.doc)
}
})

describe('table plugin', () => {
before(() => {
initUserAndFiles(randUser)
})

beforeEach(() => {
cy.login(randUser, 'password')

cy.isolateTest({
sourceFile: fileName,
})

return cy.openFile(fileName, { force: true })
})

it('inserts and removes a table', () => {
cy.getContent()
.type('Let\'s insert a Table')

cy.getActionEntry('table').click()

cy.getContent()
.type('content')

cy.getContent()
.find('table tr:first-child th:first-child')
.should('contain', 'content')

cy.getContent()
.find('[data-text-table-actions="settings"]').click()

cy.get('[data-text-table-action="delete"]').click()
cy.getContent()
.should('not.contain', 'content')
})
})
32 changes: 0 additions & 32 deletions cypress/e2e/workspace.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,34 +153,6 @@ describe('Workspace', function() {
.should('contain', 'Hello world')
})

it('inserts and removes a table', function() {
cy.openWorkspace()
.type('Let\'s insert a Table')

cy.getMenu()
.then($el => {
// sometimes actions can be hide
if ($el.find('[data-text-action-entry="remain"]').length) {
toggleMoreActions()
return submenuButton('table').click()
}

return menuButton('table').click()
})

cy.getContent()
.type('content')
cy.getContent()
.find('table tr:first-child th:first-child')
.should('contain', 'content')
cy.getContent()
.find('[data-text-table-actions="settings"]').click()

cy.get('[data-text-table-action="delete"]').click()
cy.getContent()
.should('not.contain', 'content')
})

it('emoji picker', () => {
cy.openWorkspace()
.type('# Let\'s smile together{enter}## ')
Expand Down Expand Up @@ -323,10 +295,6 @@ const submenuButton = (name) => {
return cy.get('.v-popper__wrapper .open').getActionEntry(name)
}

const toggleMoreActions = () => {
return menuButton('remain').click()
}

const menuBubbleButton = (name) => {
return cy.get('[data-text-el="menu-bubble"]').find(`[data-text-bubble-action="${name}"]`)
}
Expand Down