-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtinymce-mock.js
45 lines (43 loc) · 900 Bytes
/
tinymce-mock.js
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
const mockEditor = {
getContainer: jest.fn(() => document.createElement('div')),
remove: jest.fn(),
on: jest.fn(),
};
const tinymce = {
init: jest.fn().mockImplementation((options) => {
options.setup && options.setup(mockEditor);
return Promise.resolve(mockEditor);
}),
remove: jest.fn(),
activeEditor: {
setContent: jest.fn(),
getContent: jest.fn(() => '<p>Mocked content</p>'),
save: jest.fn(),
remove: jest.fn(),
getContainer: jest.fn(() => document.createElement('div')),
},
models: {
dom: {
model: jest.fn(),
},
},
icons: {
default: jest.fn(),
},
themes: {
silver: jest.fn(),
},
plugins: {
advlist: jest.fn(),
lists: jest.fn(),
link: jest.fn(),
image: jest.fn(),
media: jest.fn(),
table: jest.fn(),
code: jest.fn(),
},
util: {
URI: jest.fn(),
},
};
module.exports = tinymce;