@wordpress/nux 8.2.0 → 8.3.0
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/CHANGELOG.md +2 -0
- package/package.json +9 -9
- package/src/components/dot-tip/test/index.js +16 -26
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/nux",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "NUX (New User eXperience) module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/components": "^25.
|
|
35
|
-
"@wordpress/compose": "^6.
|
|
36
|
-
"@wordpress/data": "^9.
|
|
37
|
-
"@wordpress/deprecated": "^3.
|
|
38
|
-
"@wordpress/element": "^5.
|
|
39
|
-
"@wordpress/i18n": "^4.
|
|
40
|
-
"@wordpress/icons": "^9.
|
|
34
|
+
"@wordpress/components": "^25.7.0",
|
|
35
|
+
"@wordpress/compose": "^6.18.0",
|
|
36
|
+
"@wordpress/data": "^9.11.0",
|
|
37
|
+
"@wordpress/deprecated": "^3.41.0",
|
|
38
|
+
"@wordpress/element": "^5.18.0",
|
|
39
|
+
"@wordpress/i18n": "^4.41.0",
|
|
40
|
+
"@wordpress/icons": "^9.32.0",
|
|
41
41
|
"rememo": "^4.0.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "5eac1734bcdca2301fdd37ec8cfe2a45e722a2c4"
|
|
51
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,54 +9,44 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import { DotTip } from '..';
|
|
11
11
|
|
|
12
|
-
const noop = () => {};
|
|
13
|
-
|
|
14
12
|
describe( 'DotTip', () => {
|
|
15
|
-
|
|
16
|
-
jest.useFakeTimers();
|
|
17
|
-
} );
|
|
18
|
-
|
|
19
|
-
afterEach( () => {
|
|
20
|
-
jest.useRealTimers();
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
|
-
it( 'should not render anything if invisible', async () => {
|
|
13
|
+
it( 'should not render anything if invisible', () => {
|
|
24
14
|
render(
|
|
25
15
|
<DotTip>
|
|
26
16
|
It looks like you’re writing a letter. Would you like help?
|
|
27
17
|
</DotTip>
|
|
28
18
|
);
|
|
29
19
|
|
|
30
|
-
await act( () => Promise.resolve() );
|
|
31
|
-
|
|
32
20
|
expect( screen.queryByRole( 'dialog' ) ).not.toBeInTheDocument();
|
|
33
21
|
} );
|
|
34
22
|
|
|
35
23
|
it( 'should render correctly', async () => {
|
|
36
24
|
render(
|
|
37
|
-
<DotTip isVisible
|
|
25
|
+
<DotTip isVisible>
|
|
38
26
|
It looks like you’re writing a letter. Would you like help?
|
|
39
27
|
</DotTip>
|
|
40
28
|
);
|
|
41
29
|
|
|
42
|
-
await
|
|
30
|
+
await waitFor( () =>
|
|
31
|
+
expect( screen.getByRole( 'dialog' ) ).toBePositionedPopover()
|
|
32
|
+
);
|
|
43
33
|
|
|
44
34
|
expect( screen.getByRole( 'dialog' ) ).toMatchSnapshot();
|
|
45
35
|
} );
|
|
46
36
|
|
|
47
37
|
it( 'should call onDismiss when the dismiss button is clicked', async () => {
|
|
48
|
-
const user = userEvent.setup(
|
|
49
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
50
|
-
} );
|
|
38
|
+
const user = userEvent.setup();
|
|
51
39
|
const onDismiss = jest.fn();
|
|
52
40
|
|
|
53
41
|
render(
|
|
54
|
-
<DotTip isVisible onDismiss={ onDismiss }
|
|
42
|
+
<DotTip isVisible onDismiss={ onDismiss }>
|
|
55
43
|
It looks like you’re writing a letter. Would you like help?
|
|
56
44
|
</DotTip>
|
|
57
45
|
);
|
|
58
46
|
|
|
59
|
-
await
|
|
47
|
+
await waitFor( () =>
|
|
48
|
+
expect( screen.getByRole( 'dialog' ) ).toBePositionedPopover()
|
|
49
|
+
);
|
|
60
50
|
|
|
61
51
|
await user.click( screen.getByRole( 'button', { name: 'Got it' } ) );
|
|
62
52
|
|
|
@@ -64,18 +54,18 @@ describe( 'DotTip', () => {
|
|
|
64
54
|
} );
|
|
65
55
|
|
|
66
56
|
it( 'should call onDisable when the X button is clicked', async () => {
|
|
67
|
-
const user = userEvent.setup(
|
|
68
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
69
|
-
} );
|
|
57
|
+
const user = userEvent.setup();
|
|
70
58
|
const onDisable = jest.fn();
|
|
71
59
|
|
|
72
60
|
render(
|
|
73
|
-
<DotTip isVisible onDisable={ onDisable }
|
|
61
|
+
<DotTip isVisible onDisable={ onDisable }>
|
|
74
62
|
It looks like you’re writing a letter. Would you like help?
|
|
75
63
|
</DotTip>
|
|
76
64
|
);
|
|
77
65
|
|
|
78
|
-
await
|
|
66
|
+
await waitFor( () =>
|
|
67
|
+
expect( screen.getByRole( 'dialog' ) ).toBePositionedPopover()
|
|
68
|
+
);
|
|
79
69
|
|
|
80
70
|
await user.click(
|
|
81
71
|
screen.getByRole( 'button', { name: 'Disable tips' } )
|