@wordpress/block-directory 5.55.0 → 5.55.1-next.v.202609171837.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/README.md +41 -41
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +22 -22
- package/src/components/downloadable-block-list-item/style.scss +1 -1
- package/src/components/downloadable-block-list-item/test/index.jsdom.test.jsx +9 -6
- package/src/components/downloadable-blocks-list/test/index.jsdom.test.jsx +7 -5
package/README.md
CHANGED
|
@@ -34,11 +34,11 @@ Returns an action object used to add a block type to the "newly installed" track
|
|
|
34
34
|
|
|
35
35
|
_Parameters_
|
|
36
36
|
|
|
37
|
-
-
|
|
37
|
+
- _item_ `Object`: The block item with the block id and name.
|
|
38
38
|
|
|
39
39
|
_Returns_
|
|
40
40
|
|
|
41
|
-
-
|
|
41
|
+
- `Object`: Action object.
|
|
42
42
|
|
|
43
43
|
### clearErrorNotice
|
|
44
44
|
|
|
@@ -46,11 +46,11 @@ Sets the error notice to empty for specific block.
|
|
|
46
46
|
|
|
47
47
|
_Parameters_
|
|
48
48
|
|
|
49
|
-
-
|
|
49
|
+
- _blockId_ `string`: The ID of the block plugin. eg: my-block
|
|
50
50
|
|
|
51
51
|
_Returns_
|
|
52
52
|
|
|
53
|
-
-
|
|
53
|
+
- `Object`: Action object.
|
|
54
54
|
|
|
55
55
|
### fetchDownloadableBlocks
|
|
56
56
|
|
|
@@ -58,11 +58,11 @@ Returns an action object used in signalling that the downloadable blocks have be
|
|
|
58
58
|
|
|
59
59
|
_Parameters_
|
|
60
60
|
|
|
61
|
-
-
|
|
61
|
+
- _filterValue_ `string`: Search string.
|
|
62
62
|
|
|
63
63
|
_Returns_
|
|
64
64
|
|
|
65
|
-
-
|
|
65
|
+
- `Object`: Action object.
|
|
66
66
|
|
|
67
67
|
### installBlockType
|
|
68
68
|
|
|
@@ -70,11 +70,11 @@ Action triggered to install a block plugin.
|
|
|
70
70
|
|
|
71
71
|
_Parameters_
|
|
72
72
|
|
|
73
|
-
-
|
|
73
|
+
- _block_ `Object`: The block item returned by search.
|
|
74
74
|
|
|
75
75
|
_Returns_
|
|
76
76
|
|
|
77
|
-
-
|
|
77
|
+
- `boolean`: Whether the block was successfully installed & loaded.
|
|
78
78
|
|
|
79
79
|
### receiveDownloadableBlocks
|
|
80
80
|
|
|
@@ -82,12 +82,12 @@ Returns an action object used in signalling that the downloadable blocks have be
|
|
|
82
82
|
|
|
83
83
|
_Parameters_
|
|
84
84
|
|
|
85
|
-
-
|
|
86
|
-
-
|
|
85
|
+
- _downloadableBlocks_ `Array`: Downloadable blocks.
|
|
86
|
+
- _filterValue_ `string`: Search string.
|
|
87
87
|
|
|
88
88
|
_Returns_
|
|
89
89
|
|
|
90
|
-
-
|
|
90
|
+
- `Object`: Action object.
|
|
91
91
|
|
|
92
92
|
### removeInstalledBlockType
|
|
93
93
|
|
|
@@ -95,11 +95,11 @@ Returns an action object used to remove a block type from the "newly installed"
|
|
|
95
95
|
|
|
96
96
|
_Parameters_
|
|
97
97
|
|
|
98
|
-
-
|
|
98
|
+
- _item_ `string`: The block item with the block id and name.
|
|
99
99
|
|
|
100
100
|
_Returns_
|
|
101
101
|
|
|
102
|
-
-
|
|
102
|
+
- `Object`: Action object.
|
|
103
103
|
|
|
104
104
|
### setErrorNotice
|
|
105
105
|
|
|
@@ -107,13 +107,13 @@ Sets an error notice to be displayed to the user for a given block.
|
|
|
107
107
|
|
|
108
108
|
_Parameters_
|
|
109
109
|
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
110
|
+
- _blockId_ `string`: The ID of the block plugin. eg: my-block
|
|
111
|
+
- _message_ `string`: The message shown in the notice.
|
|
112
|
+
- _isFatal_ `boolean`: Whether the user can recover from the error.
|
|
113
113
|
|
|
114
114
|
_Returns_
|
|
115
115
|
|
|
116
|
-
-
|
|
116
|
+
- `Object`: Action object.
|
|
117
117
|
|
|
118
118
|
### setIsInstalling
|
|
119
119
|
|
|
@@ -121,12 +121,12 @@ Returns an action object used to indicate install in progress.
|
|
|
121
121
|
|
|
122
122
|
_Parameters_
|
|
123
123
|
|
|
124
|
-
-
|
|
125
|
-
-
|
|
124
|
+
- _blockId_ `string`:
|
|
125
|
+
- _isInstalling_ `boolean`:
|
|
126
126
|
|
|
127
127
|
_Returns_
|
|
128
128
|
|
|
129
|
-
-
|
|
129
|
+
- `Object`: Action object.
|
|
130
130
|
|
|
131
131
|
### uninstallBlockType
|
|
132
132
|
|
|
@@ -134,7 +134,7 @@ Action triggered to uninstall a block plugin.
|
|
|
134
134
|
|
|
135
135
|
_Parameters_
|
|
136
136
|
|
|
137
|
-
-
|
|
137
|
+
- _block_ `Object`: The blockType object.
|
|
138
138
|
|
|
139
139
|
<!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
|
|
140
140
|
|
|
@@ -150,12 +150,12 @@ Returns the available uninstalled blocks.
|
|
|
150
150
|
|
|
151
151
|
_Parameters_
|
|
152
152
|
|
|
153
|
-
-
|
|
154
|
-
-
|
|
153
|
+
- _state_ `Object`: Global application state.
|
|
154
|
+
- _filterValue_ `string`: Search string.
|
|
155
155
|
|
|
156
156
|
_Returns_
|
|
157
157
|
|
|
158
|
-
-
|
|
158
|
+
- `Array`: Downloadable blocks.
|
|
159
159
|
|
|
160
160
|
### getErrorNoticeForBlock
|
|
161
161
|
|
|
@@ -163,12 +163,12 @@ Returns the error notice for a given block.
|
|
|
163
163
|
|
|
164
164
|
_Parameters_
|
|
165
165
|
|
|
166
|
-
-
|
|
167
|
-
-
|
|
166
|
+
- _state_ `Object`: Global application state.
|
|
167
|
+
- _blockId_ `string`: The ID of the block plugin. eg: my-block
|
|
168
168
|
|
|
169
169
|
_Returns_
|
|
170
170
|
|
|
171
|
-
-
|
|
171
|
+
- `string|boolean`: The error text, or false if no error.
|
|
172
172
|
|
|
173
173
|
### getErrorNotices
|
|
174
174
|
|
|
@@ -176,11 +176,11 @@ Returns all block error notices.
|
|
|
176
176
|
|
|
177
177
|
_Parameters_
|
|
178
178
|
|
|
179
|
-
-
|
|
179
|
+
- _state_ `Object`: Global application state.
|
|
180
180
|
|
|
181
181
|
_Returns_
|
|
182
182
|
|
|
183
|
-
-
|
|
183
|
+
- `Object`: Object with error notices.
|
|
184
184
|
|
|
185
185
|
### getInstalledBlockTypes
|
|
186
186
|
|
|
@@ -188,11 +188,11 @@ Returns the block types that have been installed on the server in this session.
|
|
|
188
188
|
|
|
189
189
|
_Parameters_
|
|
190
190
|
|
|
191
|
-
-
|
|
191
|
+
- _state_ `Object`: Global application state.
|
|
192
192
|
|
|
193
193
|
_Returns_
|
|
194
194
|
|
|
195
|
-
-
|
|
195
|
+
- `Array`: Block type items
|
|
196
196
|
|
|
197
197
|
### getNewBlockTypes
|
|
198
198
|
|
|
@@ -200,11 +200,11 @@ Returns block types that have been installed on the server and used in the curre
|
|
|
200
200
|
|
|
201
201
|
_Parameters_
|
|
202
202
|
|
|
203
|
-
-
|
|
203
|
+
- _state_ `Object`: Global application state.
|
|
204
204
|
|
|
205
205
|
_Returns_
|
|
206
206
|
|
|
207
|
-
-
|
|
207
|
+
- `Array`: Block type items.
|
|
208
208
|
|
|
209
209
|
### getUnusedBlockTypes
|
|
210
210
|
|
|
@@ -212,11 +212,11 @@ Returns the block types that have been installed on the server but are not used
|
|
|
212
212
|
|
|
213
213
|
_Parameters_
|
|
214
214
|
|
|
215
|
-
-
|
|
215
|
+
- _state_ `Object`: Global application state.
|
|
216
216
|
|
|
217
217
|
_Returns_
|
|
218
218
|
|
|
219
|
-
-
|
|
219
|
+
- `Array`: Block type items.
|
|
220
220
|
|
|
221
221
|
### isInstalling
|
|
222
222
|
|
|
@@ -224,12 +224,12 @@ Returns true if a block plugin install is in progress.
|
|
|
224
224
|
|
|
225
225
|
_Parameters_
|
|
226
226
|
|
|
227
|
-
-
|
|
228
|
-
-
|
|
227
|
+
- _state_ `Object`: Global application state.
|
|
228
|
+
- _blockId_ `string`: Id of the block.
|
|
229
229
|
|
|
230
230
|
_Returns_
|
|
231
231
|
|
|
232
|
-
-
|
|
232
|
+
- `boolean`: Whether this block is currently being installed.
|
|
233
233
|
|
|
234
234
|
### isRequestingDownloadableBlocks
|
|
235
235
|
|
|
@@ -237,12 +237,12 @@ Returns true if application is requesting for downloadable blocks.
|
|
|
237
237
|
|
|
238
238
|
_Parameters_
|
|
239
239
|
|
|
240
|
-
-
|
|
241
|
-
-
|
|
240
|
+
- _state_ `Object`: Global application state.
|
|
241
|
+
- _filterValue_ `string`: Search string.
|
|
242
242
|
|
|
243
243
|
_Returns_
|
|
244
244
|
|
|
245
|
-
-
|
|
245
|
+
- `boolean`: Whether a request is in progress for the blocks list.
|
|
246
246
|
|
|
247
247
|
<!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
|
|
248
248
|
|
package/build-style/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-directory",
|
|
3
|
-
"version": "5.55.0",
|
|
3
|
+
"version": "5.55.1-next.v.202609171837.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,26 +41,26 @@
|
|
|
41
41
|
},
|
|
42
42
|
"wpScript": true,
|
|
43
43
|
"dependencies": {
|
|
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.
|
|
49
|
-
"@wordpress/components": "^
|
|
50
|
-
"@wordpress/compose": "^8.8.0",
|
|
51
|
-
"@wordpress/core-data": "^8.0.0",
|
|
52
|
-
"@wordpress/data": "^10.
|
|
53
|
-
"@wordpress/editor": "^15.
|
|
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": "^
|
|
59
|
-
"@wordpress/notices": "^5.55.0",
|
|
60
|
-
"@wordpress/plugins": "^7.55.0",
|
|
61
|
-
"@wordpress/private-apis": "^1.55.0",
|
|
62
|
-
"@wordpress/ui": "^0.
|
|
63
|
-
"@wordpress/url": "^4.55.0",
|
|
44
|
+
"@wordpress/a11y": "^4.55.1-next.v.202609171837.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.55.1-next.v.202609171837.0",
|
|
46
|
+
"@wordpress/base-styles": "^13.2.1-next.v.202609171837.0",
|
|
47
|
+
"@wordpress/block-editor": "^17.2.1-next.v.202609171837.0",
|
|
48
|
+
"@wordpress/blocks": "^16.1.1-next.v.202609171837.0",
|
|
49
|
+
"@wordpress/components": "^41.0.1-next.v.202609171837.0",
|
|
50
|
+
"@wordpress/compose": "^8.8.2-next.v.202609171837.0",
|
|
51
|
+
"@wordpress/core-data": "^8.0.2-next.v.202609171837.0",
|
|
52
|
+
"@wordpress/data": "^10.56.1-next.v.202609171837.0",
|
|
53
|
+
"@wordpress/editor": "^15.1.1-next.v.202609171837.0",
|
|
54
|
+
"@wordpress/element": "^8.7.1-next.v.202609171837.0",
|
|
55
|
+
"@wordpress/hooks": "^4.55.1-next.v.202609171837.0",
|
|
56
|
+
"@wordpress/html-entities": "^4.55.1-next.v.202609171837.0",
|
|
57
|
+
"@wordpress/i18n": "^6.28.1-next.v.202609171837.0",
|
|
58
|
+
"@wordpress/icons": "^17.0.1-next.v.202609171837.0",
|
|
59
|
+
"@wordpress/notices": "^5.55.1-next.v.202609171837.0",
|
|
60
|
+
"@wordpress/plugins": "^7.55.1-next.v.202609171837.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.55.1-next.v.202609171837.0",
|
|
62
|
+
"@wordpress/ui": "^0.23.1-next.v.202609171837.0",
|
|
63
|
+
"@wordpress/url": "^4.55.1-next.v.202609171837.0",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"clsx": "^2.1.1"
|
|
66
66
|
},
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "7fc9f6676debc888d2f071d17cb71837040d4b48"
|
|
82
82
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
4
|
import { Composite } from '@wordpress/components';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
@@ -21,38 +21,41 @@ function renderItem( props ) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
describe( 'DownloadableBlockListItem', () => {
|
|
24
|
-
it( 'should render a block item', () => {
|
|
24
|
+
it( 'should render a block item', async () => {
|
|
25
25
|
useSelect.mockImplementation( () => ( {
|
|
26
26
|
isInstalling: false,
|
|
27
27
|
isInstallable: true,
|
|
28
28
|
} ) );
|
|
29
29
|
|
|
30
30
|
renderItem( { onClick: vi.fn(), item: plugin } );
|
|
31
|
+
await waitFor( () =>
|
|
32
|
+
expect( screen.getByRole( 'option' ) ).toBeVisible()
|
|
33
|
+
);
|
|
31
34
|
const author = screen.queryByText( `by ${ plugin.author }` );
|
|
32
35
|
const description = screen.queryByText( plugin.description );
|
|
33
36
|
expect( author ).toBeInTheDocument();
|
|
34
37
|
expect( description ).toBeInTheDocument();
|
|
35
38
|
} );
|
|
36
39
|
|
|
37
|
-
it( 'should show installing status when installing the block', () => {
|
|
40
|
+
it( 'should show installing status when installing the block', async () => {
|
|
38
41
|
useSelect.mockImplementation( () => ( {
|
|
39
42
|
isInstalling: true,
|
|
40
43
|
isInstallable: true,
|
|
41
44
|
} ) );
|
|
42
45
|
|
|
43
46
|
renderItem( { onClick: vi.fn(), item: plugin } );
|
|
44
|
-
const statusLabel = screen.
|
|
47
|
+
const statusLabel = await screen.findByText( 'Installing…' );
|
|
45
48
|
expect( statusLabel ).toBeInTheDocument();
|
|
46
49
|
} );
|
|
47
50
|
|
|
48
|
-
it( "should be disabled when a plugin can't be installed", () => {
|
|
51
|
+
it( "should be disabled when a plugin can't be installed", async () => {
|
|
49
52
|
useSelect.mockImplementation( () => ( {
|
|
50
53
|
isInstalling: false,
|
|
51
54
|
isInstallable: false,
|
|
52
55
|
} ) );
|
|
53
56
|
|
|
54
57
|
renderItem( { onClick: vi.fn(), item: plugin } );
|
|
55
|
-
const button = screen.
|
|
58
|
+
const button = await screen.findByRole( 'option' );
|
|
56
59
|
// Keeping it false to avoid focus loss and disable it using aria-disabled.
|
|
57
60
|
expect( button ).toBeEnabled();
|
|
58
61
|
expect( button ).toHaveAttribute( 'aria-disabled', 'true' );
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
3
|
import { useSelect } from '@wordpress/data';
|
|
4
4
|
import DownloadableBlocksList from '../';
|
|
@@ -32,7 +32,7 @@ describe( 'DownloadableBlocksList', () => {
|
|
|
32
32
|
expect( container ).toBeEmptyDOMElement();
|
|
33
33
|
} );
|
|
34
34
|
|
|
35
|
-
it( 'should render plugins items into the list', () => {
|
|
35
|
+
it( 'should render plugins items into the list', async () => {
|
|
36
36
|
render(
|
|
37
37
|
<DownloadableBlocksList
|
|
38
38
|
items={ items }
|
|
@@ -40,9 +40,11 @@ describe( 'DownloadableBlocksList', () => {
|
|
|
40
40
|
onHover={ vi.fn() }
|
|
41
41
|
/>
|
|
42
42
|
);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
await waitFor( () =>
|
|
44
|
+
expect( screen.getAllByRole( 'option' ) ).toHaveLength(
|
|
45
|
+
items.length
|
|
46
|
+
)
|
|
47
|
+
);
|
|
46
48
|
} );
|
|
47
49
|
} );
|
|
48
50
|
} );
|