@elementor/editor-site-navigation 0.22.8 → 0.23.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 +11 -0
- package/package.json +17 -10
- package/src/__tests__/icons-map.test.tsx +0 -33
- package/src/components/panel/actions-menu/actions/__tests__/delete.test.tsx +0 -90
- package/src/components/panel/actions-menu/actions/__tests__/set-home.test.tsx +0 -122
- package/src/components/panel/actions-menu/actions/__tests__/view.test.tsx +0 -40
- package/src/components/panel/posts-list/__tests__/post-list-item.test.tsx +0 -211
- package/src/components/panel/posts-list/__tests__/posts-collapsible-list.test.tsx +0 -248
- package/src/components/top-bar/__tests__/add-new-page.test.tsx +0 -129
- package/src/components/top-bar/__tests__/recently-edited.test.tsx +0 -380
- package/src/hooks/__tests__/use-create-page.test.ts +0 -39
- package/src/hooks/__tests__/use-homepage-actions.test.ts +0 -43
- package/src/hooks/__tests__/use-homepage.test.ts +0 -42
- package/src/hooks/__tests__/use-post-actions.test.ts +0 -89
- package/src/hooks/__tests__/use-posts.test.ts +0 -93
- package/src/hooks/__tests__/use-recent-posts.test.ts +0 -40
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { waitFor } from '@testing-library/react';
|
|
2
|
-
import apiFetch from '@wordpress/api-fetch';
|
|
3
|
-
import useRecentPosts from '../use-recent-posts';
|
|
4
|
-
import { renderHookWithQuery } from 'test-utils';
|
|
5
|
-
import { baseUrl } from '../../api/recent-posts';
|
|
6
|
-
|
|
7
|
-
// Mock apiFetch to return a promise that resolves to an empty array.
|
|
8
|
-
jest.mock( '@wordpress/api-fetch' );
|
|
9
|
-
|
|
10
|
-
describe( 'useRecentPosts', () => {
|
|
11
|
-
afterEach( () => {
|
|
12
|
-
jest.clearAllMocks();
|
|
13
|
-
} );
|
|
14
|
-
|
|
15
|
-
it( 'should return an array of posts when the request succeeds', async () => {
|
|
16
|
-
const posts = [
|
|
17
|
-
{
|
|
18
|
-
id: 1,
|
|
19
|
-
title: 'Post 1',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: 2,
|
|
23
|
-
title: 'Post 2',
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
jest.mocked( apiFetch ).mockImplementation( () => Promise.resolve( posts ) );
|
|
28
|
-
|
|
29
|
-
// Act.
|
|
30
|
-
const { component } = renderHookWithQuery( () => useRecentPosts() );
|
|
31
|
-
|
|
32
|
-
expect( apiFetch ).toHaveBeenCalledWith( {
|
|
33
|
-
path: `${ baseUrl }?posts_per_page=6`,
|
|
34
|
-
} );
|
|
35
|
-
|
|
36
|
-
await waitFor( () => {
|
|
37
|
-
expect( component.result.current.data ).toBe( posts );
|
|
38
|
-
} );
|
|
39
|
-
} );
|
|
40
|
-
} );
|