@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
|
@@ -22,15 +22,32 @@ export function useIsHovered( { isEnabled = true } = {} ) {
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
let timeoutId;
|
|
26
|
+
|
|
25
27
|
function listener( event ) {
|
|
26
28
|
if ( event.defaultPrevented ) {
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
31
|
event.preventDefault();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
32
|
+
const isHovered = event.type === 'mouseover';
|
|
33
|
+
node.classList.toggle( 'is-hovered', isHovered );
|
|
34
|
+
clearTimeout( timeoutId );
|
|
35
|
+
if ( ! isHovered ) {
|
|
36
|
+
node.classList.remove( 'is-hovered-draggable' );
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Over editable content the cursor is a text cursor, not
|
|
40
|
+
// the grab cursor, so no drag would start there. The
|
|
41
|
+
// editability check can force a style recalculation, so it
|
|
42
|
+
// runs once the pointer rests, which also keeps the
|
|
43
|
+
// outline from flashing on blocks it merely passes over.
|
|
44
|
+
const { target } = event;
|
|
45
|
+
timeoutId = setTimeout( () => {
|
|
46
|
+
node.classList.toggle(
|
|
47
|
+
'is-hovered-draggable',
|
|
48
|
+
! target.isContentEditable
|
|
49
|
+
);
|
|
50
|
+
}, 100 );
|
|
34
51
|
}
|
|
35
52
|
|
|
36
53
|
const unsubscribeOut = subscribeDelegatedListener(
|
|
@@ -48,8 +65,10 @@ export function useIsHovered( { isEnabled = true } = {} ) {
|
|
|
48
65
|
unsubscribeOut();
|
|
49
66
|
unsubscribeOver();
|
|
50
67
|
|
|
51
|
-
// Remove
|
|
68
|
+
// Remove classes in case they linger.
|
|
69
|
+
clearTimeout( timeoutId );
|
|
52
70
|
node.classList.remove( 'is-hovered' );
|
|
71
|
+
node.classList.remove( 'is-hovered-draggable' );
|
|
53
72
|
};
|
|
54
73
|
},
|
|
55
74
|
[ isEnabled ]
|
|
@@ -142,8 +142,7 @@ export function useBlockPreview( { blocks, props = {}, layout } ) {
|
|
|
142
142
|
ref,
|
|
143
143
|
className: clsx(
|
|
144
144
|
props.className,
|
|
145
|
-
'block-editor-block-preview__live-content'
|
|
146
|
-
'components-disabled'
|
|
145
|
+
'block-editor-block-preview__live-content'
|
|
147
146
|
),
|
|
148
147
|
children: blocks?.length ? children : null,
|
|
149
148
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
3
|
import {
|
|
3
4
|
registerBlockType,
|
|
4
5
|
unregisterBlockType,
|
|
@@ -71,12 +72,15 @@ describe( 'useBlockPreview', () => {
|
|
|
71
72
|
|
|
72
73
|
// Ensure the block preview class names are merged with the component's class name.
|
|
73
74
|
expect( blockPreviewComponent ).toHaveClass(
|
|
74
|
-
'block-editor-block-preview__live-content'
|
|
75
|
+
'block-editor-block-preview__live-content',
|
|
76
|
+
'test-container-classname',
|
|
77
|
+
{ exact: true }
|
|
75
78
|
);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
)
|
|
79
|
-
|
|
79
|
+
|
|
80
|
+
// Ensure rendered blocks cannot be interacted with.
|
|
81
|
+
await waitFor( () => {
|
|
82
|
+
expect( previewedBlock ).toHaveAttribute( 'inert' );
|
|
83
|
+
} );
|
|
80
84
|
|
|
81
85
|
// Ensure there is no nesting between the parent component and rendered blocks.
|
|
82
86
|
expect( blockPreviewComponent ).toContainElement( previewedBlock );
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
3
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
3
4
|
import BlockSelectionClearer from '../';
|
|
4
5
|
|
|
5
6
|
const defaultUseSelectValues = {
|
|
6
|
-
hasSelectedBlock:
|
|
7
|
-
hasMultiSelection:
|
|
8
|
-
getSettings:
|
|
7
|
+
hasSelectedBlock: vi.fn().mockReturnValue( false ),
|
|
8
|
+
hasMultiSelection: vi.fn().mockReturnValue( false ),
|
|
9
|
+
getSettings: vi.fn().mockReturnValue( {
|
|
9
10
|
clearBlockSelection: true,
|
|
10
11
|
} ),
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
15
|
+
...( await importOriginal() ),
|
|
16
|
+
useDispatch: vi.fn(),
|
|
17
|
+
useSelect: vi.fn(),
|
|
15
18
|
} ) );
|
|
16
19
|
|
|
17
|
-
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
18
|
-
// This allows us to tweak the returned value on each test.
|
|
19
|
-
const mock = jest.fn();
|
|
20
|
-
return mock;
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
20
|
describe( 'BlockSelectionClearer component', () => {
|
|
21
|
+
beforeEach( () => {
|
|
22
|
+
defaultUseSelectValues.hasSelectedBlock.mockReturnValue( false );
|
|
23
|
+
defaultUseSelectValues.hasMultiSelection.mockReturnValue( false );
|
|
24
|
+
defaultUseSelectValues.getSettings.mockReturnValue( {
|
|
25
|
+
clearBlockSelection: true,
|
|
26
|
+
} );
|
|
27
|
+
} );
|
|
28
|
+
|
|
24
29
|
it( 'should clear the selected block when a selected block exists', () => {
|
|
25
|
-
const mockClearSelectedBlock =
|
|
30
|
+
const mockClearSelectedBlock = vi.fn();
|
|
26
31
|
useSelect.mockImplementation( () => ( {
|
|
27
32
|
...defaultUseSelectValues,
|
|
28
|
-
hasSelectedBlock:
|
|
33
|
+
hasSelectedBlock: vi.fn().mockReturnValue( true ),
|
|
29
34
|
} ) );
|
|
30
35
|
useDispatch.mockImplementation( () => ( {
|
|
31
36
|
clearSelectedBlock: mockClearSelectedBlock,
|
|
@@ -43,10 +48,10 @@ describe( 'BlockSelectionClearer component', () => {
|
|
|
43
48
|
} );
|
|
44
49
|
|
|
45
50
|
it( 'should clear the selected block when multiple blocks are selected', () => {
|
|
46
|
-
const mockClearSelectedBlock =
|
|
51
|
+
const mockClearSelectedBlock = vi.fn();
|
|
47
52
|
useSelect.mockImplementation( () => ( {
|
|
48
53
|
...defaultUseSelectValues,
|
|
49
|
-
hasMultiSelection:
|
|
54
|
+
hasMultiSelection: vi.fn().mockReturnValue( true ),
|
|
50
55
|
} ) );
|
|
51
56
|
useDispatch.mockImplementation( () => ( {
|
|
52
57
|
clearSelectedBlock: mockClearSelectedBlock,
|
|
@@ -64,7 +69,7 @@ describe( 'BlockSelectionClearer component', () => {
|
|
|
64
69
|
} );
|
|
65
70
|
|
|
66
71
|
it( 'should not clear the block selection when no blocks are selected', () => {
|
|
67
|
-
const mockClearSelectedBlock =
|
|
72
|
+
const mockClearSelectedBlock = vi.fn();
|
|
68
73
|
useSelect.mockImplementation( () => defaultUseSelectValues );
|
|
69
74
|
useDispatch.mockImplementation( () => ( {
|
|
70
75
|
clearSelectedBlock: mockClearSelectedBlock,
|
|
@@ -82,11 +87,11 @@ describe( 'BlockSelectionClearer component', () => {
|
|
|
82
87
|
} );
|
|
83
88
|
|
|
84
89
|
it( 'should not clear the block selection when the feature is disabled', () => {
|
|
85
|
-
const mockClearSelectedBlock =
|
|
90
|
+
const mockClearSelectedBlock = vi.fn();
|
|
86
91
|
useSelect.mockImplementation( () => ( {
|
|
87
92
|
...defaultUseSelectValues,
|
|
88
|
-
hasSelectedBlock:
|
|
89
|
-
getSettings:
|
|
93
|
+
hasSelectedBlock: vi.fn().mockReturnValue( true ),
|
|
94
|
+
getSettings: vi.fn().mockReturnValue( {
|
|
90
95
|
clearBlockSelection: false,
|
|
91
96
|
} ),
|
|
92
97
|
} ) );
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import BlockModeToggle from '../block-mode-toggle';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
7
|
+
...( await importOriginal() ),
|
|
8
|
+
useSelect: vi.fn(),
|
|
9
|
+
} ) );
|
|
6
10
|
|
|
7
11
|
function setupUseSelectMock( mode, blockType, codeEditingEnabled = true ) {
|
|
8
12
|
useSelect.mockImplementation( () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __, _n, sprintf, _x } from '@wordpress/i18n';
|
|
2
|
+
import { Text } from '@wordpress/ui';
|
|
2
3
|
import {
|
|
3
4
|
DropdownMenu,
|
|
4
5
|
ToolbarGroup,
|
|
5
6
|
ToolbarItem,
|
|
6
|
-
__experimentalText as WCText,
|
|
7
7
|
MenuGroup,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import {
|
|
@@ -177,9 +177,9 @@ function BlockSwitcherDropdownMenuContents( { onClose, clientIds } ) {
|
|
|
177
177
|
) }
|
|
178
178
|
{ isUsingBindings && (
|
|
179
179
|
<MenuGroup>
|
|
180
|
-
<
|
|
180
|
+
<Text className="block-editor-block-switcher__binding-indicator">
|
|
181
181
|
{ connectedBlockDescription }
|
|
182
|
-
</
|
|
182
|
+
</Text>
|
|
183
183
|
</MenuGroup>
|
|
184
184
|
) }
|
|
185
185
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest';
|
|
1
2
|
import { render, screen, within, waitFor } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { useSelect } from '@wordpress/data';
|
|
@@ -5,10 +6,13 @@ import { registerBlockType, unregisterBlockType } from '@wordpress/blocks';
|
|
|
5
6
|
import { copy } from '@wordpress/icons';
|
|
6
7
|
import { BlockSwitcher } from '../';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
);
|
|
9
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
10
|
+
...( await importOriginal() ),
|
|
11
|
+
useSelect: vi.fn(),
|
|
12
|
+
} ) );
|
|
13
|
+
vi.mock( import( '../../block-title/use-block-display-title' ), () => ( {
|
|
14
|
+
default: vi.fn().mockReturnValue( 'Block Name' ),
|
|
15
|
+
} ) );
|
|
12
16
|
|
|
13
17
|
describe( 'BlockSwitcher', () => {
|
|
14
18
|
const headingBlock1 = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import BlockTitle from '../';
|
|
@@ -19,8 +20,8 @@ const blockLabelMap = {
|
|
|
19
20
|
'Reusable Block': 'Reuse me!',
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
const actualImplementation =
|
|
23
|
+
vi.mock( import( '@wordpress/blocks' ), async ( importOriginal ) => {
|
|
24
|
+
const actualImplementation = await importOriginal();
|
|
24
25
|
return {
|
|
25
26
|
...actualImplementation,
|
|
26
27
|
isReusableBlock( { title } ) {
|
|
@@ -33,7 +34,10 @@ jest.mock( '@wordpress/blocks', () => {
|
|
|
33
34
|
} );
|
|
34
35
|
|
|
35
36
|
// This allows us to tweak the returned value on each test.
|
|
36
|
-
|
|
37
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
38
|
+
...( await importOriginal() ),
|
|
39
|
+
useSelect: vi.fn(),
|
|
40
|
+
} ) );
|
|
37
41
|
|
|
38
42
|
describe( 'BlockTitle', () => {
|
|
39
43
|
it( 'renders nothing if name is falsey', () => {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
ToolbarButton,
|
|
4
|
-
__experimentalText as WCText,
|
|
5
|
-
} from '@wordpress/components';
|
|
1
|
+
import { Popover, ToolbarButton } from '@wordpress/components';
|
|
2
|
+
import { Text } from '@wordpress/ui';
|
|
6
3
|
import { __, sprintf } from '@wordpress/i18n';
|
|
7
4
|
import { useState, useRef } from '@wordpress/element';
|
|
8
5
|
import { useSelect } from '@wordpress/data';
|
|
@@ -41,7 +38,7 @@ function PatternOverridesPopoverContent( { clientIds, blockTitle } ) {
|
|
|
41
38
|
description = __( 'These blocks are editable using overrides.' );
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
return <
|
|
41
|
+
return <Text>{ description }</Text>;
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import { paragraph } from '@wordpress/icons';
|
|
4
5
|
import BlockToolbarIcon from '../block-toolbar-icon';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const actualImplementation =
|
|
7
|
+
vi.mock( import( '@wordpress/blocks' ), async ( importOriginal ) => {
|
|
8
|
+
const actualImplementation = await importOriginal();
|
|
8
9
|
return {
|
|
9
10
|
...actualImplementation,
|
|
10
11
|
getBlockType: ( name ) => ( {
|
|
@@ -14,34 +15,37 @@ jest.mock( '@wordpress/blocks', () => {
|
|
|
14
15
|
} ),
|
|
15
16
|
};
|
|
16
17
|
} );
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
19
|
+
...( await importOriginal() ),
|
|
20
|
+
useSelect: vi.fn(),
|
|
21
|
+
} ) );
|
|
22
|
+
vi.mock( import( '../../../lock-unlock' ), () => ( {
|
|
19
23
|
unlock: ( value ) => ( {
|
|
20
|
-
registerPrivateActions:
|
|
21
|
-
registerPrivateSelectors:
|
|
24
|
+
registerPrivateActions: vi.fn(),
|
|
25
|
+
registerPrivateSelectors: vi.fn(),
|
|
22
26
|
...value,
|
|
23
27
|
} ),
|
|
24
28
|
} ) );
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
vi.mock( import( '../../block-title/use-block-display-title' ), () => ( {
|
|
30
|
+
default: () => 'Block Name',
|
|
31
|
+
} ) );
|
|
32
|
+
vi.mock( import( '../../block-icon' ), () => ( {
|
|
33
|
+
default: ( { icon } ) => <span data-testid="block-icon">{ icon }</span>,
|
|
34
|
+
} ) );
|
|
35
|
+
vi.mock( import( '../../block-switcher' ), () => ( {
|
|
36
|
+
default: ( { children } ) => (
|
|
33
37
|
<div data-testid="block-switcher">{ children }</div>
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
),
|
|
39
|
+
} ) );
|
|
40
|
+
vi.mock( import( '../pattern-overrides-dropdown' ), () => ( {
|
|
41
|
+
default: ( { clientIds } ) => (
|
|
38
42
|
<div data-testid="pattern-overrides-dropdown">
|
|
39
43
|
{ clientIds.length === 1
|
|
40
44
|
? 'Block Name'
|
|
41
45
|
: 'Multiple blocks selected' }
|
|
42
46
|
</div>
|
|
43
|
-
)
|
|
44
|
-
);
|
|
47
|
+
),
|
|
48
|
+
} ) );
|
|
45
49
|
|
|
46
50
|
describe( 'BlockToolbarIcon', () => {
|
|
47
51
|
const defaultProps = {
|
|
@@ -76,7 +80,7 @@ describe( 'BlockToolbarIcon', () => {
|
|
|
76
80
|
};
|
|
77
81
|
|
|
78
82
|
beforeEach( () => {
|
|
79
|
-
|
|
83
|
+
vi.clearAllMocks();
|
|
80
84
|
} );
|
|
81
85
|
|
|
82
86
|
describe( 'when variant is "switcher"', () => {
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
font-size: $helptext-font-size;
|
|
17
17
|
|
|
18
18
|
svg {
|
|
19
|
-
fill
|
|
19
|
+
// Keep `fill` as a fallback for custom variation icons that do not use `currentColor`.
|
|
20
|
+
fill: $gray-600;
|
|
21
|
+
color: $gray-600 !important;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
.components-button {
|
|
@@ -28,7 +30,8 @@
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
.components-button:hover svg {
|
|
31
|
-
fill: var(--wp-admin-theme-color)
|
|
33
|
+
fill: var(--wp-admin-theme-color);
|
|
34
|
+
color: var(--wp-admin-theme-color) !important;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
& > li {
|
|
@@ -39,4 +42,3 @@
|
|
|
39
42
|
gap: $grid-unit-05;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden 1`] = `
|
|
3
|
+
exports[`BlockVerticalAlignmentUI > should match snapshot when controls are hidden 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
6
|
class="components-dropdown components-dropdown-menu components-toolbar"
|
|
@@ -16,15 +16,26 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden
|
|
|
16
16
|
>
|
|
17
17
|
<svg
|
|
18
18
|
aria-hidden="true"
|
|
19
|
-
fill="currentColor"
|
|
20
19
|
focusable="false"
|
|
21
20
|
height="24"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
stroke-width="1.5"
|
|
23
|
+
style="fill: none;"
|
|
22
24
|
viewBox="0 0 24 24"
|
|
23
25
|
width="24"
|
|
24
26
|
xmlns="http://www.w3.org/2000/svg"
|
|
25
27
|
>
|
|
28
|
+
<rect
|
|
29
|
+
fill="currentColor"
|
|
30
|
+
height="11"
|
|
31
|
+
stroke="none"
|
|
32
|
+
width="6"
|
|
33
|
+
x="9"
|
|
34
|
+
y="9"
|
|
35
|
+
/>
|
|
26
36
|
<path
|
|
27
|
-
d="
|
|
37
|
+
d="M4 4.75H20"
|
|
38
|
+
vector-effect="non-scaling-stroke"
|
|
28
39
|
/>
|
|
29
40
|
</svg>
|
|
30
41
|
</button>
|
|
@@ -32,7 +43,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden
|
|
|
32
43
|
</div>
|
|
33
44
|
`;
|
|
34
45
|
|
|
35
|
-
exports[`BlockVerticalAlignmentUI should match snapshot when controls are visible 1`] = `
|
|
46
|
+
exports[`BlockVerticalAlignmentUI > should match snapshot when controls are visible 1`] = `
|
|
36
47
|
<div>
|
|
37
48
|
<div
|
|
38
49
|
class="components-toolbar"
|
|
@@ -49,15 +60,26 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
|
|
|
49
60
|
>
|
|
50
61
|
<svg
|
|
51
62
|
aria-hidden="true"
|
|
52
|
-
fill="currentColor"
|
|
53
63
|
focusable="false"
|
|
54
64
|
height="24"
|
|
65
|
+
stroke="currentColor"
|
|
66
|
+
stroke-width="1.5"
|
|
67
|
+
style="fill: none;"
|
|
55
68
|
viewBox="0 0 24 24"
|
|
56
69
|
width="24"
|
|
57
70
|
xmlns="http://www.w3.org/2000/svg"
|
|
58
71
|
>
|
|
72
|
+
<rect
|
|
73
|
+
fill="currentColor"
|
|
74
|
+
height="11"
|
|
75
|
+
stroke="none"
|
|
76
|
+
width="6"
|
|
77
|
+
x="9"
|
|
78
|
+
y="9"
|
|
79
|
+
/>
|
|
59
80
|
<path
|
|
60
|
-
d="
|
|
81
|
+
d="M4 4.75H20"
|
|
82
|
+
vector-effect="non-scaling-stroke"
|
|
61
83
|
/>
|
|
62
84
|
</svg>
|
|
63
85
|
</button>
|
|
@@ -72,15 +94,26 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
|
|
|
72
94
|
>
|
|
73
95
|
<svg
|
|
74
96
|
aria-hidden="true"
|
|
75
|
-
fill="currentColor"
|
|
76
97
|
focusable="false"
|
|
77
98
|
height="24"
|
|
99
|
+
stroke="currentColor"
|
|
100
|
+
stroke-width="1.5"
|
|
101
|
+
style="fill: none;"
|
|
78
102
|
viewBox="0 0 24 24"
|
|
79
103
|
width="24"
|
|
80
104
|
xmlns="http://www.w3.org/2000/svg"
|
|
81
105
|
>
|
|
82
106
|
<path
|
|
83
|
-
d="
|
|
107
|
+
d="M4 12H20"
|
|
108
|
+
vector-effect="non-scaling-stroke"
|
|
109
|
+
/>
|
|
110
|
+
<rect
|
|
111
|
+
fill="currentColor"
|
|
112
|
+
height="16"
|
|
113
|
+
stroke="none"
|
|
114
|
+
width="6"
|
|
115
|
+
x="9"
|
|
116
|
+
y="4"
|
|
84
117
|
/>
|
|
85
118
|
</svg>
|
|
86
119
|
</button>
|
|
@@ -95,15 +128,26 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
|
|
|
95
128
|
>
|
|
96
129
|
<svg
|
|
97
130
|
aria-hidden="true"
|
|
98
|
-
fill="currentColor"
|
|
99
131
|
focusable="false"
|
|
100
132
|
height="24"
|
|
133
|
+
stroke="currentColor"
|
|
134
|
+
stroke-width="1.5"
|
|
135
|
+
style="fill: none;"
|
|
101
136
|
viewBox="0 0 24 24"
|
|
102
137
|
width="24"
|
|
103
138
|
xmlns="http://www.w3.org/2000/svg"
|
|
104
139
|
>
|
|
105
140
|
<path
|
|
106
|
-
d="
|
|
141
|
+
d="M4 19.25H20"
|
|
142
|
+
vector-effect="non-scaling-stroke"
|
|
143
|
+
/>
|
|
144
|
+
<rect
|
|
145
|
+
fill="currentColor"
|
|
146
|
+
height="11"
|
|
147
|
+
stroke="none"
|
|
148
|
+
width="6"
|
|
149
|
+
x="9"
|
|
150
|
+
y="4"
|
|
107
151
|
/>
|
|
108
152
|
</svg>
|
|
109
153
|
</button>
|
package/src/components/block-vertical-alignment-control/test/{index.jsx → index.jsdom.test.jsx}
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, test, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import BlockVerticalAlignmentUI from '../ui';
|
|
4
5
|
|
|
5
6
|
describe( 'BlockVerticalAlignmentUI', () => {
|
|
6
7
|
const alignment = 'top';
|
|
7
|
-
const onChange =
|
|
8
|
+
const onChange = vi.fn();
|
|
8
9
|
|
|
9
10
|
afterEach( () => {
|
|
10
11
|
onChange.mockClear();
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { renderHook } from '@testing-library/react';
|
|
2
3
|
import { useMediaQuery } from '@wordpress/compose';
|
|
4
|
+
import useBlockVisibility from '../use-block-visibility';
|
|
3
5
|
// Mock WordPress dependencies before importing the hook
|
|
4
|
-
|
|
5
|
-
...
|
|
6
|
-
useMediaQuery:
|
|
6
|
+
vi.mock( import( '@wordpress/compose' ), async ( importOriginal ) => ( {
|
|
7
|
+
...( await importOriginal() ),
|
|
8
|
+
useMediaQuery: vi.fn(),
|
|
7
9
|
} ) );
|
|
8
|
-
import useBlockVisibility from '../use-block-visibility';
|
|
9
10
|
|
|
10
11
|
describe( 'useBlockVisibility', () => {
|
|
11
12
|
// Helper function to set up viewport matches
|
|
@@ -26,7 +27,7 @@ describe( 'useBlockVisibility', () => {
|
|
|
26
27
|
|
|
27
28
|
beforeEach( () => {
|
|
28
29
|
// Reset all mocks before each test
|
|
29
|
-
|
|
30
|
+
vi.clearAllMocks();
|
|
30
31
|
} );
|
|
31
32
|
|
|
32
33
|
describe( 'Device type overrides', () => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import {
|
|
2
3
|
getBlockVisibilityViewportEntries,
|
|
3
4
|
getViewportCheckboxState,
|
|
@@ -76,7 +77,7 @@ describe( 'block-visibility utils', () => {
|
|
|
76
77
|
|
|
77
78
|
it( 'should return null when some blocks are hidden for viewport', () => {
|
|
78
79
|
// Suppress console.log from getViewportCheckboxState
|
|
79
|
-
const consoleSpy =
|
|
80
|
+
const consoleSpy = vi
|
|
80
81
|
.spyOn( console, 'log' )
|
|
81
82
|
.mockImplementation( () => {} );
|
|
82
83
|
|
|
@@ -17,12 +17,19 @@
|
|
|
17
17
|
* The tests ensure that when the BorderRadiusControl is refactored to use
|
|
18
18
|
* PresetInputControl, the existing user experience and behavior is preserved.
|
|
19
19
|
*/
|
|
20
|
+
|
|
21
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
20
22
|
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
|
21
23
|
import userEvent from '@testing-library/user-event';
|
|
22
24
|
import BorderRadiusControl from '../index';
|
|
23
25
|
|
|
26
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
27
|
+
|
|
28
|
+
globalThis.wpVitest.mockVisibleElements();
|
|
29
|
+
globalThis.wpVitest.mockScrollIntoView();
|
|
30
|
+
|
|
24
31
|
describe( 'BorderRadiusControl', () => {
|
|
25
|
-
const mockOnChange =
|
|
32
|
+
const mockOnChange = vi.fn();
|
|
26
33
|
const mockPresets = {
|
|
27
34
|
default: [
|
|
28
35
|
{ name: 'None', slug: '0', size: 0 },
|