Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerdinand Thiessen <rpm@fthiessen.de>2022-07-26 10:59:05 +0300
committerFerdinand Thiessen <rpm@fthiessen.de>2022-07-29 17:07:56 +0300
commit22dbde70bca429a6913d072888e9c31679069406 (patch)
tree8e7f87d68dabc518528d1df199baefc1a6473530 /cypress/e2e/FrontMatter.spec.js
parent9642367e94ff22877b153b091bb5997f8c10efb7 (diff)
Added tests for the front matter node
Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Diffstat (limited to 'cypress/e2e/FrontMatter.spec.js')
-rw-r--r--cypress/e2e/FrontMatter.spec.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/cypress/e2e/FrontMatter.spec.js b/cypress/e2e/FrontMatter.spec.js
new file mode 100644
index 000000000..1a7200779
--- /dev/null
+++ b/cypress/e2e/FrontMatter.spec.js
@@ -0,0 +1,62 @@
+/**
+ * @copyright Copyright (c) 2022
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+import { initUserAndFiles, randHash } from '../utils/index.js'
+
+const randUser = randHash()
+
+describe('Front matter support', function() {
+ before(function() {
+ initUserAndFiles(randUser, 'frontmatter.md', 'empty.md')
+ })
+
+ beforeEach(function() {
+ cy.login(randUser, 'password')
+ })
+
+ it('Open file with front matter', function() {
+ cy.openFile('frontmatter.md').then(() => {
+ expect(cy.getContent().find('pre.frontmatter').length === 1)
+ })
+ })
+
+ it('Add front matter', function() {
+ cy.openFile('empty.md').clearContent().then(() => {
+ cy.getContent()
+ .type('---')
+ .type('test')
+ cy.getContent().find('pre.frontmatter').should(pre => {
+ expect(pre.length === 1)
+ expect(pre[0].text === 'test')
+ })
+ })
+ })
+
+ it('Do not add multiple front matter', function() {
+ cy.openFile('empty.md').clearContent().then(() => {
+ cy.getContent()
+ .type('---test')
+ .type('{downArrow}')
+ .type('---test')
+ cy.getContent().find('pre.frontmatter').should(pre => expect(pre.length === 1))
+ cy.getContent().find('hr').should(hr => expect(hr.length === 1))
+ })
+ })
+})