-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathinputRules.spec.js
More file actions
82 lines (69 loc) · 2.37 KB
/
Copy pathinputRules.spec.js
File metadata and controls
82 lines (69 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { randUser } from '../utils/index.js'
const user = randUser()
const testPlainInputRule = (chars, expected) => {
cy.getContent().type(chars)
cy.getContent().should('contain', expected)
return cy.closeFile()
}
describe('input rules', () => {
before(() => {
cy.createUser(user)
})
beforeEach(() => {
cy.login(user)
cy.uploadTestFile()
cy.visit('/apps/files')
cy.openTestFile()
})
it('unordered list item', () => {
cy.getContent().type('* item')
cy.getContent().find('ul').find('li').should('contain', 'item')
cy.closeFile()
})
it('ordered list item', () => {
cy.getContent().type('1. item')
cy.getContent().find('ol').find('li').should('contain', 'item')
cy.closeFile()
})
it('task list item', () => {
cy.getContent().type('* [] item')
cy.getContent().find('ul').find('li').find('input[type="checkbox"]')
cy.getContent().find('ul').find('li').should('contain', 'item')
cy.closeFile()
})
it('blockquote', () => {
cy.getContent().type('> quote')
cy.getContent().find('blockquote').should('contain', 'uote')
cy.closeFile()
})
it('codeblock', () => {
cy.getContent().type('```{enter}code')
cy.getContent().find('pre').should('contain', 'code')
cy.closeFile()
})
it('inline code', () => {
cy.getContent().type('`code`')
cy.getContent().find('code').should('contain', 'code')
cy.closeFile()
})
it('link', () => {
cy.getContent().type('[link](https://nextcloud.com/)')
cy.getContent().find('a').should('contain', 'link')
cy.closeFile()
})
it('emoji', () => testPlainInputRule(':+1{enter}', '👍'))
it('typography: ellipsis', () => testPlainInputRule('...', '…'))
it('typography: copyright', () => testPlainInputRule('(c)', '©'))
it('typography: oneHalf', () => testPlainInputRule('1/2 ', '½'))
it('typography: superscriptTwo', () => testPlainInputRule('^2', '²'))
it('typography: emDash', () => testPlainInputRule('-- ', '—'))
it('typography: leftArrow', () => testPlainInputRule('<- ', '←'))
it('typography: rightArrow', () => testPlainInputRule('->', '→'))
it('typography: leftRightArrow', () => testPlainInputRule('<->', '↔'))
it('typography: leftRightDoubleArrow', () => testPlainInputRule('<=>', '⇔'))
it('typography: leftRightLongArrow', () => testPlainInputRule('<-->', '⟷'))
})