-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <rpm@fthiessen.de>
- Loading branch information
1 parent
50dd58f
commit d26ef67
Showing
6 changed files
with
146 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.