jodit-react 5.0.2 → 5.0.7

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.
@@ -0,0 +1,28 @@
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
+ });
@@ -0,0 +1,31 @@
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/tsconfig.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "es2015",
4
- "module": "esnext",
4
+ "module": "ESNext",
5
5
  "outDir": "./build",
6
6
  "declaration": true,
7
7
  "declarationDir": "./build/types",
8
8
  "strict": true,
9
9
  "skipLibCheck": true,
10
10
  "esModuleInterop": true,
11
+ "moduleDetection": "force",
12
+ "allowJs": true,
13
+ "noUncheckedIndexedAccess": true,
11
14
  "allowSyntheticDefaultImports": true,
12
15
  "forceConsistentCasingInFileNames": true,
13
- "verbatimModuleSyntax": true,
14
- "jsx": "react",
16
+ "jsx": "react-jsx",
15
17
  "moduleResolution": "node",
16
18
  "noImplicitAny": true
17
19
  }