Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Feature: Show word count in RichText
Show word count as last element of the overflow menu,
which now will be always shown. The word count
is updated when the menu is openend as the
tiptap word count is not reactive.

Modified ActionList: Added a named slot for adding
elements that should always shown as the last elements.

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and mejo- committed Oct 5, 2022
commit 9cf2534ae39b8cfbb01d7d1a6e7918cdf159e5b2
64 changes: 64 additions & 0 deletions cypress/e2e/MenuBar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { initUserAndFiles, randHash } from '../utils/index.js'

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

describe('Test the rich text editor menu bar', function() {
before(() => initUserAndFiles(randUser, fileName))

beforeEach(function() {
cy.login(randUser, 'password', {
onBeforeLoad(win) {
cy.stub(win, 'open')
.as('winOpen')

},
})

cy.openFile(fileName)
})

describe('word count', function() {
/**
*
*/
function getWordCount() {
return cy.get('.popover .open').get('[data-text-action-entry="word-count"]')
}

beforeEach(cy.clearContent)
it('empty file', () => {
cy.getFile(fileName)
.then($el => {
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '0 words')
})
})

it('single word', () => {
cy.getFile(fileName)
.then($el => {
cy.getContent()
.type(' Hello ')
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '1 word')
})
})

it('multiple words', () => {
cy.getFile(fileName)
.then($el => {
cy.getContent()
.type('Hello \nworld')
cy.getActionEntry('remain')
.click()
getWordCount()
.should('include.text', '2 word')
})
})
})
})
Loading