jodit-react 5.0.10 → 5.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/jodit-react.js +1 -1
- package/build/jodit-react.js.LICENSE.txt +3 -5
- package/build/types/JoditEditor.d.ts +5 -6
- package/build/types/include.jodit.d.ts +62 -1
- package/build/types/include.jodit.js +63 -4
- package/package.json +2 -2
- package/src/JoditEditor.tsx +5 -6
- package/src/include.jodit.ts +65 -5
- package/__mocks__/styleMock.js +0 -2
- package/jest.config.ts +0 -191
- package/tests/__snapshots__/smoke.test.tsx.snap +0 -1421
- package/tests/onchange.test.tsx +0 -28
- package/tests/ref.test.tsx +0 -46
- package/tests/smoke.test.tsx +0 -31
- package/tests/theme.test.tsx +0 -18
package/tests/onchange.test.tsx
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { describe, it } from '@jest/globals';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import JoditEditor from '../src';
|
|
5
|
-
|
|
6
|
-
describe('On change Test', () => {
|
|
7
|
-
describe('On init', () => {
|
|
8
|
-
it('should not call handler', () => {
|
|
9
|
-
const onChange = jest.fn();
|
|
10
|
-
const value = '<p>Hello, World!</p>';
|
|
11
|
-
render(<JoditEditor value={value} onChange={onChange} />);
|
|
12
|
-
expect(onChange).toHaveBeenCalledTimes(0);
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('On change text', () => {
|
|
17
|
-
it('should call handler every time', async () => {
|
|
18
|
-
const onChange = jest.fn();
|
|
19
|
-
let value = '<p>Hello, World!</p>';
|
|
20
|
-
const stamp = render(
|
|
21
|
-
<JoditEditor value={value} onChange={onChange} />
|
|
22
|
-
);
|
|
23
|
-
value = '<p>Hello!</p>';
|
|
24
|
-
stamp.rerender(<JoditEditor value={value} onChange={onChange} />);
|
|
25
|
-
expect(onChange).toHaveBeenCalledTimes(1);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
package/tests/ref.test.tsx
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { describe, it } from '@jest/globals';
|
|
3
|
-
import { render, act } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import JoditEditor from '../src';
|
|
6
|
-
import type { IJodit } from 'jodit/types/types/jodit';
|
|
7
|
-
|
|
8
|
-
describe('Ref Test', () => {
|
|
9
|
-
describe('Ref as function', () => {
|
|
10
|
-
it('should be instance of imperative Jodit', () => {
|
|
11
|
-
const ref = React.createRef<IJodit>();
|
|
12
|
-
|
|
13
|
-
const App = () => (
|
|
14
|
-
<JoditEditor
|
|
15
|
-
ref={newRef => {
|
|
16
|
-
ref.current = newRef;
|
|
17
|
-
}}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const elm = render(<App />);
|
|
22
|
-
|
|
23
|
-
act(() => {
|
|
24
|
-
elm.rerender(<App />);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
expect(ref.current?.isJodit).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('Ref as object', () => {
|
|
32
|
-
it('should be instance of imperative Jodit', () => {
|
|
33
|
-
const ref = React.createRef<IJodit>();
|
|
34
|
-
|
|
35
|
-
const App = () => <JoditEditor ref={ref} />;
|
|
36
|
-
|
|
37
|
-
const elm = render(<App />);
|
|
38
|
-
|
|
39
|
-
act(() => {
|
|
40
|
-
elm.rerender(<App />);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
expect(ref.current?.isJodit).toBe(true);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
package/tests/smoke.test.tsx
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { describe, it } from '@jest/globals';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import JoditEditor from '../src';
|
|
6
|
-
|
|
7
|
-
describe('Smoke Test', () => {
|
|
8
|
-
it('should render without crashing', () => {
|
|
9
|
-
const { asFragment, getByText } = render(
|
|
10
|
-
<JoditEditor value={'<p>Hello, world!</p>'} />
|
|
11
|
-
);
|
|
12
|
-
expect(getByText('Hello, world!')).toBeInTheDocument();
|
|
13
|
-
expect(asFragment()).toMatchSnapshot();
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe('Config', () => {
|
|
17
|
-
it('should render without crashing', () => {
|
|
18
|
-
const config = {
|
|
19
|
-
readonly: true,
|
|
20
|
-
sourceEditor: 'ace',
|
|
21
|
-
disabled: true
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const { asFragment, getByText } = render(
|
|
25
|
-
<JoditEditor value={'<p>Hello, world!</p>'} config={config} />
|
|
26
|
-
);
|
|
27
|
-
expect(getByText('Hello, world!')).toBeInTheDocument();
|
|
28
|
-
expect(asFragment()).toMatchSnapshot();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
package/tests/theme.test.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { describe, it } from '@jest/globals';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import JoditEditor from '../src';
|
|
6
|
-
|
|
7
|
-
describe('Theme Test', () => {
|
|
8
|
-
it('should render with theme classname', () => {
|
|
9
|
-
const { container } = render(
|
|
10
|
-
<JoditEditor config={{ theme: 'summer' }} />
|
|
11
|
-
);
|
|
12
|
-
expect(
|
|
13
|
-
container
|
|
14
|
-
.querySelector('.jodit-container')!
|
|
15
|
-
.classList.contains('jodit_theme_summer')
|
|
16
|
-
).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
});
|