@wordpress/block-editor 12.4.0 → 12.5.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/README.md +5 -0
- package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-lock/toolbar.js +25 -6
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -6
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +8 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +18 -25
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +8 -5
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +7 -11
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build/components/dimensions-tool/index.js +207 -0
- package/build/components/dimensions-tool/index.js.map +1 -0
- package/build/components/dimensions-tool/scale-tool.js +111 -0
- package/build/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build/components/dimensions-tool/width-height-tool.js +125 -0
- package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +1 -1
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +34 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +1 -2
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-size-control/index.js +6 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +19 -1
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +7 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +9 -3
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +2 -21
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +62 -0
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build/components/inserter/reusable-blocks-tab.js +6 -2
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +9 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/link-control/constants.js +1 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/index.js +17 -15
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-create-button.js +5 -21
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -4
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-item.js +13 -30
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +2 -3
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/list-view/appender.js +2 -6
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/provider/index.js +5 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +21 -0
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/resolution-tool/index.js +55 -0
- package/build/components/resolution-tool/index.js.map +1 -0
- package/build/components/url-input/index.js +4 -2
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -27
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +70 -0
- package/build/components/writing-mode-control/index.js.map +1 -0
- package/build/hooks/behaviors.js +25 -20
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +4 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +10 -1
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -0
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +195 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -0
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +10 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +46 -40
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +22 -8
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +33 -15
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +25 -7
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +4 -6
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +7 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +20 -24
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -5
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/index.js +195 -0
- package/build-module/components/dimensions-tool/index.js.map +1 -0
- package/build-module/components/dimensions-tool/scale-tool.js +103 -0
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
- package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
- package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +2 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +33 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +1 -2
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-size-control/index.js +5 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +6 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +7 -33
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +2 -21
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +9 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/link-control/constants.js +1 -1
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/index.js +17 -15
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +7 -20
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -4
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-item.js +14 -28
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +4 -5
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -6
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/provider/index.js +5 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +21 -0
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/resolution-tool/index.js +45 -0
- package/build-module/components/resolution-tool/index.js.map +1 -0
- package/build-module/components/url-input/index.js +4 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +8 -26
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +57 -0
- package/build-module/components/writing-mode-control/index.js.map +1 -0
- package/build-module/hooks/behaviors.js +26 -20
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +4 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +7 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +2 -0
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +191 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -0
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js +10 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +45 -36
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +33 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +3 -0
- package/build-style/content.css +3 -0
- package/build-style/style-rtl.css +131 -129
- package/build-style/style.css +131 -129
- package/package.json +32 -31
- package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
- package/src/components/block-draggable/style.scss +1 -0
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
- package/src/components/block-heading-level-dropdown/index.native.js +8 -4
- package/src/components/block-inspector/style.scss +2 -1
- package/src/components/block-lock/toolbar.js +34 -6
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +4 -8
- package/src/components/block-parent-selector/index.js +13 -8
- package/src/components/block-removal-warning-modal/index.js +20 -33
- package/src/components/block-toolbar/index.js +9 -6
- package/src/components/block-tools/block-contextual-toolbar.js +5 -11
- package/src/components/block-tools/style.scss +73 -26
- package/src/components/default-block-appender/content.scss +11 -0
- package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
- package/src/components/dimensions-tool/index.js +212 -0
- package/src/components/dimensions-tool/scale-tool.js +124 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
- package/src/components/dimensions-tool/stories/index.js +54 -0
- package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
- package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
- package/src/components/dimensions-tool/test/index.js +641 -0
- package/src/components/dimensions-tool/width-height-tool.js +113 -0
- package/src/components/font-family/README.md +71 -0
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/filters-panel.js +2 -2
- package/src/components/global-styles/hooks.js +2 -0
- package/src/components/global-styles/typography-panel.js +40 -0
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/image-editor/use-save-image.js +0 -1
- package/src/components/image-size-control/index.js +6 -0
- package/src/components/index.js +6 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
- package/src/components/inserter/block-patterns-tab.js +8 -56
- package/src/components/inserter/hooks/use-block-types-state.js +3 -4
- package/src/components/inserter/hooks/use-patterns-state.js +35 -19
- package/src/components/inserter/media-tab/hooks.js +2 -22
- package/src/components/inserter/reusable-block-rename-hint.js +52 -0
- package/src/components/inserter/reusable-blocks-tab.js +5 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/src/components/inserter/style.scss +28 -0
- package/src/components/inserter/tabs.native.js +5 -1
- package/src/components/inserter-draggable-blocks/index.js +13 -2
- package/src/components/link-control/constants.js +1 -1
- package/src/components/link-control/index.js +32 -28
- package/src/components/link-control/search-create-button.js +8 -26
- package/src/components/link-control/search-input.js +4 -3
- package/src/components/link-control/search-item.js +21 -43
- package/src/components/link-control/search-results.js +48 -46
- package/src/components/link-control/settings-drawer.js +6 -5
- package/src/components/link-control/style.scss +51 -123
- package/src/components/link-control/test/index.js +135 -123
- package/src/components/list-view/appender.js +5 -6
- package/src/components/list-view/style.scss +1 -2
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/panel-color-settings/README.md +98 -0
- package/src/components/provider/index.js +9 -2
- package/src/components/provider/test/use-block-sync.js +21 -6
- package/src/components/provider/use-block-sync.js +19 -0
- package/src/components/recursion-provider/README.md +101 -0
- package/src/components/resolution-tool/index.js +56 -0
- package/src/components/resolution-tool/stories/index.js +48 -0
- package/src/components/url-input/index.js +2 -0
- package/src/components/writing-flow/use-tab-nav.js +10 -33
- package/src/components/writing-mode-control/index.js +68 -0
- package/src/components/writing-mode-control/style.scss +18 -0
- package/src/hooks/behaviors.js +25 -16
- package/src/hooks/supports.js +7 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/utils.js +3 -0
- package/src/private-apis.js +6 -0
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +194 -1
- package/src/store/defaults.js +1 -0
- package/src/store/index.js +10 -0
- package/src/store/private-actions.js +39 -39
- package/src/store/private-selectors.js +2 -2
- package/src/store/reducer.js +22 -8
- package/src/store/selectors.js +54 -20
- package/src/store/test/actions.js +111 -0
- package/src/store/test/private-actions.js +56 -0
|
@@ -138,7 +138,7 @@ describe( 'Basic rendering', () => {
|
|
|
138
138
|
render( <LinkControl /> );
|
|
139
139
|
|
|
140
140
|
// Search Input UI.
|
|
141
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
141
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
142
142
|
|
|
143
143
|
expect( searchInput ).toBeVisible();
|
|
144
144
|
} );
|
|
@@ -147,7 +147,7 @@ describe( 'Basic rendering', () => {
|
|
|
147
147
|
render( <LinkControl /> );
|
|
148
148
|
|
|
149
149
|
// Search Input UI.
|
|
150
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
150
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
151
151
|
|
|
152
152
|
expect( searchInput ).toBeVisible();
|
|
153
153
|
// Make sure we use the ARIA 1.0 pattern with aria-owns.
|
|
@@ -170,7 +170,7 @@ describe( 'Basic rendering', () => {
|
|
|
170
170
|
render( <LinkControl /> );
|
|
171
171
|
|
|
172
172
|
// Search Input UI.
|
|
173
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
173
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
174
174
|
|
|
175
175
|
// Simulate searching for a term.
|
|
176
176
|
await user.type( searchInput, 'Hello' );
|
|
@@ -283,7 +283,7 @@ describe( 'Basic rendering', () => {
|
|
|
283
283
|
render( <LinkControl /> );
|
|
284
284
|
|
|
285
285
|
// Search Input UI.
|
|
286
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
286
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
287
287
|
|
|
288
288
|
// Simulate searching for a term.
|
|
289
289
|
await user.type( searchInput, searchTerm );
|
|
@@ -296,7 +296,7 @@ describe( 'Basic rendering', () => {
|
|
|
296
296
|
render( <LinkControl value={ { url: 'https://example.com' } } /> );
|
|
297
297
|
|
|
298
298
|
expect(
|
|
299
|
-
screen.queryByRole( 'combobox', { name: '
|
|
299
|
+
screen.queryByRole( 'combobox', { name: 'Link' } )
|
|
300
300
|
).not.toBeInTheDocument();
|
|
301
301
|
} );
|
|
302
302
|
|
|
@@ -309,7 +309,7 @@ describe( 'Basic rendering', () => {
|
|
|
309
309
|
);
|
|
310
310
|
|
|
311
311
|
expect(
|
|
312
|
-
screen.getByRole( 'combobox', { name: '
|
|
312
|
+
screen.getByRole( 'combobox', { name: 'Link' } )
|
|
313
313
|
).toBeVisible();
|
|
314
314
|
} );
|
|
315
315
|
|
|
@@ -327,7 +327,7 @@ describe( 'Basic rendering', () => {
|
|
|
327
327
|
await user.click( editButton );
|
|
328
328
|
|
|
329
329
|
expect(
|
|
330
|
-
screen.getByRole( 'combobox', { name: '
|
|
330
|
+
screen.getByRole( 'combobox', { name: 'Link' } )
|
|
331
331
|
).toBeVisible();
|
|
332
332
|
|
|
333
333
|
// If passed `forceIsEditingLink` of `false` while editing, should
|
|
@@ -340,7 +340,7 @@ describe( 'Basic rendering', () => {
|
|
|
340
340
|
);
|
|
341
341
|
|
|
342
342
|
expect(
|
|
343
|
-
screen.queryByRole( 'combobox', { name: '
|
|
343
|
+
screen.queryByRole( 'combobox', { name: 'Link' } )
|
|
344
344
|
).not.toBeInTheDocument();
|
|
345
345
|
} );
|
|
346
346
|
|
|
@@ -424,7 +424,7 @@ describe( 'Searching for a link', () => {
|
|
|
424
424
|
render( <LinkControl /> );
|
|
425
425
|
|
|
426
426
|
// Search Input UI.
|
|
427
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
427
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
428
428
|
|
|
429
429
|
// Simulate searching for a term.
|
|
430
430
|
await user.type( searchInput, searchTerm );
|
|
@@ -448,7 +448,9 @@ describe( 'Searching for a link', () => {
|
|
|
448
448
|
render( <LinkControl /> );
|
|
449
449
|
|
|
450
450
|
// Search Input UI.
|
|
451
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
451
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
452
|
+
name: 'Link',
|
|
453
|
+
} );
|
|
452
454
|
|
|
453
455
|
// Simulate searching for a term.
|
|
454
456
|
await user.type( searchInput, searchTerm );
|
|
@@ -476,16 +478,16 @@ describe( 'Searching for a link', () => {
|
|
|
476
478
|
// The fallback URL suggestion should not be shown when input is not URL-like.
|
|
477
479
|
expect(
|
|
478
480
|
searchResultElements[ searchResultElements.length - 1 ]
|
|
479
|
-
).not.toHaveTextContent( '
|
|
481
|
+
).not.toHaveTextContent( 'Press ENTER to add this link' );
|
|
480
482
|
}
|
|
481
483
|
);
|
|
482
484
|
|
|
483
485
|
it.each( [
|
|
484
|
-
[ 'https://wordpress.org', '
|
|
485
|
-
[ 'http://wordpress.org', '
|
|
486
|
-
[ 'www.wordpress.org', '
|
|
487
|
-
[ 'wordpress.org', '
|
|
488
|
-
[ 'ftp://wordpress.org', '
|
|
486
|
+
[ 'https://wordpress.org', 'link' ],
|
|
487
|
+
[ 'http://wordpress.org', 'link' ],
|
|
488
|
+
[ 'www.wordpress.org', 'link' ],
|
|
489
|
+
[ 'wordpress.org', 'link' ],
|
|
490
|
+
[ 'ftp://wordpress.org', 'link' ],
|
|
489
491
|
[ 'mailto:hello@wordpress.org', 'mailto' ],
|
|
490
492
|
[ 'tel:123456789', 'tel' ],
|
|
491
493
|
[ '#internal', 'internal' ],
|
|
@@ -497,7 +499,9 @@ describe( 'Searching for a link', () => {
|
|
|
497
499
|
render( <LinkControl /> );
|
|
498
500
|
|
|
499
501
|
// Search Input UI.
|
|
500
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
502
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
503
|
+
name: 'Link',
|
|
504
|
+
} );
|
|
501
505
|
|
|
502
506
|
// Simulate searching for a term.
|
|
503
507
|
await user.type( searchInput, searchTerm );
|
|
@@ -528,7 +532,7 @@ describe( 'Searching for a link', () => {
|
|
|
528
532
|
render( <LinkControl /> );
|
|
529
533
|
|
|
530
534
|
// Search Input UI.
|
|
531
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
535
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
532
536
|
|
|
533
537
|
// Simulate searching for a term.
|
|
534
538
|
await user.type( searchInput, searchTerm );
|
|
@@ -571,7 +575,7 @@ describe( 'Searching for a link', () => {
|
|
|
571
575
|
render( <LinkControl showSuggestions={ false } /> );
|
|
572
576
|
|
|
573
577
|
// Search Input UI.
|
|
574
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
578
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
575
579
|
|
|
576
580
|
// Simulate searching for a term.
|
|
577
581
|
await user.type( searchInput, 'anything' );
|
|
@@ -582,12 +586,43 @@ describe( 'Searching for a link', () => {
|
|
|
582
586
|
expect( mockFetchSearchSuggestions ).not.toHaveBeenCalled();
|
|
583
587
|
} );
|
|
584
588
|
|
|
589
|
+
it( 'should not display a URL suggestion when input is not likely to be a URL.', async () => {
|
|
590
|
+
const searchTerm = 'unlikelytobeaURL';
|
|
591
|
+
const user = userEvent.setup();
|
|
592
|
+
render( <LinkControl /> );
|
|
593
|
+
|
|
594
|
+
// Search Input UI.
|
|
595
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
596
|
+
|
|
597
|
+
// Simulate searching for a term.
|
|
598
|
+
await user.type( searchInput, searchTerm );
|
|
599
|
+
|
|
600
|
+
const searchResultElements = within(
|
|
601
|
+
await screen.findByRole( 'listbox', {
|
|
602
|
+
name: /Search results for.*/,
|
|
603
|
+
} )
|
|
604
|
+
).getAllByRole( 'option' );
|
|
605
|
+
|
|
606
|
+
const lastSearchResultItem =
|
|
607
|
+
searchResultElements[ searchResultElements.length - 1 ];
|
|
608
|
+
|
|
609
|
+
// We should see a search result for each of the expect search suggestions.
|
|
610
|
+
expect( searchResultElements ).toHaveLength(
|
|
611
|
+
fauxEntitySuggestions.length
|
|
612
|
+
);
|
|
613
|
+
|
|
614
|
+
// The URL search suggestion should not exist.
|
|
615
|
+
expect( lastSearchResultItem ).not.toHaveTextContent(
|
|
616
|
+
'Press ENTER to add this link'
|
|
617
|
+
);
|
|
618
|
+
} );
|
|
619
|
+
|
|
585
620
|
it( 'should not display a URL suggestion as a default fallback when noURLSuggestion is passed.', async () => {
|
|
586
621
|
const user = userEvent.setup();
|
|
587
622
|
render( <LinkControl noURLSuggestion /> );
|
|
588
623
|
|
|
589
624
|
// Search Input UI.
|
|
590
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
625
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
591
626
|
|
|
592
627
|
// Simulate searching for a term.
|
|
593
628
|
await user.type( searchInput, 'couldbeurlorentitysearchterm' );
|
|
@@ -617,7 +652,9 @@ describe( 'Manual link entry', () => {
|
|
|
617
652
|
render( <LinkControl /> );
|
|
618
653
|
|
|
619
654
|
// Search Input UI.
|
|
620
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
655
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
656
|
+
name: 'Link',
|
|
657
|
+
} );
|
|
621
658
|
|
|
622
659
|
// Simulate searching for a term.
|
|
623
660
|
await user.type( searchInput, searchTerm );
|
|
@@ -630,7 +667,6 @@ describe( 'Manual link entry', () => {
|
|
|
630
667
|
|
|
631
668
|
expect( searchResultElements ).toBeVisible();
|
|
632
669
|
expect( searchResultElements ).toHaveTextContent( searchTerm );
|
|
633
|
-
expect( searchResultElements ).toHaveTextContent( 'URL' );
|
|
634
670
|
expect( searchResultElements ).toHaveTextContent(
|
|
635
671
|
'Press ENTER to add this link'
|
|
636
672
|
);
|
|
@@ -653,19 +689,9 @@ describe( 'Manual link entry', () => {
|
|
|
653
689
|
|
|
654
690
|
// Search Input UI.
|
|
655
691
|
const searchInput = screen.getByRole( 'combobox', {
|
|
656
|
-
name: '
|
|
657
|
-
} );
|
|
658
|
-
|
|
659
|
-
let submitButton = screen.getByRole( 'button', {
|
|
660
|
-
name: 'Save',
|
|
692
|
+
name: 'Link',
|
|
661
693
|
} );
|
|
662
694
|
|
|
663
|
-
expect( submitButton ).toHaveAttribute(
|
|
664
|
-
'aria-disabled',
|
|
665
|
-
'true'
|
|
666
|
-
);
|
|
667
|
-
expect( submitButton ).toBeVisible();
|
|
668
|
-
|
|
669
695
|
if ( searchString.length ) {
|
|
670
696
|
// Simulate searching for a term.
|
|
671
697
|
await user.type( searchInput, searchString );
|
|
@@ -677,102 +703,74 @@ describe( 'Manual link entry', () => {
|
|
|
677
703
|
// Attempt to submit the empty search value in the input.
|
|
678
704
|
await user.keyboard( '[Enter]' );
|
|
679
705
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
} );
|
|
683
|
-
|
|
684
|
-
// Verify the UI hasn't allowed submission.
|
|
706
|
+
// Verify the UI hasn't allowed submission because
|
|
707
|
+
// the search input is still visible.
|
|
685
708
|
expect( searchInput ).toBeVisible();
|
|
686
|
-
expect( submitButton ).toHaveAttribute(
|
|
687
|
-
'aria-disabled',
|
|
688
|
-
'true'
|
|
689
|
-
);
|
|
690
|
-
expect( submitButton ).toBeVisible();
|
|
691
709
|
}
|
|
692
710
|
);
|
|
693
711
|
|
|
694
712
|
it.each( testTable )(
|
|
695
|
-
'should not allow
|
|
713
|
+
'should not allow editing of links to a new link %s via the UI "submit" button',
|
|
696
714
|
async ( _desc, searchString ) => {
|
|
697
715
|
const user = userEvent.setup();
|
|
698
716
|
|
|
699
|
-
render(
|
|
717
|
+
render(
|
|
718
|
+
<LinkControl
|
|
719
|
+
value={ fauxEntitySuggestions[ 0 ] }
|
|
720
|
+
forceIsEditingLink
|
|
721
|
+
/>
|
|
722
|
+
);
|
|
700
723
|
|
|
701
724
|
// Search Input UI.
|
|
702
725
|
const searchInput = screen.getByRole( 'combobox', {
|
|
703
|
-
name: '
|
|
726
|
+
name: 'Link',
|
|
704
727
|
} );
|
|
705
728
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
} );
|
|
729
|
+
// Remove the existing link.
|
|
730
|
+
await user.clear( searchInput );
|
|
709
731
|
|
|
710
|
-
expect( submitButton ).toHaveAttribute(
|
|
711
|
-
'aria-disabled',
|
|
712
|
-
'true'
|
|
713
|
-
);
|
|
714
|
-
expect( submitButton ).toBeVisible();
|
|
715
|
-
|
|
716
|
-
// Simulate searching for a term.
|
|
717
732
|
if ( searchString.length ) {
|
|
718
|
-
// Simulate searching for a term.
|
|
719
733
|
await user.type( searchInput, searchString );
|
|
720
734
|
} else {
|
|
721
735
|
// Simulate clearing the search term.
|
|
722
736
|
await user.clear( searchInput );
|
|
723
737
|
}
|
|
724
738
|
|
|
725
|
-
|
|
726
|
-
await user.click( submitButton );
|
|
727
|
-
|
|
728
|
-
submitButton = screen.queryByRole( 'button', {
|
|
739
|
+
const submitButton = screen.queryByRole( 'button', {
|
|
729
740
|
name: 'Save',
|
|
730
741
|
} );
|
|
731
742
|
|
|
732
|
-
//
|
|
733
|
-
|
|
743
|
+
// debug the UI state
|
|
744
|
+
// screen.debug();
|
|
745
|
+
|
|
746
|
+
// Verify the submission UI is disabled.
|
|
747
|
+
expect( submitButton ).toBeVisible();
|
|
734
748
|
expect( submitButton ).toHaveAttribute(
|
|
735
749
|
'aria-disabled',
|
|
736
750
|
'true'
|
|
737
751
|
);
|
|
738
|
-
|
|
752
|
+
|
|
753
|
+
// Attempt to submit the empty search value in the input.
|
|
754
|
+
await user.click( submitButton );
|
|
755
|
+
|
|
756
|
+
// Verify the UI hasn't allowed submission because
|
|
757
|
+
// the search input is still visible.
|
|
758
|
+
expect( searchInput ).toBeVisible();
|
|
739
759
|
}
|
|
740
760
|
);
|
|
741
761
|
} );
|
|
742
762
|
|
|
743
763
|
describe( 'Handling cancellation', () => {
|
|
744
|
-
it( 'should
|
|
745
|
-
const user = userEvent.setup();
|
|
764
|
+
it( 'should not show cancellation button during link creation', async () => {
|
|
746
765
|
const mockOnRemove = jest.fn();
|
|
747
|
-
const mockOnCancel = jest.fn();
|
|
748
766
|
|
|
749
767
|
render( <LinkControl onRemove={ mockOnRemove } /> );
|
|
750
768
|
|
|
751
|
-
// Search Input UI.
|
|
752
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
753
|
-
name: 'URL',
|
|
754
|
-
} );
|
|
755
|
-
|
|
756
769
|
const cancelButton = screen.queryByRole( 'button', {
|
|
757
770
|
name: 'Cancel',
|
|
758
771
|
} );
|
|
759
772
|
|
|
760
|
-
expect( cancelButton ).
|
|
761
|
-
expect( cancelButton ).toBeVisible();
|
|
762
|
-
|
|
763
|
-
// Simulate adding a link for a term.
|
|
764
|
-
await user.type( searchInput, 'https://www.wordpress.org' );
|
|
765
|
-
|
|
766
|
-
// Attempt to submit the empty search value in the input.
|
|
767
|
-
await user.click( cancelButton );
|
|
768
|
-
|
|
769
|
-
// Verify the consumer can handle the cancellation.
|
|
770
|
-
expect( mockOnRemove ).toHaveBeenCalled();
|
|
771
|
-
|
|
772
|
-
// Ensure optional callback is not called.
|
|
773
|
-
expect( mockOnCancel ).not.toHaveBeenCalled();
|
|
774
|
-
|
|
775
|
-
expect( searchInput ).toHaveValue( '' );
|
|
773
|
+
expect( cancelButton ).not.toBeInTheDocument();
|
|
776
774
|
} );
|
|
777
775
|
|
|
778
776
|
it( 'should allow cancellation of the link editing process and reset any entered values', async () => {
|
|
@@ -809,7 +807,7 @@ describe( 'Manual link entry', () => {
|
|
|
809
807
|
await toggleSettingsDrawer( user );
|
|
810
808
|
|
|
811
809
|
let searchInput = screen.getByRole( 'combobox', {
|
|
812
|
-
name: '
|
|
810
|
+
name: 'Link',
|
|
813
811
|
} );
|
|
814
812
|
|
|
815
813
|
let textInput = screen.getByRole( 'textbox', {
|
|
@@ -844,7 +842,7 @@ describe( 'Manual link entry', () => {
|
|
|
844
842
|
|
|
845
843
|
// Re-query the inputs as they have been replaced.
|
|
846
844
|
searchInput = screen.getByRole( 'combobox', {
|
|
847
|
-
name: '
|
|
845
|
+
name: 'Link',
|
|
848
846
|
} );
|
|
849
847
|
|
|
850
848
|
textInput = screen.getByRole( 'textbox', {
|
|
@@ -860,7 +858,13 @@ describe( 'Manual link entry', () => {
|
|
|
860
858
|
const user = userEvent.setup();
|
|
861
859
|
const mockOnCancel = jest.fn();
|
|
862
860
|
|
|
863
|
-
render(
|
|
861
|
+
render(
|
|
862
|
+
<LinkControl
|
|
863
|
+
value={ fauxEntitySuggestions[ 0 ] }
|
|
864
|
+
onCancel={ mockOnCancel }
|
|
865
|
+
forceIsEditingLink
|
|
866
|
+
/>
|
|
867
|
+
);
|
|
864
868
|
|
|
865
869
|
const cancelButton = screen.queryByRole( 'button', {
|
|
866
870
|
name: 'Cancel',
|
|
@@ -886,7 +890,7 @@ describe( 'Manual link entry', () => {
|
|
|
886
890
|
|
|
887
891
|
// Search Input UI.
|
|
888
892
|
const searchInput = screen.getByRole( 'combobox', {
|
|
889
|
-
name: '
|
|
893
|
+
name: 'Link',
|
|
890
894
|
} );
|
|
891
895
|
|
|
892
896
|
// Simulate searching for a term.
|
|
@@ -922,7 +926,7 @@ describe( 'Default search suggestions', () => {
|
|
|
922
926
|
// Verify input has no value has default suggestions should only show
|
|
923
927
|
// when this does not have a value.
|
|
924
928
|
// Search Input UI.
|
|
925
|
-
expect( screen.getByRole( 'combobox', { name: '
|
|
929
|
+
expect( screen.getByRole( 'combobox', { name: 'Link' } ) ).toHaveValue(
|
|
926
930
|
''
|
|
927
931
|
);
|
|
928
932
|
|
|
@@ -951,7 +955,7 @@ describe( 'Default search suggestions', () => {
|
|
|
951
955
|
} );
|
|
952
956
|
await user.click( currentLinkBtn );
|
|
953
957
|
|
|
954
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
958
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
955
959
|
|
|
956
960
|
// Search input is set to the URL value.
|
|
957
961
|
expect( searchInput ).toHaveValue( initialValue.url );
|
|
@@ -973,7 +977,7 @@ describe( 'Default search suggestions', () => {
|
|
|
973
977
|
render( <LinkControl showInitialSuggestions /> );
|
|
974
978
|
|
|
975
979
|
// Search Input UI.
|
|
976
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
980
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
977
981
|
|
|
978
982
|
// Simulate searching for a term.
|
|
979
983
|
await user.type( searchInput, searchTerm );
|
|
@@ -1011,7 +1015,7 @@ describe( 'Default search suggestions', () => {
|
|
|
1011
1015
|
|
|
1012
1016
|
render( <LinkControl showInitialSuggestions /> );
|
|
1013
1017
|
|
|
1014
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
1018
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1015
1019
|
|
|
1016
1020
|
const searchResultsField = screen.queryByRole( 'listbox', {
|
|
1017
1021
|
name: 'Suggestions',
|
|
@@ -1069,7 +1073,9 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1069
1073
|
render( <LinkControlConsumer /> );
|
|
1070
1074
|
|
|
1071
1075
|
// Search Input UI.
|
|
1072
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
1076
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
1077
|
+
name: 'Link',
|
|
1078
|
+
} );
|
|
1073
1079
|
|
|
1074
1080
|
// Simulate searching for a term.
|
|
1075
1081
|
await user.type( searchInput, entityNameText );
|
|
@@ -1136,7 +1142,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1136
1142
|
render( <LinkControlConsumer /> );
|
|
1137
1143
|
|
|
1138
1144
|
// Search Input UI.
|
|
1139
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
1145
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1140
1146
|
|
|
1141
1147
|
// Simulate searching for a term.
|
|
1142
1148
|
await user.type( searchInput, 'Some new page to create' );
|
|
@@ -1185,7 +1191,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1185
1191
|
render( <LinkControlConsumer /> );
|
|
1186
1192
|
|
|
1187
1193
|
// Search Input UI.
|
|
1188
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
1194
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1189
1195
|
|
|
1190
1196
|
// Simulate searching for a term.
|
|
1191
1197
|
await user.type( searchInput, entityNameText );
|
|
@@ -1228,7 +1234,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1228
1234
|
render( <LinkControlConsumer /> );
|
|
1229
1235
|
|
|
1230
1236
|
// Search Input UI.
|
|
1231
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
1237
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1232
1238
|
|
|
1233
1239
|
// Simulate searching for a term.
|
|
1234
1240
|
await user.type( searchInput, entityNameText );
|
|
@@ -1252,7 +1258,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1252
1258
|
|
|
1253
1259
|
// Search Input UI.
|
|
1254
1260
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1255
|
-
name: '
|
|
1261
|
+
name: 'Link',
|
|
1256
1262
|
} );
|
|
1257
1263
|
|
|
1258
1264
|
const searchResultsField = screen.queryByRole( 'listbox' );
|
|
@@ -1272,7 +1278,9 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1272
1278
|
);
|
|
1273
1279
|
|
|
1274
1280
|
// Search Input UI.
|
|
1275
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
1281
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
1282
|
+
name: 'Link',
|
|
1283
|
+
} );
|
|
1276
1284
|
|
|
1277
1285
|
const searchResultsField = screen.queryByRole( 'listbox' );
|
|
1278
1286
|
|
|
@@ -1295,7 +1303,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1295
1303
|
|
|
1296
1304
|
// Search Input UI.
|
|
1297
1305
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1298
|
-
name: '
|
|
1306
|
+
name: 'Link',
|
|
1299
1307
|
} );
|
|
1300
1308
|
|
|
1301
1309
|
// Simulate searching for a term.
|
|
@@ -1329,7 +1337,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1329
1337
|
render( <LinkControl createSuggestion={ createSuggestion } /> );
|
|
1330
1338
|
|
|
1331
1339
|
// Search Input UI.
|
|
1332
|
-
searchInput = screen.getByRole( 'combobox', { name: '
|
|
1340
|
+
searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1333
1341
|
|
|
1334
1342
|
// Simulate searching for a term.
|
|
1335
1343
|
await user.type( searchInput, searchText );
|
|
@@ -1344,7 +1352,7 @@ describe( 'Creating Entities (eg: Posts, Pages)', () => {
|
|
|
1344
1352
|
|
|
1345
1353
|
await user.click( createButton );
|
|
1346
1354
|
|
|
1347
|
-
searchInput = screen.getByRole( 'combobox', { name: '
|
|
1355
|
+
searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1348
1356
|
|
|
1349
1357
|
const errorNotice = screen.getAllByText(
|
|
1350
1358
|
'API response returned invalid entity.'
|
|
@@ -1417,7 +1425,7 @@ describe( 'Selecting links', () => {
|
|
|
1417
1425
|
// Simulate searching for a term.
|
|
1418
1426
|
await user.click( currentLinkBtn );
|
|
1419
1427
|
|
|
1420
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
1428
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1421
1429
|
currentLinkUI = screen.queryByLabelText( 'Currently selected' );
|
|
1422
1430
|
|
|
1423
1431
|
// We should be back to showing the search input.
|
|
@@ -1458,7 +1466,7 @@ describe( 'Selecting links', () => {
|
|
|
1458
1466
|
|
|
1459
1467
|
// Search Input UI.
|
|
1460
1468
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1461
|
-
name: '
|
|
1469
|
+
name: 'Link',
|
|
1462
1470
|
} );
|
|
1463
1471
|
|
|
1464
1472
|
// Simulate searching for a term.
|
|
@@ -1520,7 +1528,7 @@ describe( 'Selecting links', () => {
|
|
|
1520
1528
|
|
|
1521
1529
|
// Search Input UI.
|
|
1522
1530
|
const searchInput = screen.getByRole( 'combobox', {
|
|
1523
|
-
name: '
|
|
1531
|
+
name: 'Link',
|
|
1524
1532
|
} );
|
|
1525
1533
|
|
|
1526
1534
|
// Simulate searching for a term.
|
|
@@ -1609,7 +1617,9 @@ describe( 'Selecting links', () => {
|
|
|
1609
1617
|
).toBeVisible();
|
|
1610
1618
|
|
|
1611
1619
|
// Search Input UI.
|
|
1612
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
1620
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
1621
|
+
name: 'Link',
|
|
1622
|
+
} );
|
|
1613
1623
|
|
|
1614
1624
|
// Step down into the search results, highlighting the first result item.
|
|
1615
1625
|
triggerArrowDown( searchInput );
|
|
@@ -1665,7 +1675,9 @@ describe( 'Selecting links', () => {
|
|
|
1665
1675
|
render( <LinkControl value={ selectedLink } forceIsEditingLink /> );
|
|
1666
1676
|
|
|
1667
1677
|
// focus the search input
|
|
1668
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
1678
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
1679
|
+
name: 'Link',
|
|
1680
|
+
} );
|
|
1669
1681
|
|
|
1670
1682
|
fireEvent.focus( searchInput );
|
|
1671
1683
|
|
|
@@ -1707,10 +1719,7 @@ describe( 'Addition Settings UI', () => {
|
|
|
1707
1719
|
|
|
1708
1720
|
render( <LinkControlConsumer /> );
|
|
1709
1721
|
|
|
1710
|
-
const settingsToggle =
|
|
1711
|
-
name: 'Link Settings',
|
|
1712
|
-
ariaControls: 'link-settings-1',
|
|
1713
|
-
} );
|
|
1722
|
+
const settingsToggle = getSettingsDrawerToggle();
|
|
1714
1723
|
|
|
1715
1724
|
expect( settingsToggle ).not.toBeInTheDocument();
|
|
1716
1725
|
} );
|
|
@@ -1727,10 +1736,7 @@ describe( 'Addition Settings UI', () => {
|
|
|
1727
1736
|
|
|
1728
1737
|
const user = userEvent.setup();
|
|
1729
1738
|
|
|
1730
|
-
const settingsToggle =
|
|
1731
|
-
name: 'Link Settings',
|
|
1732
|
-
ariaControls: 'link-settings-1',
|
|
1733
|
-
} );
|
|
1739
|
+
const settingsToggle = getSettingsDrawerToggle();
|
|
1734
1740
|
|
|
1735
1741
|
expect( settingsToggle ).toHaveAttribute( 'aria-expanded', 'false' );
|
|
1736
1742
|
|
|
@@ -1891,7 +1897,7 @@ describe( 'Post types', () => {
|
|
|
1891
1897
|
render( <LinkControl /> );
|
|
1892
1898
|
|
|
1893
1899
|
// Search Input UI.
|
|
1894
|
-
const searchInput = screen.getByRole( 'combobox', { name: '
|
|
1900
|
+
const searchInput = screen.getByRole( 'combobox', { name: 'Link' } );
|
|
1895
1901
|
|
|
1896
1902
|
// Simulate searching for a term.
|
|
1897
1903
|
await user.type( searchInput, searchTerm );
|
|
@@ -1918,7 +1924,9 @@ describe( 'Post types', () => {
|
|
|
1918
1924
|
render( <LinkControl suggestionsQuery={ { type: postType } } /> );
|
|
1919
1925
|
|
|
1920
1926
|
// Search Input UI.
|
|
1921
|
-
const searchInput = screen.getByRole( 'combobox', {
|
|
1927
|
+
const searchInput = screen.getByRole( 'combobox', {
|
|
1928
|
+
name: 'Link',
|
|
1929
|
+
} );
|
|
1922
1930
|
|
|
1923
1931
|
// Simulate searching for a term.
|
|
1924
1932
|
await user.type( searchInput, searchTerm );
|
|
@@ -2376,10 +2384,14 @@ describe( 'Controlling link title text', () => {
|
|
|
2376
2384
|
} );
|
|
2377
2385
|
} );
|
|
2378
2386
|
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
name: '
|
|
2387
|
+
function getSettingsDrawerToggle() {
|
|
2388
|
+
return screen.queryByRole( 'button', {
|
|
2389
|
+
name: 'Advanced',
|
|
2382
2390
|
} );
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
async function toggleSettingsDrawer( user ) {
|
|
2394
|
+
const settingsToggle = getSettingsDrawerToggle();
|
|
2383
2395
|
|
|
2384
2396
|
await user.click( settingsToggle );
|
|
2385
2397
|
}
|
|
@@ -21,16 +21,15 @@ export const Appender = forwardRef(
|
|
|
21
21
|
const { insertedBlock, setInsertedBlock } = useListViewContext();
|
|
22
22
|
|
|
23
23
|
const instanceId = useInstanceId( Appender );
|
|
24
|
-
const
|
|
24
|
+
const hideInserter = useSelect(
|
|
25
25
|
( select ) => {
|
|
26
26
|
const { getTemplateLock, __unstableGetEditorMode } =
|
|
27
27
|
select( blockEditorStore );
|
|
28
28
|
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
29
|
+
return (
|
|
30
|
+
!! getTemplateLock( clientId ) ||
|
|
31
|
+
__unstableGetEditorMode() === 'zoom-out'
|
|
32
|
+
);
|
|
34
33
|
},
|
|
35
34
|
[ clientId ]
|
|
36
35
|
);
|