-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathEditorDisabledTest.ts
More file actions
110 lines (93 loc) · 3.7 KB
/
EditorDisabledTest.ts
File metadata and controls
110 lines (93 loc) · 3.7 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { context, describe, it } from '@ephox/bedrock-client';
import * as Loader from '../alien/Loader';
import { Assertions, Waiter } from '@ephox/agar';
describe('EditorDisabledTest', () => {
context('with TinyMCE < 7.6', () => {
Loader.withVersion('7.5', (render) => {
it('updating disabled prop should toggle the editor\'s mode', async () => {
using ctx = await render({
disabled: true
});
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
await ctx.reRender({
disabled: false
});
await Waiter.pTryUntil('mode is changed to design', () => {
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
});
});
it('updating readonly prop should toggle the editor\'s mode', async () => {
using ctx = await render({
readonly: true
});
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
await ctx.reRender({
readonly: false
});
await Waiter.pTryUntil('mode is changed to design', () => {
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
});
});
});
});
context('with TinyMCE >= 7.6', () => {
Loader.withVersion('7', (render) => {
it('updating disabled prop should only change the editor\'s state', async () => {
using ctx = await render({
disabled: true
});
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
Assertions.assertEq('editor is disabled', true, ctx.editor.options.get('disabled'));
await ctx.reRender({
disabled: false
});
await Waiter.pTryUntil('editor\'s state should be updated', () => {
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
});
});
it('updating readonly prop should only change the editor\'s mode', async () => {
using ctx = await render({
readonly: true
});
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
await ctx.reRender({
readonly: false
});
await Waiter.pTryUntil('editor\'s mode should be updated', () => {
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
});
});
});
});
context('with TinyMCE 5', () => {
Loader.withVersion('5', (render) => {
it('toggling disabled prop should update the editor\'s mode', async () => {
using ctx = await render({
disabled: true
});
Assertions.assertEq('mode is design', 'readonly', ctx.editor.mode.get());
await ctx.reRender({
disabled: false
});
await Waiter.pTryUntil('editor\'s state should be updated', () => {
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
});
});
it('toggling readonly prop should change the editor\'s mode', async () => {
using ctx = await render({
readonly: true
});
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
await ctx.reRender({
readonly: false
});
await Waiter.pTryUntil('editor\'s mode should be updated', () => {
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
});
});
});
});
});