@wordpress/block-editor 17.0.2-next.v.202608281122.0 → 17.1.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 +29 -1
- package/build/components/background-image-control/index.cjs +18 -1
- package/build/components/background-image-control/index.cjs.map +2 -2
- package/build/components/block-allowed-blocks/modal.cjs +2 -1
- package/build/components/block-allowed-blocks/modal.cjs.map +3 -3
- package/build/components/block-edit/edit.cjs.map +1 -1
- package/build/components/block-inspector/index.cjs +3 -12
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-is-hovered.cjs +17 -4
- package/build/components/block-list/use-block-props/use-is-hovered.cjs.map +2 -2
- package/build/components/block-preview/index.cjs +1 -2
- package/build/components/block-preview/index.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +2 -1
- package/build/components/block-switcher/index.cjs.map +3 -3
- package/build/components/block-toolbar/pattern-overrides-dropdown.cjs +2 -1
- package/build/components/block-toolbar/pattern-overrides-dropdown.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +19 -42
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/image-settings-panel.cjs.map +1 -1
- package/build/components/iframe/index.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.cjs.map +1 -1
- package/build/components/inserter-draggable-blocks/index.cjs.map +1 -1
- package/build/components/inspector-controls-tabs/content-tab.cjs +2 -3
- package/build/components/inspector-controls-tabs/content-tab.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +1 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/inspector-popover-header/index.cjs +5 -4
- package/build/components/inspector-popover-header/index.cjs.map +3 -3
- package/build/components/link-control/index.cjs.map +2 -2
- package/build/components/link-control/search-input.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +9 -1
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/use-list-view-drop-zone.cjs.map +1 -1
- package/build/components/media-replace-flow/index.cjs +4 -1
- package/build/components/media-replace-flow/index.cjs.map +2 -2
- package/build/components/navigable-toolbar/index.cjs +3 -0
- package/build/components/navigable-toolbar/index.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/enter.cjs +23 -11
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/index.cjs +0 -2
- package/build/components/rich-text/event-listeners/index.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +4 -2
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +2 -2
- package/build/components/use-block-drop-zone/index.cjs.map +1 -1
- package/build/components/writing-flow/index.cjs +5 -0
- package/build/components/writing-flow/index.cjs.map +3 -3
- package/build/components/writing-flow/use-arrow-nav.cjs.map +1 -1
- package/build/components/writing-flow/use-input.cjs +12 -2
- package/build/components/writing-flow/use-input.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs +84 -41
- package/build/components/writing-flow/use-tab-nav.cjs.map +3 -3
- package/build/components/{rich-text/event-listeners/undo-automatic-change.cjs → writing-flow/use-undo-automatic-change.cjs} +18 -15
- package/build/components/writing-flow/use-undo-automatic-change.cjs.map +7 -0
- package/build/hooks/border.cjs +2 -46
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/generate-fields-from-attributes.cjs.map +1 -1
- package/build/hooks/index.cjs +0 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/style.cjs +2 -2
- package/build/hooks/style.cjs.map +2 -2
- package/build/layouts/flex.cjs +3 -0
- package/build/layouts/flex.cjs.map +2 -2
- package/build/store/actions.cjs +12 -9
- package/build/store/actions.cjs.map +3 -3
- package/build-module/components/background-image-control/index.mjs +18 -1
- package/build-module/components/background-image-control/index.mjs.map +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs +2 -2
- package/build-module/components/block-allowed-blocks/modal.mjs.map +2 -2
- package/build-module/components/block-edit/edit.mjs.map +1 -1
- package/build-module/components/block-inspector/index.mjs +3 -12
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs +17 -4
- package/build-module/components/block-list/use-block-props/use-is-hovered.mjs.map +2 -2
- package/build-module/components/block-preview/index.mjs +1 -2
- package/build-module/components/block-preview/index.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +2 -2
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs +3 -6
- package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +19 -42
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/image-settings-panel.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.mjs.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.mjs.map +1 -1
- package/build-module/components/inspector-controls-tabs/content-tab.mjs +3 -4
- package/build-module/components/inspector-controls-tabs/content-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -3
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +1 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/inspector-popover-header/index.mjs +6 -7
- package/build-module/components/inspector-popover-header/index.mjs.map +2 -2
- package/build-module/components/link-control/index.mjs.map +2 -2
- package/build-module/components/link-control/search-input.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +9 -1
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +1 -1
- package/build-module/components/media-replace-flow/index.mjs +4 -1
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/navigable-toolbar/index.mjs +3 -0
- package/build-module/components/navigable-toolbar/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +23 -11
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/index.mjs +0 -2
- package/build-module/components/rich-text/event-listeners/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +4 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/use-block-drop-zone/index.mjs.map +1 -1
- package/build-module/components/writing-flow/index.mjs +5 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +1 -1
- package/build-module/components/writing-flow/use-input.mjs +12 -2
- package/build-module/components/writing-flow/use-input.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs +86 -43
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +3 -3
- package/build-module/components/writing-flow/use-undo-automatic-change.mjs +36 -0
- package/build-module/components/writing-flow/use-undo-automatic-change.mjs.map +7 -0
- package/build-module/hooks/border.mjs +1 -45
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/generate-fields-from-attributes.mjs.map +1 -1
- package/build-module/hooks/index.mjs +0 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/style.mjs +3 -2
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +3 -0
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/store/actions.mjs +12 -9
- package/build-module/store/actions.mjs.map +2 -2
- package/build-style/content-rtl.css +9 -20
- package/build-style/content.css +9 -20
- package/build-style/style-rtl.css +100 -221
- package/build-style/style.css +100 -221
- package/package.json +42 -41
- package/src/autocompleters/test/block.js +1 -0
- package/src/components/alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +34 -16
- package/src/components/alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/background-image-control/index.jsx +32 -1
- package/src/components/background-image-control/style.scss +5 -3
- package/src/components/background-image-control/test/{index.js → index.jsdom.test.js} +1 -0
- package/src/components/block-alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +68 -13
- package/src/components/block-alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/block-allowed-blocks/modal.jsx +3 -3
- package/src/components/block-bindings/test/{use-block-bindings-utils.js → use-block-bindings-utils.jsdom.test.js} +2 -1
- package/src/components/block-breadcrumb/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +2 -2
- package/src/components/block-breadcrumb/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/block-compare/test/__snapshots__/{block-view.jsx.snap → block-view.jsdom.test.jsx.snap} +2 -2
- package/src/components/block-compare/test/{block-view.jsx → block-view.jsdom.test.jsx} +1 -0
- package/src/components/block-controls/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/block-edit/edit.jsx +1 -1
- package/src/components/block-edit/test/{edit.jsx → edit.jsdom.test.jsx} +1 -0
- package/src/components/block-icon/content.scss +0 -6
- package/src/components/block-icon/style.scss +0 -6
- package/src/components/block-icon/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +6 -2
- package/src/components/block-inspector/index.jsx +3 -11
- package/src/components/block-list/content.scss +4 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +24 -5
- package/src/components/block-manager/style.scss +2 -0
- package/src/components/block-mover/test/mover-description.js +1 -0
- package/src/components/block-preview/index.jsx +1 -2
- package/src/components/block-preview/test/{index.jsx → index.jsdom.test.jsx} +10 -6
- package/src/components/block-selection-clearer/test/{index.jsx → index.jsdom.test.jsx} +24 -19
- package/src/components/block-settings-menu/test/{block-mode-toggle.jsx → block-mode-toggle.jsdom.test.jsx} +5 -1
- package/src/components/block-styles/test/utils.js +1 -0
- package/src/components/block-switcher/index.jsx +3 -3
- package/src/components/block-switcher/test/{index.jsx → index.jsdom.test.jsx} +8 -4
- package/src/components/block-switcher/test/use-transformed.patterns.js +1 -0
- package/src/components/block-switcher/test/utils.js +1 -0
- package/src/components/block-title/test/{index.jsx → index.jsdom.test.jsx} +7 -3
- package/src/components/block-toolbar/pattern-overrides-dropdown.jsx +3 -6
- package/src/components/block-toolbar/style.scss +1 -1
- package/src/components/block-toolbar/test/{block-toolbar-icon.jsx → block-toolbar-icon.jsdom.test.jsx} +25 -21
- package/src/components/block-variation-picker/content.scss +5 -3
- package/src/components/block-vertical-alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +55 -11
- package/src/components/block-vertical-alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/block-visibility/test/{use-block-visibility.js → use-block-visibility.jsdom.test.js} +6 -5
- package/src/components/block-visibility/test/utils.js +2 -1
- package/src/components/border-radius-control/test/{index.jsx → index.jsdom.test.jsx} +8 -1
- package/src/components/border-radius-control/test/utils.js +1 -0
- package/src/components/button-block-appender/content.scss +1 -1
- package/src/components/child-layout-control/test/{index.jsx → index.jsdom.test.jsx} +18 -15
- package/src/components/color-palette/test/{control.jsx → control.jsdom.test.jsx} +15 -4
- package/src/components/colors/test/utils.js +1 -0
- package/src/components/colors/test/{with-colors.jsx → with-colors.jsdom.test.jsx} +4 -3
- package/src/components/colors-gradients/test/{control.jsx → control.jsdom.test.jsx} +8 -3
- package/src/components/contrast-checker/test/{index.jsx → index.jsdom.test.jsx} +2 -1
- package/src/components/default-block-appender/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +4 -4
- package/src/components/default-block-appender/test/{index.jsx → index.jsdom.test.jsx} +8 -7
- package/src/components/dimensions-tool/test/{index.jsx → index.jsdom.test.jsx} +27 -22
- package/src/components/dimensions-tool/test/utils.js +1 -0
- package/src/components/duotone-control/test/{index.jsx → index.jsdom.test.jsx} +6 -3
- package/src/components/font-sizes/test/fluid-utils.js +1 -0
- package/src/components/font-sizes/test/utils.js +1 -0
- package/src/components/global-styles/border-panel.jsx +17 -40
- package/src/components/global-styles/image-settings-panel.jsx +1 -1
- package/src/components/global-styles/inheritance/test/{index.jsx → index.jsdom.test.jsx} +5 -2
- package/src/components/global-styles/test/{background-panel.jsx → background-panel.jsdom.test.jsx} +10 -5
- package/src/components/global-styles/test/{border-panel.jsx → border-panel.jsdom.test.jsx} +113 -13
- package/src/components/global-styles/test/{color-panel.jsx → color-panel.jsdom.test.jsx} +5 -0
- package/src/components/global-styles/test/{dimensions-panel.jsx → dimensions-panel.jsdom.test.jsx} +14 -14
- package/src/components/global-styles/test/{filters-panel.jsx → filters-panel.jsdom.test.jsx} +7 -4
- package/src/components/global-styles/test/{inherited-value-context-core.js → inherited-value-context-core.jsdom.test.js} +10 -9
- package/src/components/global-styles/test/{inherited-value-context.jsx → inherited-value-context.jsdom.test.jsx} +18 -17
- package/src/components/global-styles/test/{state-control-badges.jsx → state-control-badges.jsdom.test.jsx} +3 -2
- package/src/components/global-styles/test/{typography-panel-core.jsx → typography-panel-core.jsdom.test.jsx} +5 -2
- package/src/components/global-styles/test/{typography-panel.jsx → typography-panel.jsdom.test.jsx} +17 -12
- package/src/components/global-styles/test/typography-utils.js +1 -0
- package/src/components/global-styles/test/utils.js +1 -0
- package/src/components/grid/style.scss +0 -10
- package/src/components/iframe/index.jsx +3 -3
- package/src/components/image-editor/test/index.js +1 -0
- package/src/components/image-size-control/test/{index.jsx → index.jsdom.test.jsx} +8 -3
- package/src/components/inner-blocks/test/__snapshots__/index.jsdom.test.jsx.snap +15 -0
- package/src/components/inner-blocks/test/{index.jsx → index.jsdom.test.jsx} +2 -0
- package/src/components/inner-content/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/inserter/hooks/use-patterns-paging.js +1 -1
- package/src/components/inserter/media-tab/test/{hooks.js → hooks.jsdom.test.js} +12 -11
- package/src/components/inserter/media-tab/test/{media-panel.jsx → media-panel.jsdom.test.jsx} +15 -12
- package/src/components/inserter/style.scss +2 -2
- package/src/components/inserter/test/get-appender-label.js +12 -11
- package/src/components/inserter/test/search-items.js +1 -0
- package/src/components/inserter-draggable-blocks/index.jsx +1 -1
- package/src/components/inserter-list-item/style.scss +1 -0
- package/src/components/inspector-controls-tabs/content-tab.jsx +7 -14
- package/src/components/inspector-controls-tabs/styles-tab.jsx +1 -4
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -8
- package/src/components/inspector-popover-header/index.jsx +6 -7
- package/src/components/line-height-control/test/{index.jsx → index.jsdom.test.jsx} +3 -0
- package/src/components/link-control/index.jsx +3 -0
- package/src/components/link-control/search-input.jsx +1 -1
- package/src/components/link-control/style.scss +1 -1
- package/src/components/link-control/test/{index.jsx → index.jsdom.test.jsx} +52 -42
- package/src/components/link-control/test/is-url-like.js +1 -0
- package/src/components/link-control/test/{url-normalization.test.jsx → url-normalization.jsdom.test.jsx} +21 -20
- package/src/components/link-picker/test/{index.jsx → index.jsdom.test.jsx} +31 -30
- package/src/components/list-view/block-select-button.jsx +6 -1
- package/src/components/list-view/block.jsx +6 -4
- package/src/components/list-view/style.scss +55 -35
- package/src/components/list-view/test/use-list-view-drop-zone.js +1 -0
- package/src/components/list-view/test/utils.js +1 -0
- package/src/components/list-view/use-list-view-drop-zone.js +1 -1
- package/src/components/media-placeholder/test/get-computed-accept-attribute.js +1 -0
- package/src/components/media-placeholder/test/{index.jsx → index.jsdom.test.jsx} +8 -2
- package/src/components/media-replace-flow/index.jsx +6 -1
- package/src/components/media-replace-flow/test/{index.jsx → index.jsdom.test.jsx} +3 -0
- package/src/components/navigable-toolbar/index.jsx +4 -0
- package/src/components/navigable-toolbar/test/index.browser.test.js +50 -0
- package/src/components/panel-color-settings/test/{index.jsx → index.jsdom.test.jsx} +3 -0
- package/src/components/preset-input-control/test/{index.jsx → index.jsdom.test.jsx} +8 -2
- package/src/components/preset-input-control/test/utils.js +1 -0
- package/src/components/provider/test/{experimental-provider.jsx → experimental-provider.jsdom.test.jsx} +3 -2
- package/src/components/provider/test/{use-block-sync.jsx → use-block-sync.jsdom.test.jsx} +45 -44
- package/src/components/recursion-provider/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/responsive-block-control/style.scss +1 -0
- package/src/components/responsive-block-control/test/{index.jsx → index.jsdom.test.jsx} +6 -3
- package/src/components/rich-text/event-listeners/enter.js +29 -14
- package/src/components/rich-text/event-listeners/index.js +0 -2
- package/src/components/rich-text/event-listeners/input-rules.js +7 -2
- package/src/components/spacing-sizes-control/test/{index.jsx → index.jsdom.test.jsx} +23 -20
- package/src/components/spacing-sizes-control/test/utils.js +1 -0
- package/src/components/url-input/test/{button.jsx → button.jsdom.test.jsx} +4 -1
- package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +2 -0
- package/src/components/url-input/test/{index.jsx → index.jsdom.test.jsx} +23 -13
- package/src/components/use-block-display-information/test/{index.jsx → index.jsdom.test.jsx} +14 -10
- package/src/components/use-block-drop-zone/index.js +2 -2
- package/src/components/use-block-drop-zone/test/index.js +1 -0
- package/src/components/use-on-block-drop/test/index.js +28 -31
- package/src/components/warning/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +2 -2
- package/src/components/warning/test/{index.jsx → index.jsdom.test.jsx} +1 -0
- package/src/components/writing-flow/index.jsx +5 -0
- package/src/components/writing-flow/style.scss +48 -0
- package/src/components/writing-flow/test/{index.js → index.jsdom.test.js} +1 -0
- package/src/components/writing-flow/use-arrow-nav.js +2 -2
- package/src/components/writing-flow/use-input.js +29 -2
- package/src/components/writing-flow/use-tab-nav.jsx +155 -70
- package/src/components/writing-flow/use-undo-automatic-change.js +40 -0
- package/src/elements/test/{index.js → index.jsdom.test.js} +1 -0
- package/src/hooks/border.jsx +0 -53
- package/src/hooks/generate-fields-from-attributes.js +1 -1
- package/src/hooks/index.js +0 -2
- package/src/hooks/style.jsx +3 -2
- package/src/hooks/test/{align.jsx → align.jsdom.test.jsx} +1 -0
- package/src/hooks/test/allowed-blocks.js +1 -0
- package/src/hooks/test/{anchor.js → anchor.jsdom.test.js} +1 -0
- package/src/hooks/test/{auto-inspector-controls.js → auto-inspector-controls.jsdom.test.js} +1 -0
- package/src/hooks/test/{background.jsx → background.jsdom.test.jsx} +5 -2
- package/src/hooks/test/{block-style-state.js → block-style-state.jsdom.test.js} +4 -3
- package/src/hooks/test/{cross-origin-isolation.js → cross-origin-isolation.jsdom.test.js} +18 -25
- package/src/hooks/test/{custom-class-name.jsx → custom-class-name.jsdom.test.jsx} +1 -0
- package/src/hooks/test/{dimensions.js → dimensions.jsdom.test.js} +1 -0
- package/src/hooks/test/{duotone.js → duotone.jsdom.test.js} +1 -0
- package/src/hooks/test/{font-size.js → font-size.jsdom.test.js} +1 -0
- package/src/hooks/test/gap.js +1 -0
- package/src/hooks/test/generate-fields-from-attributes.js +1 -0
- package/src/hooks/test/generated-class-name.js +1 -0
- package/src/hooks/test/{inherited-value-wiring.jsx → inherited-value-wiring.jsdom.test.jsx} +49 -51
- package/src/hooks/test/{layout-child.js → layout-child.jsdom.test.js} +1 -0
- package/src/hooks/test/{layout.js → layout.jsdom.test.js} +1 -0
- package/src/hooks/test/metadata.js +1 -0
- package/src/hooks/test/preset-round-trip.js +2 -0
- package/src/hooks/test/settings.jsx +1 -0
- package/src/hooks/test/state-utils.js +1 -0
- package/src/hooks/test/{style.jsx → style.jsdom.test.jsx} +1 -0
- package/src/hooks/test/{text-align.jsx → text-align.jsdom.test.jsx} +1 -0
- package/src/hooks/test/{use-typography-props.js → use-typography-props.jsdom.test.js} +1 -0
- package/src/hooks/test/{utils.js → utils.jsdom.test.js} +1 -0
- package/src/layouts/flex.jsx +7 -0
- package/src/layouts/test/{constrained.jsx → constrained.jsdom.test.jsx} +6 -3
- package/src/layouts/test/{flex.jsx → flex.jsdom.test.jsx} +52 -2
- package/src/layouts/test/{flow.js → flow.jsdom.test.js} +1 -0
- package/src/layouts/test/{grid.jsx → grid.jsdom.test.jsx} +5 -2
- package/src/layouts/test/utils.js +1 -0
- package/src/store/actions.js +14 -12
- package/src/store/test/{actions.js → actions.jsdom.test.js} +50 -49
- package/src/store/test/array.js +1 -0
- package/src/store/test/get-block-settings.js +1 -0
- package/src/store/test/performance.js +2 -1
- package/src/store/test/private-actions.js +1 -0
- package/src/store/test/private-selectors.js +13 -3
- package/src/store/test/reducer.js +37 -8
- package/src/store/test/{registry-selectors.js → registry-selectors.jsdom.test.js} +9 -0
- package/src/store/test/{selectors.jsx → selectors.jsdom.test.jsx} +13 -3
- package/src/style.scss +1 -1
- package/src/utils/test/block-bindings.js +1 -0
- package/src/utils/test/color-values.js +1 -0
- package/src/utils/test/{dom.jsx → dom.jsdom.test.jsx} +38 -43
- package/src/utils/test/format-font-style.js +1 -0
- package/src/utils/test/format-font-weight.js +1 -0
- package/src/utils/test/get-font-styles-and-weights.js +1 -0
- package/src/utils/test/math.js +1 -0
- package/src/utils/test/object.js +1 -0
- package/src/utils/test/pasting.js +1 -0
- package/src/utils/test/selection.js +1 -0
- package/src/utils/test/sorting.js +1 -0
- package/src/utils/test/transform-styles.js +2 -1
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +0 -7
- package/build/hooks/block-fields/fields-dropdown-menu.cjs +0 -67
- package/build/hooks/block-fields/fields-dropdown-menu.cjs.map +0 -7
- package/build/hooks/block-fields/index.cjs +0 -238
- package/build/hooks/block-fields/index.cjs.map +0 -7
- package/build/hooks/block-fields/link/index.cjs +0 -174
- package/build/hooks/block-fields/link/index.cjs.map +0 -7
- package/build/hooks/block-fields/media/index.cjs +0 -262
- package/build/hooks/block-fields/media/index.cjs.map +0 -7
- package/build/hooks/block-fields/rich-text/index.cjs +0 -146
- package/build/hooks/block-fields/rich-text/index.cjs.map +0 -7
- package/build/hooks/block-fields/use-inspector-popover-placement.cjs +0 -41
- package/build/hooks/block-fields/use-inspector-popover-placement.cjs.map +0 -7
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +0 -33
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +0 -7
- package/build-module/hooks/block-fields/fields-dropdown-menu.mjs +0 -46
- package/build-module/hooks/block-fields/fields-dropdown-menu.mjs.map +0 -7
- package/build-module/hooks/block-fields/index.mjs +0 -210
- package/build-module/hooks/block-fields/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/link/index.mjs +0 -141
- package/build-module/hooks/block-fields/link/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/media/index.mjs +0 -241
- package/build-module/hooks/block-fields/media/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/rich-text/index.mjs +0 -115
- package/build-module/hooks/block-fields/rich-text/index.mjs.map +0 -7
- package/build-module/hooks/block-fields/use-inspector-popover-placement.mjs +0 -16
- package/build-module/hooks/block-fields/use-inspector-popover-placement.mjs.map +0 -7
- package/src/components/color-palette/test/__snapshots__/control.jsx.snap +0 -143
- package/src/components/inner-blocks/test/__snapshots__/index.jsx.snap +0 -15
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +0 -39
- package/src/hooks/block-fields/fields-dropdown-menu.jsx +0 -47
- package/src/hooks/block-fields/index.jsx +0 -302
- package/src/hooks/block-fields/link/index.jsx +0 -155
- package/src/hooks/block-fields/link/styles.scss +0 -18
- package/src/hooks/block-fields/media/index.jsx +0 -269
- package/src/hooks/block-fields/media/styles.scss +0 -77
- package/src/hooks/block-fields/rich-text/index.jsx +0 -123
- package/src/hooks/block-fields/rich-text/styles.scss +0 -24
- package/src/hooks/block-fields/styles.scss +0 -33
- package/src/hooks/block-fields/use-inspector-popover-placement.js +0 -16
- /package/src/components/block-icon/test/{index.jsx → index.jsdom.test.jsx} +0 -0
package/src/components/global-styles/test/{typography-panel.jsx → typography-panel.jsdom.test.jsx}
RENAMED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { act, render, renderHook, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { click, render as renderAriakit } from '@ariakit/test/react';
|
|
4
5
|
import TypographyPanel, { useHasTypographyPanel } from '../typography-panel';
|
|
5
6
|
|
|
7
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
8
|
+
|
|
9
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
10
|
+
|
|
6
11
|
// The inheritance treatment sits behind the
|
|
7
12
|
// `gutenberg-global-styles-inheritance-ui` experiment. Turn it on so these
|
|
8
13
|
// tests exercise the inheriting path. The off path lives in
|
|
@@ -198,7 +203,7 @@ describe( 'TypographyPanel — inheritedValue round-trip', () => {
|
|
|
198
203
|
// A local commit writes only the path the user touched. The
|
|
199
204
|
// inherited value is never copied into local attributes by typing.
|
|
200
205
|
const user = userEvent.setup();
|
|
201
|
-
const onChange =
|
|
206
|
+
const onChange = vi.fn();
|
|
202
207
|
const inheritedValue = {
|
|
203
208
|
typography: { textColumns: 3, lineHeight: '1.7' },
|
|
204
209
|
};
|
|
@@ -405,7 +410,7 @@ describe( 'TypographyPanel — inheritedValue round-trip', () => {
|
|
|
405
410
|
// never invoke the parent `onChange`. Otherwise the act
|
|
406
411
|
// of opening the inspector would silently commit every
|
|
407
412
|
// inherited value into the local block attributes.
|
|
408
|
-
const onChange =
|
|
413
|
+
const onChange = vi.fn();
|
|
409
414
|
const inheritedValue = {
|
|
410
415
|
typography: {
|
|
411
416
|
textDecoration: 'underline',
|
|
@@ -435,7 +440,7 @@ describe( 'TypographyPanel — inheritedValue round-trip', () => {
|
|
|
435
440
|
// bypasses the inner ToggleGroupControl's equality
|
|
436
441
|
// short-circuit which would otherwise emit `undefined`.
|
|
437
442
|
const user = userEvent.setup();
|
|
438
|
-
const onChange =
|
|
443
|
+
const onChange = vi.fn();
|
|
439
444
|
const inheritedValue = {
|
|
440
445
|
typography: { textDecoration: 'underline' },
|
|
441
446
|
};
|
|
@@ -525,7 +530,7 @@ describe( 'TypographyPanel — inheritedValue round-trip', () => {
|
|
|
525
530
|
|
|
526
531
|
describe( 'Font appearance (composite ToggleGroup-like select)', () => {
|
|
527
532
|
it( 'mounting an at-rest font appearance does not call onChange (display-without-commit)', async () => {
|
|
528
|
-
const onChange =
|
|
533
|
+
const onChange = vi.fn();
|
|
529
534
|
const inheritedValue = {
|
|
530
535
|
typography: { fontStyle: 'italic', fontWeight: '700' },
|
|
531
536
|
};
|
|
@@ -542,7 +547,7 @@ describe( 'TypographyPanel — inheritedValue round-trip', () => {
|
|
|
542
547
|
|
|
543
548
|
describe( 'FontFamily (CustomSelect archetype)', () => {
|
|
544
549
|
it( 'mounting an at-rest font family does not call onChange (display-without-commit)', async () => {
|
|
545
|
-
const onChange =
|
|
550
|
+
const onChange = vi.fn();
|
|
546
551
|
const inheritedValue = {
|
|
547
552
|
typography: { fontFamily: 'Georgia, serif' },
|
|
548
553
|
};
|
|
@@ -616,7 +621,7 @@ describe( 'TypographyPanel — inheritedValue round-trip', () => {
|
|
|
616
621
|
|
|
617
622
|
describe( 'FontSize (preset picker + custom-size input)', () => {
|
|
618
623
|
it( 'mounting an at-rest font size does not call onChange (display-without-commit)', async () => {
|
|
619
|
-
const onChange =
|
|
624
|
+
const onChange = vi.fn();
|
|
620
625
|
const inheritedValue = {
|
|
621
626
|
typography: { fontSize: 'var:preset|font-size|large' },
|
|
622
627
|
};
|
|
@@ -755,7 +760,7 @@ async function openTextColorDropdown() {
|
|
|
755
760
|
|
|
756
761
|
describe( 'TypographyPanel — duplicate-hex preset slug identity', () => {
|
|
757
762
|
it( 'commits the inherited preset slug when accepting the preselected inherited color', async () => {
|
|
758
|
-
const onChange =
|
|
763
|
+
const onChange = vi.fn();
|
|
759
764
|
|
|
760
765
|
await renderAriakit(
|
|
761
766
|
<TypographyPanel
|
|
@@ -786,7 +791,7 @@ describe( 'TypographyPanel — duplicate-hex preset slug identity', () => {
|
|
|
786
791
|
value={ { color: { text: 'var:preset|color|dark-text' } } }
|
|
787
792
|
settings={ DUPLICATE_PALETTE_SETTINGS }
|
|
788
793
|
panelId="test"
|
|
789
|
-
onChange={
|
|
794
|
+
onChange={ vi.fn() }
|
|
790
795
|
/>
|
|
791
796
|
);
|
|
792
797
|
|
|
@@ -800,7 +805,7 @@ describe( 'TypographyPanel — duplicate-hex preset slug identity', () => {
|
|
|
800
805
|
|
|
801
806
|
describe( 'TypographyPanel — setTextColor link sync', () => {
|
|
802
807
|
it( 'syncs the link color when text and link share the same raw preset reference', async () => {
|
|
803
|
-
const onChange =
|
|
808
|
+
const onChange = vi.fn();
|
|
804
809
|
const sharedRef = 'var:preset|color|dark-background';
|
|
805
810
|
|
|
806
811
|
await renderAriakit(
|
|
@@ -829,7 +834,7 @@ describe( 'TypographyPanel — setTextColor link sync', () => {
|
|
|
829
834
|
} );
|
|
830
835
|
|
|
831
836
|
it( 'does NOT sync the link color when text and link have different raw refs, even if their decoded hex values match', async () => {
|
|
832
|
-
const onChange =
|
|
837
|
+
const onChange = vi.fn();
|
|
833
838
|
|
|
834
839
|
await renderAriakit(
|
|
835
840
|
<TypographyPanel
|
|
@@ -864,7 +869,7 @@ describe( 'TypographyPanel — setTextColor link sync', () => {
|
|
|
864
869
|
// color the user set on the block instance must survive a
|
|
865
870
|
// subsequent text color change instead of being overwritten to
|
|
866
871
|
// track the text color.
|
|
867
|
-
const onChange =
|
|
872
|
+
const onChange = vi.fn();
|
|
868
873
|
|
|
869
874
|
await renderAriakit(
|
|
870
875
|
<TypographyPanel
|
|
@@ -899,7 +904,7 @@ describe( 'TypographyPanel — setTextColor link sync', () => {
|
|
|
899
904
|
it( 'keeps a local link color tracking when it currently matches the local text color', async () => {
|
|
900
905
|
// When the local link color equals the local text color it is
|
|
901
906
|
// still tracking, so a text color change carries the link along.
|
|
902
|
-
const onChange =
|
|
907
|
+
const onChange = vi.fn();
|
|
903
908
|
const sharedRef = 'var:preset|color|blue';
|
|
904
909
|
const distinctPaletteSettings = {
|
|
905
910
|
color: {
|
|
@@ -138,17 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
// Don't show the focus inherited by the Button component.
|
|
142
|
-
&:focus,
|
|
143
|
-
&:focus:enabled,
|
|
144
|
-
&:focus::before {
|
|
145
|
-
box-shadow: none;
|
|
146
|
-
outline: none;
|
|
147
|
-
}
|
|
148
141
|
|
|
149
|
-
&:focus-visible::before {
|
|
150
|
-
@include block-toolbar-button-style__focus();
|
|
151
|
-
}
|
|
152
142
|
}
|
|
153
143
|
}
|
|
154
144
|
|
|
@@ -318,7 +318,7 @@ function Iframe( {
|
|
|
318
318
|
}
|
|
319
319
|
// If the event originates from inside the iframe, it means
|
|
320
320
|
// it bubbled through the portal, but only with React
|
|
321
|
-
// events. We need to
|
|
321
|
+
// events. We need to bubble native events as well,
|
|
322
322
|
// though by doing so we also trigger another React event,
|
|
323
323
|
// so we need to stop the propagation of this event to avoid
|
|
324
324
|
// duplication.
|
|
@@ -389,9 +389,9 @@ function IframeIfReady( props, ref ) {
|
|
|
389
389
|
[]
|
|
390
390
|
);
|
|
391
391
|
|
|
392
|
-
// We shouldn't render the iframe until the editor settings are
|
|
392
|
+
// We shouldn't render the iframe until the editor settings are initialized.
|
|
393
393
|
// The initial settings are needed to get the styles for the srcDoc, which
|
|
394
|
-
// cannot be changed after the iframe is mounted. srcDoc is used to
|
|
394
|
+
// cannot be changed after the iframe is mounted. srcDoc is used to set
|
|
395
395
|
// the initial iframe HTML, which is required to avoid a flash of unstyled
|
|
396
396
|
// content.
|
|
397
397
|
if ( ! isInitialised ) {
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import ImageSizeControl from '../index';
|
|
4
5
|
|
|
6
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
+
|
|
8
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
9
|
+
|
|
5
10
|
describe( 'ImageSizeControl', () => {
|
|
6
|
-
const mockOnChange =
|
|
7
|
-
const mockOnChangeImage =
|
|
11
|
+
const mockOnChange = vi.fn();
|
|
12
|
+
const mockOnChangeImage = vi.fn();
|
|
8
13
|
|
|
9
14
|
afterEach( () => {
|
|
10
15
|
// Cleanup on exiting.
|
|
11
|
-
|
|
16
|
+
vi.clearAllMocks();
|
|
12
17
|
} );
|
|
13
18
|
|
|
14
19
|
it( 'returns custom dimensions when they exist', () => {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`InnerBlocks > should force serialize for invalid block with inner blocks 1`] = `
|
|
4
|
+
"<!-- wp:test-block -->
|
|
5
|
+
<p>Invalid<!-- wp:test-block -->
|
|
6
|
+
<p></p>
|
|
7
|
+
<!-- /wp:test-block --></p>
|
|
8
|
+
<!-- /wp:test-block -->"
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`InnerBlocks > should return element as string, with inner blocks 1`] = `
|
|
12
|
+
"<div>Bananas<!-- wp:fruit {"fruit":"Apples"} -->
|
|
13
|
+
<div>Apples</div>
|
|
14
|
+
<!-- /wp:fruit --></div>"
|
|
15
|
+
`;
|
|
@@ -9,7 +9,7 @@ const PAGE_SIZE = 20;
|
|
|
9
9
|
*
|
|
10
10
|
* @param {Array} currentCategoryPatterns An array of the current patterns to display.
|
|
11
11
|
* @param {string} currentCategory The currently selected category.
|
|
12
|
-
* @param {Object} scrollContainerRef Ref of container to
|
|
12
|
+
* @param {Object} scrollContainerRef Ref of container to find scroll container for when moving between pages.
|
|
13
13
|
* @param {string} currentFilter The currently search filter.
|
|
14
14
|
*
|
|
15
15
|
* @return {Object} Returns the relevant paging values. (totalItems, categoryPatternsList, numPages, changePage, currentPage)
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { renderHook, act, waitFor } from '@testing-library/react';
|
|
2
3
|
import { useDelayedLoading, useMediaResults } from '../hooks';
|
|
3
4
|
|
|
4
5
|
describe( 'useDelayedLoading', () => {
|
|
5
6
|
beforeEach( () => {
|
|
6
|
-
|
|
7
|
+
vi.useFakeTimers();
|
|
7
8
|
} );
|
|
8
9
|
afterEach( () => {
|
|
9
|
-
|
|
10
|
+
vi.useRealTimers();
|
|
10
11
|
} );
|
|
11
12
|
|
|
12
13
|
it( 'does not surface loading before the delay elapses', () => {
|
|
13
14
|
const { result } = renderHook( () => useDelayedLoading( true, 400 ) );
|
|
14
15
|
expect( result.current ).toBe( false );
|
|
15
16
|
act( () => {
|
|
16
|
-
|
|
17
|
+
vi.advanceTimersByTime( 399 );
|
|
17
18
|
} );
|
|
18
19
|
expect( result.current ).toBe( false );
|
|
19
20
|
} );
|
|
@@ -21,7 +22,7 @@ describe( 'useDelayedLoading', () => {
|
|
|
21
22
|
it( 'surfaces loading once the delay elapses', () => {
|
|
22
23
|
const { result } = renderHook( () => useDelayedLoading( true, 400 ) );
|
|
23
24
|
act( () => {
|
|
24
|
-
|
|
25
|
+
vi.advanceTimersByTime( 400 );
|
|
25
26
|
} );
|
|
26
27
|
expect( result.current ).toBe( true );
|
|
27
28
|
} );
|
|
@@ -32,11 +33,11 @@ describe( 'useDelayedLoading', () => {
|
|
|
32
33
|
{ initialProps: { isLoading: true } }
|
|
33
34
|
);
|
|
34
35
|
act( () => {
|
|
35
|
-
|
|
36
|
+
vi.advanceTimersByTime( 200 );
|
|
36
37
|
} );
|
|
37
38
|
rerender( { isLoading: false } );
|
|
38
39
|
act( () => {
|
|
39
|
-
|
|
40
|
+
vi.advanceTimersByTime( 400 );
|
|
40
41
|
} );
|
|
41
42
|
expect( result.current ).toBe( false );
|
|
42
43
|
} );
|
|
@@ -47,7 +48,7 @@ describe( 'useDelayedLoading', () => {
|
|
|
47
48
|
{ initialProps: { isLoading: true } }
|
|
48
49
|
);
|
|
49
50
|
act( () => {
|
|
50
|
-
|
|
51
|
+
vi.advanceTimersByTime( 400 );
|
|
51
52
|
} );
|
|
52
53
|
expect( result.current ).toBe( true );
|
|
53
54
|
rerender( { isLoading: false } );
|
|
@@ -58,7 +59,7 @@ describe( 'useDelayedLoading', () => {
|
|
|
58
59
|
describe( 'useMediaResults', () => {
|
|
59
60
|
const createCategory = ( name, items ) => ( {
|
|
60
61
|
name,
|
|
61
|
-
fetch:
|
|
62
|
+
fetch: vi.fn( async () => items ),
|
|
62
63
|
} );
|
|
63
64
|
|
|
64
65
|
it( 'fetches and returns media for the query', async () => {
|
|
@@ -119,7 +120,7 @@ describe( 'useMediaResults', () => {
|
|
|
119
120
|
it( 'surfaces paging totals from a source that returns them', async () => {
|
|
120
121
|
const category = {
|
|
121
122
|
name: 'images',
|
|
122
|
-
fetch:
|
|
123
|
+
fetch: vi.fn( async () => ( {
|
|
123
124
|
mediaItems: [ { id: 1 } ],
|
|
124
125
|
totalItems: 42,
|
|
125
126
|
totalPages: 3,
|
|
@@ -207,7 +208,7 @@ describe( 'useMediaResults', () => {
|
|
|
207
208
|
let resolveFetch;
|
|
208
209
|
const secondCategory = {
|
|
209
210
|
name: 'attached-images',
|
|
210
|
-
fetch:
|
|
211
|
+
fetch: vi.fn(
|
|
211
212
|
() =>
|
|
212
213
|
new Promise( ( resolve ) => {
|
|
213
214
|
resolveFetch = resolve;
|
|
@@ -231,7 +232,7 @@ describe( 'useMediaResults', () => {
|
|
|
231
232
|
} );
|
|
232
233
|
|
|
233
234
|
it( 'does not refetch when only the category wrapper changes', async () => {
|
|
234
|
-
const fetch =
|
|
235
|
+
const fetch = vi.fn( async () => [ { id: 1 } ] );
|
|
235
236
|
const { result, rerender } = renderHook(
|
|
236
237
|
( { category } ) => useMediaResults( category, { search: '' }, 0 ),
|
|
237
238
|
{
|
package/src/components/inserter/media-tab/test/{media-panel.jsx → media-panel.jsdom.test.jsx}
RENAMED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { MediaCategoryPanel } from '../media-panel';
|
|
3
4
|
|
|
5
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
6
|
+
|
|
4
7
|
// Keep the panel's data + async surface out of the test: return a small,
|
|
5
8
|
// non-empty result set so the grid (and the detach affordance) render.
|
|
6
|
-
|
|
9
|
+
vi.mock( import( '../hooks' ), () => ( {
|
|
7
10
|
useMediaResults: () => ( {
|
|
8
11
|
mediaList: [
|
|
9
12
|
{ id: 1, title: 'Example', url: 'https://example.com/1' },
|
|
@@ -15,7 +18,7 @@ jest.mock( '../hooks', () => ( {
|
|
|
15
18
|
|
|
16
19
|
// Replace `MediaList` with a marker that only reports whether it was wired for
|
|
17
20
|
// detach, so the gate can be asserted without the full preview/dropdown tree.
|
|
18
|
-
|
|
21
|
+
vi.mock( import( '../media-list' ), () => ( {
|
|
19
22
|
__esModule: true,
|
|
20
23
|
default: ( { onDetach } ) => (
|
|
21
24
|
<div
|
|
@@ -27,11 +30,11 @@ jest.mock( '../media-list', () => ( {
|
|
|
27
30
|
|
|
28
31
|
// The attach button renders through MediaUpload's render prop behind a
|
|
29
32
|
// capability check; stub both so the real Button (and its label) render.
|
|
30
|
-
|
|
33
|
+
vi.mock( import( '../../../media-upload' ), () => ( {
|
|
31
34
|
__esModule: true,
|
|
32
35
|
default: ( { render: renderProp } ) => renderProp( { open: () => {} } ),
|
|
33
36
|
} ) );
|
|
34
|
-
|
|
37
|
+
vi.mock( import( '../../../media-upload/check' ), () => ( {
|
|
35
38
|
__esModule: true,
|
|
36
39
|
default: ( { children } ) => children,
|
|
37
40
|
} ) );
|
|
@@ -40,17 +43,17 @@ const baseCategory = {
|
|
|
40
43
|
name: 'attached-images',
|
|
41
44
|
labels: { name: 'Attached images', search_items: 'Search attachments' },
|
|
42
45
|
mediaType: 'image',
|
|
43
|
-
fetch:
|
|
44
|
-
attach:
|
|
45
|
-
detach:
|
|
46
|
-
invalidate:
|
|
46
|
+
fetch: vi.fn(),
|
|
47
|
+
attach: vi.fn(),
|
|
48
|
+
detach: vi.fn(),
|
|
49
|
+
invalidate: vi.fn(),
|
|
47
50
|
};
|
|
48
51
|
|
|
49
52
|
function renderPanel( category ) {
|
|
50
53
|
return render(
|
|
51
54
|
<MediaCategoryPanel
|
|
52
55
|
rootClientId=""
|
|
53
|
-
onInsert={
|
|
56
|
+
onInsert={ vi.fn() }
|
|
54
57
|
category={ category }
|
|
55
58
|
/>
|
|
56
59
|
);
|
|
@@ -88,8 +91,8 @@ describe( 'MediaCategoryPanel attach/detach gating', () => {
|
|
|
88
91
|
|
|
89
92
|
describe( 'MediaCategoryPanel subscription gating', () => {
|
|
90
93
|
it( 'subscribes a local source to media changes and unsubscribes on unmount', () => {
|
|
91
|
-
const unsubscribe =
|
|
92
|
-
const subscribe =
|
|
94
|
+
const unsubscribe = vi.fn();
|
|
95
|
+
const subscribe = vi.fn( () => unsubscribe );
|
|
93
96
|
|
|
94
97
|
const { unmount } = renderPanel( { ...baseCategory, subscribe } );
|
|
95
98
|
|
|
@@ -111,7 +114,7 @@ describe( 'MediaCategoryPanel subscription gating', () => {
|
|
|
111
114
|
// `subscribe` is core-only, gated like `attach`/`detach`: an
|
|
112
115
|
// extender-registered source is always external, so it cannot hook into
|
|
113
116
|
// the panel's refresh cycle just by setting the prop.
|
|
114
|
-
const subscribe =
|
|
117
|
+
const subscribe = vi.fn();
|
|
115
118
|
|
|
116
119
|
renderPanel( { ...baseCategory, subscribe, isExternalResource: true } );
|
|
117
120
|
|
|
@@ -347,7 +347,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
347
347
|
.block-editor-block-patterns-list {
|
|
348
348
|
display: grid;
|
|
349
349
|
grid-template-columns: 1fr 1fr;
|
|
350
|
-
|
|
350
|
+
gap: $grid-unit-10;
|
|
351
351
|
.block-editor-block-patterns-list__list-item {
|
|
352
352
|
margin-bottom: 0;
|
|
353
353
|
}
|
|
@@ -410,7 +410,7 @@ $block-inserter-tabs-height: 44px;
|
|
|
410
410
|
|
|
411
411
|
.block-editor-block-patterns-explorer .block-editor-block-patterns-list {
|
|
412
412
|
display: grid;
|
|
413
|
-
|
|
413
|
+
gap: $grid-unit-40;
|
|
414
414
|
grid-template-columns: repeat(1, 1fr);
|
|
415
415
|
margin-bottom: $grid-unit-20;
|
|
416
416
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { getAppenderLabel } from '../get-appender-label';
|
|
2
3
|
|
|
3
4
|
describe( 'getAppenderLabel', () => {
|
|
@@ -14,7 +15,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
14
15
|
it( 'should return null when defaultBlock.attributes is missing', () => {
|
|
15
16
|
const defaultBlock = { name: 'core/test' };
|
|
16
17
|
const defaultBlockType = {
|
|
17
|
-
__experimentalLabel:
|
|
18
|
+
__experimentalLabel: vi.fn(),
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -52,7 +53,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
52
53
|
attributes: { type: 'page', kind: 'post-type' },
|
|
53
54
|
};
|
|
54
55
|
const defaultBlockType = {
|
|
55
|
-
__experimentalLabel:
|
|
56
|
+
__experimentalLabel: vi.fn( () => 'Add page' ),
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -70,7 +71,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
70
71
|
};
|
|
71
72
|
const fullLabel = 'Add page';
|
|
72
73
|
const defaultBlockType = {
|
|
73
|
-
__experimentalLabel:
|
|
74
|
+
__experimentalLabel: vi.fn( () => fullLabel ),
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -84,7 +85,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
84
85
|
attributes: { foo: 'bar' },
|
|
85
86
|
};
|
|
86
87
|
const defaultBlockType = {
|
|
87
|
-
__experimentalLabel:
|
|
88
|
+
__experimentalLabel: vi.fn( () => 'This is a test' ),
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -98,7 +99,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
98
99
|
attributes: { type: 'page' },
|
|
99
100
|
};
|
|
100
101
|
const defaultBlockType = {
|
|
101
|
-
__experimentalLabel:
|
|
102
|
+
__experimentalLabel: vi.fn( () => null ),
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -112,7 +113,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
112
113
|
attributes: { type: 'page' },
|
|
113
114
|
};
|
|
114
115
|
const defaultBlockType = {
|
|
115
|
-
__experimentalLabel:
|
|
116
|
+
__experimentalLabel: vi.fn( () => undefined ),
|
|
116
117
|
};
|
|
117
118
|
|
|
118
119
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -126,7 +127,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
126
127
|
attributes: { type: 'page' },
|
|
127
128
|
};
|
|
128
129
|
const defaultBlockType = {
|
|
129
|
-
__experimentalLabel:
|
|
130
|
+
__experimentalLabel: vi.fn( () => 123 ),
|
|
130
131
|
};
|
|
131
132
|
|
|
132
133
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -140,7 +141,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
140
141
|
attributes: { type: 'page' },
|
|
141
142
|
};
|
|
142
143
|
const defaultBlockType = {
|
|
143
|
-
__experimentalLabel:
|
|
144
|
+
__experimentalLabel: vi.fn( () => ( { label: 'page' } ) ),
|
|
144
145
|
};
|
|
145
146
|
|
|
146
147
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -155,7 +156,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
155
156
|
};
|
|
156
157
|
const longLabel = 'a'.repeat( 50 );
|
|
157
158
|
const defaultBlockType = {
|
|
158
|
-
__experimentalLabel:
|
|
159
|
+
__experimentalLabel: vi.fn( () => longLabel ),
|
|
159
160
|
};
|
|
160
161
|
|
|
161
162
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -170,7 +171,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
170
171
|
};
|
|
171
172
|
const label49chars = 'a'.repeat( 49 );
|
|
172
173
|
const defaultBlockType = {
|
|
173
|
-
__experimentalLabel:
|
|
174
|
+
__experimentalLabel: vi.fn( () => label49chars ),
|
|
174
175
|
};
|
|
175
176
|
|
|
176
177
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -184,7 +185,7 @@ describe( 'getAppenderLabel', () => {
|
|
|
184
185
|
attributes: { type: 'page' },
|
|
185
186
|
};
|
|
186
187
|
const defaultBlockType = {
|
|
187
|
-
__experimentalLabel:
|
|
188
|
+
__experimentalLabel: vi.fn( () => '' ),
|
|
188
189
|
};
|
|
189
190
|
|
|
190
191
|
const result = getAppenderLabel( defaultBlock, defaultBlockType );
|
|
@@ -62,7 +62,7 @@ const InserterDraggableBlocks = ( {
|
|
|
62
62
|
/*
|
|
63
63
|
* This will fill in the dataTransfer.types array so that
|
|
64
64
|
* the drop zone can check if the draggable is eligible.
|
|
65
|
-
*
|
|
65
|
+
* Unfortunately, on drag start, we don't have access to the
|
|
66
66
|
* actual data, only the data keys/types.
|
|
67
67
|
*/
|
|
68
68
|
event.dataTransfer.items.add( '', type );
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
justify-content: center;
|
|
45
45
|
cursor: var(--wpds-cursor-control);
|
|
46
46
|
background: transparent;
|
|
47
|
+
// stylelint-disable-next-line declaration-property-value-keyword-no-deprecated -- Pending review of overflow-wrap alternative.
|
|
47
48
|
word-break: break-word;
|
|
48
49
|
@media not ( prefers-reduced-motion ) {
|
|
49
50
|
transition: all 0.05s ease-in-out;
|
|
@@ -11,21 +11,14 @@ const ContentTab = ( {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const shouldShowBlockFields =
|
|
15
|
-
window?.__experimentalContentOnlyInspectorFields;
|
|
16
|
-
|
|
17
14
|
return (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/>
|
|
26
|
-
</PanelBody>
|
|
27
|
-
) }
|
|
28
|
-
</>
|
|
15
|
+
<PanelBody title={ __( 'Content' ) }>
|
|
16
|
+
<BlockQuickNavigation
|
|
17
|
+
clientIds={ contentClientIds }
|
|
18
|
+
onSwitchToListView={ onSwitchToListView }
|
|
19
|
+
hasListViewTab={ hasListViewTab }
|
|
20
|
+
/>
|
|
21
|
+
</PanelBody>
|
|
29
22
|
);
|
|
30
23
|
};
|
|
31
24
|
|
|
@@ -4,7 +4,6 @@ import { useMemo } from '@wordpress/element';
|
|
|
4
4
|
import BlockStyles from '../block-styles';
|
|
5
5
|
import InspectorControls from '../inspector-controls';
|
|
6
6
|
import PositionControls from './position-controls-panel';
|
|
7
|
-
import { useBorderPanelLabel } from '../../hooks/border';
|
|
8
7
|
import { useBlockSettings } from '../../hooks/utils';
|
|
9
8
|
import { store as blockEditorStore } from '../../store';
|
|
10
9
|
import { ElementsEdit } from '../../hooks/elements';
|
|
@@ -103,8 +102,6 @@ const StylesTab = ( {
|
|
|
103
102
|
isSectionBlock,
|
|
104
103
|
contentClientIds,
|
|
105
104
|
} ) => {
|
|
106
|
-
const borderPanelLabel = useBorderPanelLabel( { clientId } );
|
|
107
|
-
|
|
108
105
|
return (
|
|
109
106
|
<>
|
|
110
107
|
{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }
|
|
@@ -148,7 +145,7 @@ const StylesTab = ( {
|
|
|
148
145
|
/>
|
|
149
146
|
<InspectorControls.Slot
|
|
150
147
|
group="border"
|
|
151
|
-
label={
|
|
148
|
+
label={ __( 'Borders' ) }
|
|
152
149
|
/>
|
|
153
150
|
<InspectorControls.Slot
|
|
154
151
|
group="elements"
|
|
@@ -79,14 +79,7 @@ export default function useInspectorControlsTabs(
|
|
|
79
79
|
...( hasListFills && hasStyleFills > 1 ? advancedFills : [] ),
|
|
80
80
|
];
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
// to determine whether the content tab to be shown. The tab purely uses slot
|
|
84
|
-
// fills in this situation.
|
|
85
|
-
const shouldShowBlockFields =
|
|
86
|
-
window?.__experimentalContentOnlyInspectorFields;
|
|
87
|
-
const hasContentTab =
|
|
88
|
-
hasContentFills ||
|
|
89
|
-
( ! shouldShowBlockFields && contentClientIds?.length );
|
|
82
|
+
const hasContentTab = hasContentFills || contentClientIds?.length;
|
|
90
83
|
|
|
91
84
|
if ( hasContentTab ) {
|
|
92
85
|
tabs.push( TAB_CONTENT );
|