Skip to content

Commit f40c459

Browse files
authored
Merge pull request #2664 from nextcloud/feature/word-count
Feature: Show word count in RichText
2 parents 879eaec + b422776 commit f40c459

25 files changed

+200
-577
lines changed

β€Žcypress/e2e/MenuBar.spec.jsβ€Ž

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { initUserAndFiles, randHash } from '../utils/index.js'
2+
3+
const randUser = randHash()
4+
const fileName = 'test.md'
5+
6+
describe('Test the rich text editor menu bar', function() {
7+
before(() => initUserAndFiles(randUser, fileName))
8+
9+
beforeEach(function() {
10+
cy.login(randUser, 'password', {
11+
onBeforeLoad(win) {
12+
cy.stub(win, 'open')
13+
.as('winOpen')
14+
15+
},
16+
})
17+
18+
cy.openFile(fileName)
19+
})
20+
21+
describe('word count', function() {
22+
/**
23+
*
24+
*/
25+
function getWordCount() {
26+
return cy.get('.v-popper__popper .open').get('[data-text-action-entry="character-count"]')
27+
}
28+
29+
beforeEach(cy.clearContent)
30+
it('empty file', () => {
31+
cy.getFile(fileName)
32+
.then($el => {
33+
cy.getActionEntry('remain')
34+
.click()
35+
getWordCount()
36+
.should('include.text', '0 words, 0 chars')
37+
})
38+
})
39+
40+
it('single word', () => {
41+
cy.getFile(fileName)
42+
.then($el => {
43+
cy.clearContent()
44+
.type(' Hello ')
45+
cy.getActionEntry('remain')
46+
.click()
47+
getWordCount()
48+
.should('include.text', '1 word, 9 chars')
49+
})
50+
})
51+
52+
it('multiple words', () => {
53+
cy.getFile(fileName)
54+
.then($el => {
55+
cy.clearContent()
56+
.type('Hello \nworld')
57+
cy.getActionEntry('remain')
58+
.click()
59+
getWordCount()
60+
.should('include.text', '2 words, 11 chars')
61+
})
62+
})
63+
})
64+
})

β€Žjs/editor-rich.jsβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/editor-rich.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/editor.jsβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/editor.js.LICENSE.txtβ€Ž

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -159,28 +159,6 @@
159159
*
160160
*/
161161

162-
/*
163-
* @copyright Copyright (c) 2022 Max <max@nextcloud.com>
164-
*
165-
* @author Max <max@nextcloud.com>
166-
*
167-
* @license GNU AGPL version 3 or any later version
168-
*
169-
* This program is free software: you can redistribute it and/or modify
170-
* it under the terms of the GNU Affero General Public License as
171-
* published by the Free Software Foundation, either version 3 of the
172-
* License, or (at your option) any later version.
173-
*
174-
* This program is distributed in the hope that it will be useful,
175-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
176-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
177-
* GNU Affero General Public License for more details.
178-
*
179-
* You should have received a copy of the GNU Affero General Public License
180-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
181-
*
182-
*/
183-
184162
/*
185163
* @copyright Copyright (c) 2022 Vinicius Reis <vinicius@nextcloud.com>
186164
*

β€Žjs/editor.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/files-modal.jsβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/files-modal.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/text-files.jsβ€Ž

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žjs/text-files.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)