Skip to content

Commit 93815f4

Browse files
committed
TINY-11906: Update tests
1 parent 82b17af commit 93815f4

1 file changed

Lines changed: 54 additions & 58 deletions

File tree

src/test/ts/browser/EditorDisabledTest.ts

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,74 @@ import { Assertions, Waiter } from '@ephox/agar';
44

55
describe('EditorDisabledTest', () => {
66

7-
context('with TinyMCE before 7.6', () => {
8-
([ '7.5' ] as Array<any>).forEach((version) =>
9-
Loader.withVersion(version, (render) => {
10-
it('updating disabled prop should toggle the editor\'s mode', async () => {
11-
using ctx = await render({
12-
disabled: true
13-
});
7+
context('with TinyMCE < 7.6', () => {
8+
Loader.withVersion('7.5', (render) => {
9+
it('updating disabled prop should toggle the editor\'s mode', async () => {
10+
using ctx = await render({
11+
disabled: true
12+
});
1413

15-
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
14+
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
1615

17-
await ctx.reRender({
18-
disabled: false
19-
});
20-
await Waiter.pTryUntil('mode is changed to design', () => {
21-
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
22-
});
16+
await ctx.reRender({
17+
disabled: false
18+
});
19+
await Waiter.pTryUntil('mode is changed to design', () => {
20+
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
2321
});
22+
});
2423

25-
it('updating readonly prop should toggle the editor\'s mode', async () => {
26-
using ctx = await render({
27-
readonly: true
28-
});
29-
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
24+
it('updating readonly prop should toggle the editor\'s mode', async () => {
25+
using ctx = await render({
26+
readonly: true
27+
});
28+
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
3029

31-
await ctx.reRender({
32-
readonly: false
33-
});
34-
await Waiter.pTryUntil('mode is changed to design', () => {
35-
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
36-
});
30+
await ctx.reRender({
31+
readonly: false
3732
});
38-
})
39-
);
33+
await Waiter.pTryUntil('mode is changed to design', () => {
34+
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
35+
});
36+
});
37+
});
4038
});
4139

42-
context('with TinyMCE 7.6 and above', () => {
43-
([ '7' ] as Array<any>).forEach((version) =>
44-
Loader.withVersion(version, (render) => {
45-
it('updating disabled prop should only change the editor\'s state', async () => {
46-
using ctx = await render({
47-
disabled: true
48-
});
49-
50-
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
51-
Assertions.assertEq('editor is disabled', true, ctx.editor.options.get('disabled'));
40+
context('with TinyMCE >= 7.6', () => {
41+
Loader.withVersion('7', (render) => {
42+
it('updating disabled prop should only change the editor\'s state', async () => {
43+
using ctx = await render({
44+
disabled: true
45+
});
5246

53-
await ctx.reRender({
54-
disabled: false
55-
});
47+
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
48+
Assertions.assertEq('editor is disabled', true, ctx.editor.options.get('disabled'));
5649

57-
await Waiter.pTryUntil('editor\'s state should be updated', () => {
58-
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
59-
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
60-
});
50+
await ctx.reRender({
51+
disabled: false
6152
});
6253

63-
it('updating readonly prop should only change the editor\'s mode', async () => {
64-
using ctx = await render({
65-
readonly: true
66-
});
67-
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
54+
await Waiter.pTryUntil('editor\'s state should be updated', () => {
55+
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
6856
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
57+
});
58+
});
59+
60+
it('updating readonly prop should only change the editor\'s mode', async () => {
61+
using ctx = await render({
62+
readonly: true
63+
});
64+
Assertions.assertEq('mode is readonly', 'readonly', ctx.editor.mode.get());
65+
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
6966

70-
await ctx.reRender({
71-
readonly: false
72-
});
73-
await Waiter.pTryUntil('editor\'s mode should be updated', () => {
74-
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
75-
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
76-
});
67+
await ctx.reRender({
68+
readonly: false
69+
});
70+
await Waiter.pTryUntil('editor\'s mode should be updated', () => {
71+
Assertions.assertEq('mode is design', 'design', ctx.editor.mode.get());
72+
Assertions.assertEq('editor is not disabled', false, ctx.editor.options.get('disabled'));
7773
});
78-
})
79-
);
74+
});
75+
});
8076
});
8177
});

0 commit comments

Comments
 (0)