@wordpress/block-directory 5.54.2-next.v.202608281122.0 → 5.55.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 +5 -1
- package/build-style/style-rtl.css +3 -5
- package/build-style/style.css +3 -5
- package/package.json +25 -24
- package/src/components/block-ratings/style.scss +2 -2
- package/src/components/downloadable-block-icon/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +4 -4
- package/src/components/downloadable-block-icon/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/downloadable-block-list-item/test/{index.jsx → index.jsdom.test.jsx} +19 -17
- package/src/components/downloadable-blocks-list/test/{index.jsx → index.jsdom.test.jsx} +15 -15
- package/src/store/test/{actions.js → actions.jsdom.test.js} +7 -5
- package/src/store/test/{load-assets.js → load-assets.jsdom.test.js} +1 -0
- package/src/store/test/reducer.js +1 -0
- package/src/store/test/{selectors.js → selectors.jsdom.test.js} +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 5.
|
|
5
|
+
## 5.55.0 (2026-09-10)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- `BlockRatings`: Preserve full, half, and empty star colors after the icons became stroke-based. ([#78808](https://github.com/WordPress/gutenberg/pull/78808))
|
|
6
10
|
|
|
7
11
|
### Internal
|
|
8
12
|
|
|
@@ -116,11 +116,11 @@
|
|
|
116
116
|
display: flex;
|
|
117
117
|
}
|
|
118
118
|
.block-directory-block-ratings svg {
|
|
119
|
-
|
|
119
|
+
color: #1e1e1e;
|
|
120
120
|
margin-right: -4px;
|
|
121
121
|
}
|
|
122
122
|
.block-directory-block-ratings .block-directory-block-ratings__star-empty {
|
|
123
|
-
|
|
123
|
+
color: #ccc;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.block-directory-compact-list {
|
|
@@ -169,9 +169,7 @@
|
|
|
169
169
|
height: auto;
|
|
170
170
|
padding: 12px;
|
|
171
171
|
margin: 0;
|
|
172
|
-
|
|
173
|
-
-moz-appearance: none;
|
|
174
|
-
appearance: none;
|
|
172
|
+
appearance: none;
|
|
175
173
|
background: none;
|
|
176
174
|
border: 0;
|
|
177
175
|
text-align: right;
|
package/build-style/style.css
CHANGED
|
@@ -116,11 +116,11 @@
|
|
|
116
116
|
display: flex;
|
|
117
117
|
}
|
|
118
118
|
.block-directory-block-ratings svg {
|
|
119
|
-
|
|
119
|
+
color: #1e1e1e;
|
|
120
120
|
margin-left: -4px;
|
|
121
121
|
}
|
|
122
122
|
.block-directory-block-ratings .block-directory-block-ratings__star-empty {
|
|
123
|
-
|
|
123
|
+
color: #ccc;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
.block-directory-compact-list {
|
|
@@ -169,9 +169,7 @@
|
|
|
169
169
|
height: auto;
|
|
170
170
|
padding: 12px;
|
|
171
171
|
margin: 0;
|
|
172
|
-
|
|
173
|
-
-moz-appearance: none;
|
|
174
|
-
appearance: none;
|
|
172
|
+
appearance: none;
|
|
175
173
|
background: none;
|
|
176
174
|
border: 0;
|
|
177
175
|
text-align: left;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-directory",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.55.0",
|
|
4
4
|
"description": "Extend editor with block directory features to search, download and install blocks.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,34 +41,35 @@
|
|
|
41
41
|
},
|
|
42
42
|
"wpScript": true,
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@wordpress/a11y": "^4.
|
|
45
|
-
"@wordpress/api-fetch": "^7.
|
|
46
|
-
"@wordpress/base-styles": "^13.
|
|
47
|
-
"@wordpress/block-editor": "^17.
|
|
48
|
-
"@wordpress/blocks": "^16.0.
|
|
49
|
-
"@wordpress/components": "^40.1.
|
|
50
|
-
"@wordpress/compose": "^8.
|
|
51
|
-
"@wordpress/core-data": "^
|
|
52
|
-
"@wordpress/data": "^10.
|
|
53
|
-
"@wordpress/editor": "^
|
|
54
|
-
"@wordpress/element": "^8.
|
|
55
|
-
"@wordpress/hooks": "^4.
|
|
56
|
-
"@wordpress/html-entities": "^4.
|
|
57
|
-
"@wordpress/i18n": "^6.
|
|
58
|
-
"@wordpress/icons": "^
|
|
59
|
-
"@wordpress/notices": "^5.
|
|
60
|
-
"@wordpress/plugins": "^7.
|
|
61
|
-
"@wordpress/private-apis": "^1.
|
|
62
|
-
"@wordpress/ui": "^0.22.
|
|
63
|
-
"@wordpress/url": "^4.
|
|
44
|
+
"@wordpress/a11y": "^4.55.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.55.0",
|
|
46
|
+
"@wordpress/base-styles": "^13.1.0",
|
|
47
|
+
"@wordpress/block-editor": "^17.1.0",
|
|
48
|
+
"@wordpress/blocks": "^16.0.0",
|
|
49
|
+
"@wordpress/components": "^40.1.0",
|
|
50
|
+
"@wordpress/compose": "^8.8.0",
|
|
51
|
+
"@wordpress/core-data": "^8.0.0",
|
|
52
|
+
"@wordpress/data": "^10.55.0",
|
|
53
|
+
"@wordpress/editor": "^15.0.0",
|
|
54
|
+
"@wordpress/element": "^8.7.0",
|
|
55
|
+
"@wordpress/hooks": "^4.55.0",
|
|
56
|
+
"@wordpress/html-entities": "^4.55.0",
|
|
57
|
+
"@wordpress/i18n": "^6.28.0",
|
|
58
|
+
"@wordpress/icons": "^16.0.0",
|
|
59
|
+
"@wordpress/notices": "^5.55.0",
|
|
60
|
+
"@wordpress/plugins": "^7.55.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.55.0",
|
|
62
|
+
"@wordpress/ui": "^0.22.0",
|
|
63
|
+
"@wordpress/url": "^4.55.0",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"clsx": "^2.1.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@testing-library/dom": "^10.4.1",
|
|
69
|
-
"@testing-library/react": "^16.3.
|
|
69
|
+
"@testing-library/react": "^16.3.3",
|
|
70
70
|
"@testing-library/user-event": "^14.6.1",
|
|
71
|
-
"deep-freeze": "^0.0.1"
|
|
71
|
+
"deep-freeze": "^0.0.1",
|
|
72
|
+
"vitest": "^5.0.0"
|
|
72
73
|
},
|
|
73
74
|
"peerDependencies": {
|
|
74
75
|
"react": "^18 || ^19",
|
|
@@ -77,5 +78,5 @@
|
|
|
77
78
|
"publishConfig": {
|
|
78
79
|
"access": "public"
|
|
79
80
|
},
|
|
80
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "485f42ae8a1c58ceea18371a507fd4acfa86fbd8"
|
|
81
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`Downloadable Block Icon icon rendering should render a <BlockIcon /> component 1`] = `
|
|
3
|
+
exports[`Downloadable Block Icon > icon rendering > should render a <BlockIcon /> component 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<span
|
|
6
6
|
class="block-editor-block-icon block-directory-downloadable-block-icon has-colors"
|
|
@@ -12,7 +12,7 @@ exports[`Downloadable Block Icon icon rendering should render a <BlockIcon /> co
|
|
|
12
12
|
</div>
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
|
-
exports[`Downloadable Block Icon icon rendering should render an <img> tag 1`] = `
|
|
15
|
+
exports[`Downloadable Block Icon > icon rendering > should render an <img> tag 1`] = `
|
|
16
16
|
<div>
|
|
17
17
|
<img
|
|
18
18
|
alt=""
|
|
@@ -22,7 +22,7 @@ exports[`Downloadable Block Icon icon rendering should render an <img> tag 1`] =
|
|
|
22
22
|
</div>
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
exports[`Downloadable Block Icon icon rendering should render an <img> tag if icon URL has query string 1`] = `
|
|
25
|
+
exports[`Downloadable Block Icon > icon rendering > should render an <img> tag if icon URL has query string 1`] = `
|
|
26
26
|
<div>
|
|
27
27
|
<img
|
|
28
28
|
alt=""
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { Composite } from '@wordpress/components';
|
|
3
5
|
import { useSelect } from '@wordpress/data';
|
|
4
6
|
import DownloadableBlockListItem from '../';
|
|
5
7
|
import { plugin } from '../../test/fixtures';
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
10
|
+
...( await importOriginal() ),
|
|
8
11
|
// This allows us to tweak the returned value on each test.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
useSelect: vi.fn(),
|
|
13
|
+
} ) );
|
|
14
|
+
|
|
15
|
+
function renderItem( props ) {
|
|
16
|
+
return render(
|
|
17
|
+
<Composite>
|
|
18
|
+
<DownloadableBlockListItem { ...props } />
|
|
19
|
+
</Composite>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
describe( 'DownloadableBlockListItem', () => {
|
|
14
24
|
it( 'should render a block item', () => {
|
|
@@ -17,9 +27,7 @@ describe( 'DownloadableBlockListItem', () => {
|
|
|
17
27
|
isInstallable: true,
|
|
18
28
|
} ) );
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
<DownloadableBlockListItem onClick={ jest.fn() } item={ plugin } />
|
|
22
|
-
);
|
|
30
|
+
renderItem( { onClick: vi.fn(), item: plugin } );
|
|
23
31
|
const author = screen.queryByText( `by ${ plugin.author }` );
|
|
24
32
|
const description = screen.queryByText( plugin.description );
|
|
25
33
|
expect( author ).toBeInTheDocument();
|
|
@@ -32,9 +40,7 @@ describe( 'DownloadableBlockListItem', () => {
|
|
|
32
40
|
isInstallable: true,
|
|
33
41
|
} ) );
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
<DownloadableBlockListItem onClick={ jest.fn() } item={ plugin } />
|
|
37
|
-
);
|
|
43
|
+
renderItem( { onClick: vi.fn(), item: plugin } );
|
|
38
44
|
const statusLabel = screen.queryByText( 'Installing…' );
|
|
39
45
|
expect( statusLabel ).toBeInTheDocument();
|
|
40
46
|
} );
|
|
@@ -45,9 +51,7 @@ describe( 'DownloadableBlockListItem', () => {
|
|
|
45
51
|
isInstallable: false,
|
|
46
52
|
} ) );
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
<DownloadableBlockListItem onClick={ jest.fn() } item={ plugin } />
|
|
50
|
-
);
|
|
54
|
+
renderItem( { onClick: vi.fn(), item: plugin } );
|
|
51
55
|
const button = screen.getByRole( 'option' );
|
|
52
56
|
// Keeping it false to avoid focus loss and disable it using aria-disabled.
|
|
53
57
|
expect( button ).toBeEnabled();
|
|
@@ -61,10 +65,8 @@ describe( 'DownloadableBlockListItem', () => {
|
|
|
61
65
|
isInstalling: false,
|
|
62
66
|
isInstallable: true,
|
|
63
67
|
} ) );
|
|
64
|
-
const onClick =
|
|
65
|
-
|
|
66
|
-
<DownloadableBlockListItem onClick={ onClick } item={ plugin } />
|
|
67
|
-
);
|
|
68
|
+
const onClick = vi.fn();
|
|
69
|
+
renderItem( { onClick, item: plugin } );
|
|
68
70
|
|
|
69
71
|
await user.click( screen.getByRole( 'option' ) );
|
|
70
72
|
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import DownloadableBlocksList from '../';
|
|
4
5
|
import { items } from '../../test/fixtures';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
8
|
+
...( await importOriginal() ),
|
|
7
9
|
// This allows us to tweak the returned value on each test.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} );
|
|
11
|
-
|
|
12
|
-
jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( {
|
|
13
|
-
useDispatch: () => ( { installBlockType: jest.fn() } ),
|
|
10
|
+
useSelect: vi.fn(),
|
|
11
|
+
useDispatch: () => ( { installBlockType: vi.fn() } ),
|
|
14
12
|
} ) );
|
|
15
13
|
|
|
16
14
|
describe( 'DownloadableBlocksList', () => {
|
|
17
15
|
describe( 'List rendering', () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
beforeEach( () => {
|
|
17
|
+
useSelect.mockReturnValue( {
|
|
18
|
+
isLoading: false,
|
|
19
|
+
isInstallable: true,
|
|
20
|
+
} );
|
|
21
|
+
} );
|
|
22
22
|
|
|
23
23
|
it( 'should render an empty list', () => {
|
|
24
24
|
const { container } = render(
|
|
25
25
|
<DownloadableBlocksList
|
|
26
26
|
items={ [] }
|
|
27
|
-
onSelect={
|
|
28
|
-
onHover={
|
|
27
|
+
onSelect={ vi.fn() }
|
|
28
|
+
onHover={ vi.fn() }
|
|
29
29
|
/>
|
|
30
30
|
);
|
|
31
31
|
|
|
@@ -36,8 +36,8 @@ describe( 'DownloadableBlocksList', () => {
|
|
|
36
36
|
render(
|
|
37
37
|
<DownloadableBlocksList
|
|
38
38
|
items={ items }
|
|
39
|
-
onSelect={
|
|
40
|
-
onHover={
|
|
39
|
+
onSelect={ vi.fn() }
|
|
40
|
+
onHover={ vi.fn() }
|
|
41
41
|
/>
|
|
42
42
|
);
|
|
43
43
|
const downloadableBlocks = screen.getAllByRole( 'option' );
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { createRegistry } from '@wordpress/data';
|
|
2
3
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
3
4
|
import { store as noticesStore } from '@wordpress/notices';
|
|
@@ -5,13 +6,14 @@ import apiFetch from '@wordpress/api-fetch';
|
|
|
5
6
|
import { loadAssets } from '../load-assets';
|
|
6
7
|
import { store as blockDirectoryStore } from '..';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
default:
|
|
9
|
+
vi.mock( import( '@wordpress/api-fetch' ), async ( importOriginal ) => ( {
|
|
10
|
+
...( await importOriginal() ),
|
|
11
|
+
default: vi.fn(),
|
|
11
12
|
} ) );
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
vi.mock( import( '../load-assets' ), async ( importOriginal ) => ( {
|
|
15
|
+
...( await importOriginal() ),
|
|
16
|
+
loadAssets: vi.fn(),
|
|
15
17
|
} ) );
|
|
16
18
|
|
|
17
19
|
function createRegistryWithStores() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import {
|
|
2
3
|
blockListIds,
|
|
3
4
|
blockListNameMap,
|
|
@@ -88,7 +89,7 @@ describe( 'selectors', () => {
|
|
|
88
89
|
describe( 'getNewBlockTypes', () => {
|
|
89
90
|
it( 'should retrieve the block types that are installed and in the post content', () => {
|
|
90
91
|
getNewBlockTypes.registry = {
|
|
91
|
-
select:
|
|
92
|
+
select: vi.fn( () => ( {
|
|
92
93
|
getBlockName: ( clientId ) => blockListNameMap[ clientId ],
|
|
93
94
|
getClientIdsWithDescendants: () => blockListIds,
|
|
94
95
|
} ) ),
|
|
@@ -108,7 +109,7 @@ describe( 'selectors', () => {
|
|
|
108
109
|
|
|
109
110
|
it( 'should return an empty array if no blocks are used', () => {
|
|
110
111
|
getNewBlockTypes.registry = {
|
|
111
|
-
select:
|
|
112
|
+
select: vi.fn( () => ( {
|
|
112
113
|
getBlockName: ( clientId ) => blockListNameMap[ clientId ],
|
|
113
114
|
getClientIdsWithDescendants: () => [],
|
|
114
115
|
} ) ),
|
|
@@ -129,7 +130,7 @@ describe( 'selectors', () => {
|
|
|
129
130
|
describe( 'getUnusedBlockTypes', () => {
|
|
130
131
|
it( 'should retrieve the block types that are installed but not used', () => {
|
|
131
132
|
getUnusedBlockTypes.registry = {
|
|
132
|
-
select:
|
|
133
|
+
select: vi.fn( () => ( {
|
|
133
134
|
getBlockName: ( clientId ) => blockListNameMap[ clientId ],
|
|
134
135
|
getClientIdsWithDescendants: () => blockListIds,
|
|
135
136
|
} ) ),
|
|
@@ -149,7 +150,7 @@ describe( 'selectors', () => {
|
|
|
149
150
|
|
|
150
151
|
it( 'should return all block types if no blocks are used', () => {
|
|
151
152
|
getUnusedBlockTypes.registry = {
|
|
152
|
-
select:
|
|
153
|
+
select: vi.fn( () => ( {
|
|
153
154
|
getBlockName: ( clientId ) => blockListNameMap[ clientId ],
|
|
154
155
|
getClientIdsWithDescendants: () => [],
|
|
155
156
|
} ) ),
|