@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import {
|
|
2
3
|
getStyleForState,
|
|
3
4
|
scopeResetAllFilterToState,
|
|
@@ -153,7 +154,7 @@ describe( 'setStyleForState', () => {
|
|
|
153
154
|
|
|
154
155
|
describe( 'scopeResetAllFilterToState', () => {
|
|
155
156
|
it( 'passes only the selected state style to the reset filter', () => {
|
|
156
|
-
const innerReset =
|
|
157
|
+
const innerReset = vi.fn( ( attributes ) => ( {
|
|
157
158
|
...attributes,
|
|
158
159
|
style: {
|
|
159
160
|
...attributes.style,
|
|
@@ -213,7 +214,7 @@ describe( 'scopeResetAllFilterToState', () => {
|
|
|
213
214
|
} );
|
|
214
215
|
|
|
215
216
|
it( 'calls the reset filter with an empty style when no state styles exist', () => {
|
|
216
|
-
const innerReset =
|
|
217
|
+
const innerReset = vi.fn( ( attributes ) => attributes );
|
|
217
218
|
const attributes = {
|
|
218
219
|
style: { color: { text: '#000000' } },
|
|
219
220
|
};
|
|
@@ -227,7 +228,7 @@ describe( 'scopeResetAllFilterToState', () => {
|
|
|
227
228
|
} );
|
|
228
229
|
|
|
229
230
|
it( 'passes only the selected viewport pseudo state style to the reset filter', () => {
|
|
230
|
-
const innerReset =
|
|
231
|
+
const innerReset = vi.fn( () => ( { style: undefined } ) );
|
|
231
232
|
const attributes = {
|
|
232
233
|
style: {
|
|
233
234
|
color: { text: '#000000' },
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
|
|
1
3
|
describe( 'cross-origin-isolation', () => {
|
|
2
4
|
let originalCrossOriginIsolated;
|
|
3
5
|
let originalBody;
|
|
4
6
|
let observeSpy;
|
|
5
7
|
|
|
6
8
|
beforeEach( () => {
|
|
9
|
+
vi.resetModules();
|
|
10
|
+
|
|
7
11
|
// Save original values
|
|
8
12
|
originalCrossOriginIsolated = window.crossOriginIsolated;
|
|
9
13
|
originalBody = document.body;
|
|
10
14
|
|
|
11
15
|
// Clear any existing filters
|
|
12
|
-
|
|
16
|
+
vi.clearAllMocks();
|
|
13
17
|
|
|
14
18
|
// Spy on MutationObserver.observe
|
|
15
|
-
observeSpy =
|
|
19
|
+
observeSpy = vi.spyOn( window.MutationObserver.prototype, 'observe' );
|
|
16
20
|
} );
|
|
17
21
|
|
|
18
22
|
afterEach( () => {
|
|
@@ -34,10 +38,9 @@ describe( 'cross-origin-isolation', () => {
|
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
observeSpy.mockRestore();
|
|
37
|
-
jest.resetModules();
|
|
38
41
|
} );
|
|
39
42
|
|
|
40
|
-
it( 'should not observe when crossOriginIsolated is false', () => {
|
|
43
|
+
it( 'should not observe when crossOriginIsolated is false', async () => {
|
|
41
44
|
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
42
45
|
value: false,
|
|
43
46
|
writable: true,
|
|
@@ -45,14 +48,12 @@ describe( 'cross-origin-isolation', () => {
|
|
|
45
48
|
} );
|
|
46
49
|
|
|
47
50
|
// Re-import the module to trigger the side effects
|
|
48
|
-
|
|
49
|
-
require( '../cross-origin-isolation' );
|
|
50
|
-
} );
|
|
51
|
+
await import( '../cross-origin-isolation' );
|
|
51
52
|
|
|
52
53
|
expect( observeSpy ).not.toHaveBeenCalled();
|
|
53
54
|
} );
|
|
54
55
|
|
|
55
|
-
it( 'should observe document.body when crossOriginIsolated is true and body exists', () => {
|
|
56
|
+
it( 'should observe document.body when crossOriginIsolated is true and body exists', async () => {
|
|
56
57
|
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
57
58
|
value: true,
|
|
58
59
|
writable: true,
|
|
@@ -66,9 +67,7 @@ describe( 'cross-origin-isolation', () => {
|
|
|
66
67
|
} );
|
|
67
68
|
|
|
68
69
|
// Re-import the module to trigger the side effects
|
|
69
|
-
|
|
70
|
-
require( '../cross-origin-isolation' );
|
|
71
|
-
} );
|
|
70
|
+
await import( '../cross-origin-isolation' );
|
|
72
71
|
|
|
73
72
|
expect( observeSpy ).toHaveBeenCalledWith( document.body, {
|
|
74
73
|
childList: true,
|
|
@@ -77,7 +76,7 @@ describe( 'cross-origin-isolation', () => {
|
|
|
77
76
|
} );
|
|
78
77
|
} );
|
|
79
78
|
|
|
80
|
-
it( 'should wait for DOMContentLoaded when body is not available and document is loading', () => {
|
|
79
|
+
it( 'should wait for DOMContentLoaded when body is not available and document is loading', async () => {
|
|
81
80
|
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
82
81
|
value: true,
|
|
83
82
|
writable: true,
|
|
@@ -98,12 +97,10 @@ describe( 'cross-origin-isolation', () => {
|
|
|
98
97
|
configurable: true,
|
|
99
98
|
} );
|
|
100
99
|
|
|
101
|
-
const addEventListenerSpy =
|
|
100
|
+
const addEventListenerSpy = vi.spyOn( document, 'addEventListener' );
|
|
102
101
|
|
|
103
102
|
// Re-import the module to trigger the side effects
|
|
104
|
-
|
|
105
|
-
require( '../cross-origin-isolation' );
|
|
106
|
-
} );
|
|
103
|
+
await import( '../cross-origin-isolation' );
|
|
107
104
|
|
|
108
105
|
// Should not observe immediately
|
|
109
106
|
expect( observeSpy ).not.toHaveBeenCalled();
|
|
@@ -117,7 +114,7 @@ describe( 'cross-origin-isolation', () => {
|
|
|
117
114
|
addEventListenerSpy.mockRestore();
|
|
118
115
|
} );
|
|
119
116
|
|
|
120
|
-
it( 'should not throw error when body is null and document is complete', () => {
|
|
117
|
+
it( 'should not throw error when body is null and document is complete', async () => {
|
|
121
118
|
Object.defineProperty( window, 'crossOriginIsolated', {
|
|
122
119
|
value: true,
|
|
123
120
|
writable: true,
|
|
@@ -138,11 +135,9 @@ describe( 'cross-origin-isolation', () => {
|
|
|
138
135
|
} );
|
|
139
136
|
|
|
140
137
|
// This should not throw an error
|
|
141
|
-
expect(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} );
|
|
145
|
-
} ).not.toThrow();
|
|
138
|
+
await expect(
|
|
139
|
+
import( '../cross-origin-isolation' )
|
|
140
|
+
).resolves.toBeDefined();
|
|
146
141
|
|
|
147
142
|
// Should not attempt to observe null
|
|
148
143
|
expect( observeSpy ).not.toHaveBeenCalled();
|
|
@@ -156,9 +151,7 @@ describe( 'cross-origin-isolation', () => {
|
|
|
156
151
|
} );
|
|
157
152
|
|
|
158
153
|
// Re-import the module to trigger the side effects
|
|
159
|
-
|
|
160
|
-
require( '../cross-origin-isolation' );
|
|
161
|
-
} );
|
|
154
|
+
await import( '../cross-origin-isolation' );
|
|
162
155
|
|
|
163
156
|
// Create an image and add it to the DOM
|
|
164
157
|
const img = document.createElement( 'img' );
|
package/src/hooks/test/gap.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
1
2
|
import { render } from '@testing-library/react';
|
|
3
|
+
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { TypographyPanel } from '../typography';
|
|
6
|
+
import { ElementsEdit } from '../elements';
|
|
7
|
+
import { BorderPanel } from '../border';
|
|
8
|
+
import { DimensionsPanel } from '../dimensions';
|
|
9
|
+
import { BackgroundImagePanel } from '../background';
|
|
2
10
|
|
|
3
11
|
/**
|
|
4
12
|
* Tests the wiring between inspector hook wrappers and shared
|
|
@@ -11,24 +19,31 @@ import { render } from '@testing-library/react';
|
|
|
11
19
|
* intentionally mocked out so each test exercises only the wiring contract.
|
|
12
20
|
*/
|
|
13
21
|
|
|
14
|
-
//
|
|
15
|
-
// the
|
|
22
|
+
// Vitest hoists `vi.mock` factories, so recorder values are exposed through
|
|
23
|
+
// mutable objects that the factories can close over safely.
|
|
16
24
|
const mockHookRecorder = { calls: [] };
|
|
17
25
|
const mockPanelRecorder = { calls: [] };
|
|
18
26
|
const mockInheritedReturn = { value: {} };
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} )
|
|
28
|
+
vi.mock(
|
|
29
|
+
import( '../../components/global-styles/inherited-value-context' ),
|
|
30
|
+
() => ( {
|
|
31
|
+
__esModule: true,
|
|
32
|
+
useResolvedStyle: ( blockName, className, selectedState ) => {
|
|
33
|
+
mockHookRecorder.calls.push( {
|
|
34
|
+
blockName,
|
|
35
|
+
className,
|
|
36
|
+
selectedState,
|
|
37
|
+
} );
|
|
38
|
+
return {
|
|
39
|
+
value: mockInheritedReturn.value,
|
|
40
|
+
sources: {},
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
} )
|
|
44
|
+
);
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
vi.mock( import( '../../components/global-styles/typography-panel' ), () => ( {
|
|
32
47
|
__esModule: true,
|
|
33
48
|
default: ( props ) => {
|
|
34
49
|
mockPanelRecorder.calls.push( [ 'typography', props ] );
|
|
@@ -36,7 +51,7 @@ jest.mock( '../../components/global-styles/typography-panel', () => ( {
|
|
|
36
51
|
},
|
|
37
52
|
useHasTypographyPanel: () => true,
|
|
38
53
|
} ) );
|
|
39
|
-
|
|
54
|
+
vi.mock( import( '../../components/global-styles/color-panel' ), () => ( {
|
|
40
55
|
__esModule: true,
|
|
41
56
|
default: ( { children, ...rest } ) => {
|
|
42
57
|
mockPanelRecorder.calls.push( [ 'color', rest ] );
|
|
@@ -44,7 +59,7 @@ jest.mock( '../../components/global-styles/color-panel', () => ( {
|
|
|
44
59
|
},
|
|
45
60
|
useHasColorPanel: () => true,
|
|
46
61
|
} ) );
|
|
47
|
-
|
|
62
|
+
vi.mock( import( '../../components/global-styles/border-panel' ), () => ( {
|
|
48
63
|
__esModule: true,
|
|
49
64
|
default: ( props ) => {
|
|
50
65
|
mockPanelRecorder.calls.push( [ 'border', props ] );
|
|
@@ -53,7 +68,7 @@ jest.mock( '../../components/global-styles/border-panel', () => ( {
|
|
|
53
68
|
useHasBorderPanel: () => true,
|
|
54
69
|
useHasBorderPanelControls: () => ( {} ),
|
|
55
70
|
} ) );
|
|
56
|
-
|
|
71
|
+
vi.mock( import( '../../components/global-styles/dimensions-panel' ), () => ( {
|
|
57
72
|
__esModule: true,
|
|
58
73
|
default: ( props ) => {
|
|
59
74
|
mockPanelRecorder.calls.push( [ 'dimensions', props ] );
|
|
@@ -61,7 +76,7 @@ jest.mock( '../../components/global-styles/dimensions-panel', () => ( {
|
|
|
61
76
|
},
|
|
62
77
|
useHasDimensionsPanel: () => true,
|
|
63
78
|
} ) );
|
|
64
|
-
|
|
79
|
+
vi.mock( import( '../../components/global-styles/background-panel' ), () => ( {
|
|
65
80
|
__esModule: true,
|
|
66
81
|
default: ( props ) => {
|
|
67
82
|
mockPanelRecorder.calls.push( [ 'background', props ] );
|
|
@@ -75,7 +90,7 @@ jest.mock( '../../components/global-styles/background-panel', () => ( {
|
|
|
75
90
|
// The Typography, Background and Elements wrappers now request a contrast
|
|
76
91
|
// warning (relocated color controls). The hook pulls the data store into its
|
|
77
92
|
// import graph, so stub it to a no-op for these wiring-only tests.
|
|
78
|
-
|
|
93
|
+
vi.mock( import( '../contrast-checker' ), () => ( {
|
|
79
94
|
__esModule: true,
|
|
80
95
|
default: () => undefined,
|
|
81
96
|
} ) );
|
|
@@ -83,9 +98,9 @@ jest.mock( '../contrast-checker', () => ( {
|
|
|
83
98
|
// Stub the minimal `@wordpress/data` surface the wrappers call into
|
|
84
99
|
// directly. The real store + persistence machinery is intentionally
|
|
85
100
|
// elided. The prop plumbing is testable with the mocked selector surface.
|
|
86
|
-
|
|
101
|
+
vi.mock( import( '@wordpress/data' ), () => ( {
|
|
87
102
|
__esModule: true,
|
|
88
|
-
useSelect:
|
|
103
|
+
useSelect: vi.fn(),
|
|
89
104
|
useDispatch: () => ( {} ),
|
|
90
105
|
useRegistry: () => ( {} ),
|
|
91
106
|
createSelector: ( fn ) => fn,
|
|
@@ -104,12 +119,12 @@ jest.mock( '@wordpress/data', () => ( {
|
|
|
104
119
|
withDispatch: () => ( c ) => c,
|
|
105
120
|
} ) );
|
|
106
121
|
|
|
107
|
-
|
|
122
|
+
vi.mock( import( '@wordpress/blocks' ), () => ( {
|
|
108
123
|
__esModule: true,
|
|
109
|
-
getBlockSupport:
|
|
110
|
-
hasBlockSupport:
|
|
111
|
-
getBlockType:
|
|
112
|
-
getBlockTypes:
|
|
124
|
+
getBlockSupport: vi.fn( () => undefined ),
|
|
125
|
+
hasBlockSupport: vi.fn( () => false ),
|
|
126
|
+
getBlockType: vi.fn( () => null ),
|
|
127
|
+
getBlockTypes: vi.fn( () => [] ),
|
|
113
128
|
store: { name: 'core/blocks' },
|
|
114
129
|
} ) );
|
|
115
130
|
|
|
@@ -119,14 +134,14 @@ jest.mock( '@wordpress/blocks', () => ( {
|
|
|
119
134
|
// not carry the private-API marker. Short-circuit to a passthrough so
|
|
120
135
|
// these tests can exercise the wrapper wiring without threading
|
|
121
136
|
// the full private-API handshake through every stub.
|
|
122
|
-
|
|
137
|
+
vi.mock( import( '@wordpress/private-apis' ), () => ( {
|
|
123
138
|
__esModule: true,
|
|
124
139
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules: () => ( {
|
|
125
140
|
lock: () => {},
|
|
126
|
-
unlock: (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
unlock: () => ( {
|
|
142
|
+
hideBlockInterface: () => undefined,
|
|
143
|
+
showBlockInterface: () => undefined,
|
|
144
|
+
} ),
|
|
130
145
|
} ),
|
|
131
146
|
} ) );
|
|
132
147
|
|
|
@@ -135,12 +150,12 @@ jest.mock( '@wordpress/private-apis', () => ( {
|
|
|
135
150
|
// is already mocked to a Proxy-driven stub and never actually touches
|
|
136
151
|
// the store. Providing a stub avoids the private-APIs unlock that
|
|
137
152
|
// the real `store/index.js` performs at module load.
|
|
138
|
-
|
|
153
|
+
vi.mock( import( '../../store' ), () => ( {
|
|
139
154
|
__esModule: true,
|
|
140
155
|
store: { name: 'core/block-editor' },
|
|
141
156
|
} ) );
|
|
142
157
|
|
|
143
|
-
|
|
158
|
+
vi.mock( import( '../../store/private-keys' ), () => ( {
|
|
144
159
|
__esModule: true,
|
|
145
160
|
globalStylesDataKey: Symbol( 'globalStylesDataKey' ),
|
|
146
161
|
globalStylesLinksDataKey: Symbol( 'globalStylesLinksDataKey' ),
|
|
@@ -149,14 +164,11 @@ jest.mock( '../../store/private-keys', () => ( {
|
|
|
149
164
|
|
|
150
165
|
// Short-circuit the block-editor components barrel (`../../components`),
|
|
151
166
|
// which pulls the data store into its import graph transitively.
|
|
152
|
-
|
|
153
|
-
'../../components',
|
|
154
|
-
() => new Proxy( {}, { get: () => () => null } )
|
|
155
|
-
);
|
|
167
|
+
vi.mock( import( '../../components' ), () => ( {} ) );
|
|
156
168
|
|
|
157
169
|
// `InspectorControls` is a slot-fill component with registry dependencies.
|
|
158
170
|
// Mock it to a passthrough div.
|
|
159
|
-
|
|
171
|
+
vi.mock( import( '../../components/inspector-controls' ), () => ( {
|
|
160
172
|
__esModule: true,
|
|
161
173
|
default: ( { children } ) => (
|
|
162
174
|
<div data-testid="inspector-controls">{ children }</div>
|
|
@@ -171,7 +183,6 @@ beforeEach( () => {
|
|
|
171
183
|
mockPanelRecorder.calls = [];
|
|
172
184
|
mockInheritedReturn.value = {};
|
|
173
185
|
mockUseSelectImpl.fn = () => undefined;
|
|
174
|
-
const { useSelect } = require( '@wordpress/data' );
|
|
175
186
|
useSelect.mockImplementation( ( mapSelect ) => {
|
|
176
187
|
// Feed mapSelect a synthetic `select()` that returns an object
|
|
177
188
|
// whose methods all yield what the current test configured.
|
|
@@ -190,9 +201,6 @@ beforeEach( () => {
|
|
|
190
201
|
|
|
191
202
|
describe( 'inspector hook wrappers thread inheritedValue into the panel', () => {
|
|
192
203
|
test( 'TypographyPanel calls useResolvedStyle with the block name and threads inheritedValue', () => {
|
|
193
|
-
// Imported inside the test so the `jest.mock` factories are
|
|
194
|
-
// applied before the wrapper's module graph is resolved.
|
|
195
|
-
const { TypographyPanel } = require( '../typography' );
|
|
196
204
|
mockUseSelectImpl.fn = () => ( {
|
|
197
205
|
style: { typography: { fontSize: '14px' } },
|
|
198
206
|
fontFamily: undefined,
|
|
@@ -230,7 +238,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
230
238
|
// and background color are wired through the Typography and Background
|
|
231
239
|
// wrappers and covered above/below.
|
|
232
240
|
test( 'ElementsEdit wires block-scoped Global Styles into the Color panel', () => {
|
|
233
|
-
const { ElementsEdit } = require( '../elements' );
|
|
234
241
|
mockUseSelectImpl.fn = () => ( {
|
|
235
242
|
style: undefined,
|
|
236
243
|
className: undefined,
|
|
@@ -258,7 +265,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
258
265
|
} );
|
|
259
266
|
|
|
260
267
|
test( 'BorderPanel threads a border-scoped inheritedValue into the panel', () => {
|
|
261
|
-
const { BorderPanel } = require( '../border' );
|
|
262
268
|
mockUseSelectImpl.fn = () => ( {
|
|
263
269
|
style: undefined,
|
|
264
270
|
borderColor: undefined,
|
|
@@ -286,7 +292,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
286
292
|
} );
|
|
287
293
|
|
|
288
294
|
test( 'DimensionsPanel threads spacing inheritedValue into the panel', () => {
|
|
289
|
-
const { DimensionsPanel } = require( '../dimensions' );
|
|
290
295
|
mockUseSelectImpl.fn = () => ( {
|
|
291
296
|
value: undefined,
|
|
292
297
|
className: undefined,
|
|
@@ -313,10 +318,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
313
318
|
} );
|
|
314
319
|
|
|
315
320
|
test( 'BackgroundImagePanel replaces its pre-feature partial wiring with a full inherited payload', () => {
|
|
316
|
-
const {
|
|
317
|
-
hasBlockSupport,
|
|
318
|
-
getBlockSupport,
|
|
319
|
-
} = require( '@wordpress/blocks' );
|
|
320
321
|
getBlockSupport.mockImplementation( ( _n, key ) => {
|
|
321
322
|
if ( key === 'background' ) {
|
|
322
323
|
return { backgroundImage: true };
|
|
@@ -325,7 +326,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
325
326
|
} );
|
|
326
327
|
hasBlockSupport.mockReturnValue( true );
|
|
327
328
|
|
|
328
|
-
const { BackgroundImagePanel } = require( '../background' );
|
|
329
329
|
mockUseSelectImpl.fn = () => ( {
|
|
330
330
|
style: undefined,
|
|
331
331
|
className: undefined,
|
|
@@ -352,7 +352,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
352
352
|
} );
|
|
353
353
|
|
|
354
354
|
test( 'wrappers forward the block className to useResolvedStyle', () => {
|
|
355
|
-
const { TypographyPanel } = require( '../typography' );
|
|
356
355
|
mockUseSelectImpl.fn = () => ( {
|
|
357
356
|
style: undefined,
|
|
358
357
|
fontFamily: undefined,
|
|
@@ -378,7 +377,6 @@ describe( 'inspector hook wrappers thread inheritedValue into the panel', () =>
|
|
|
378
377
|
} );
|
|
379
378
|
|
|
380
379
|
test( 'wrappers fall back to empty inheritedValue during hydration', () => {
|
|
381
|
-
const { TypographyPanel } = require( '../typography' );
|
|
382
380
|
mockUseSelectImpl.fn = () => ( {
|
|
383
381
|
style: undefined,
|
|
384
382
|
fontFamily: undefined,
|
package/src/layouts/flex.jsx
CHANGED
|
@@ -351,6 +351,13 @@ export default {
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
if ( orientation === 'horizontal' ) {
|
|
354
|
+
// `row` is the flex default, so the base layout never declares it.
|
|
355
|
+
// A viewport override that switches a vertical base layout to
|
|
356
|
+
// horizontal has to declare it explicitly, otherwise the base
|
|
357
|
+
// `flex-direction: column` keeps applying.
|
|
358
|
+
if ( hasViewportOverride( 'orientation' ) ) {
|
|
359
|
+
rules.push( 'flex-direction: row' );
|
|
360
|
+
}
|
|
354
361
|
if ( shouldOutputFlexAlignment && verticalAlignment ) {
|
|
355
362
|
rules.push( `align-items: ${ verticalAlignment }` );
|
|
356
363
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
|
|
4
5
|
import constrained from '../constrained';
|
|
5
6
|
|
|
7
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
8
|
+
|
|
6
9
|
const ConstrainedLayoutInspectorControls = constrained.inspectorControls;
|
|
7
10
|
const PANEL_ID = 'test-panel';
|
|
8
11
|
|
|
9
12
|
function renderInspectorControls( props = {} ) {
|
|
10
13
|
return render(
|
|
11
|
-
<ToolsPanel label="Layout" resetAll={
|
|
14
|
+
<ToolsPanel label="Layout" resetAll={ vi.fn() } panelId={ PANEL_ID }>
|
|
12
15
|
<ConstrainedLayoutInspectorControls
|
|
13
16
|
clientId={ PANEL_ID }
|
|
14
17
|
layout={ {} }
|
|
15
|
-
onChange={
|
|
18
|
+
onChange={ vi.fn() }
|
|
16
19
|
{ ...props }
|
|
17
20
|
/>
|
|
18
21
|
</ToolsPanel>
|
|
@@ -100,7 +103,7 @@ describe( 'ConstrainedLayoutInspectorControls', () => {
|
|
|
100
103
|
'preserves a cleared %s value for viewport layout overrides',
|
|
101
104
|
async ( label, layoutKey ) => {
|
|
102
105
|
const user = userEvent.setup();
|
|
103
|
-
const onChange =
|
|
106
|
+
const onChange = vi.fn();
|
|
104
107
|
renderInspectorControls( {
|
|
105
108
|
layout: { type: 'constrained', [ layoutKey ]: '800px' },
|
|
106
109
|
resetLayout: { type: 'constrained', [ layoutKey ]: '800px' },
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
|
|
4
5
|
import flex from '../flex';
|
|
5
6
|
|
|
7
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
8
|
+
|
|
9
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
10
|
+
|
|
6
11
|
const FlexLayoutInspectorControls = flex.inspectorControls;
|
|
7
12
|
const PANEL_ID = 'test-panel';
|
|
8
13
|
|
|
9
14
|
function renderInspectorControls( props = {} ) {
|
|
10
15
|
return render(
|
|
11
|
-
<ToolsPanel label="Layout" resetAll={
|
|
16
|
+
<ToolsPanel label="Layout" resetAll={ vi.fn() } panelId={ PANEL_ID }>
|
|
12
17
|
<FlexLayoutInspectorControls
|
|
13
18
|
clientId={ PANEL_ID }
|
|
14
19
|
layout={ {} }
|
|
15
|
-
onChange={
|
|
20
|
+
onChange={ vi.fn() }
|
|
16
21
|
{ ...props }
|
|
17
22
|
/>
|
|
18
23
|
</ToolsPanel>
|
|
@@ -34,6 +39,51 @@ describe( 'getLayoutStyle', () => {
|
|
|
34
39
|
|
|
35
40
|
expect( result ).toBe( expected );
|
|
36
41
|
} );
|
|
42
|
+
|
|
43
|
+
it( 'should output flex-direction row when a viewport override switches a vertical layout to horizontal', () => {
|
|
44
|
+
const result = flex.getLayoutStyle( {
|
|
45
|
+
selector: '.my-container',
|
|
46
|
+
layout: {
|
|
47
|
+
type: 'flex',
|
|
48
|
+
orientation: 'vertical',
|
|
49
|
+
flexWrap: 'nowrap',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
},
|
|
52
|
+
viewportOverrides: {
|
|
53
|
+
orientation: 'horizontal',
|
|
54
|
+
justifyContent: 'left',
|
|
55
|
+
},
|
|
56
|
+
style: {},
|
|
57
|
+
blockName: 'test-block',
|
|
58
|
+
hasBlockGapSupport: false,
|
|
59
|
+
layoutDefinitions: undefined,
|
|
60
|
+
} );
|
|
61
|
+
|
|
62
|
+
expect( result ).toBe(
|
|
63
|
+
'.my-container {\n\t\t\t\tflex-direction: row; justify-content: flex-start;\n\t\t\t}'
|
|
64
|
+
);
|
|
65
|
+
} );
|
|
66
|
+
|
|
67
|
+
it( 'should keep flex-direction implicit when a viewport override does not change a horizontal orientation', () => {
|
|
68
|
+
const result = flex.getLayoutStyle( {
|
|
69
|
+
selector: '.my-container',
|
|
70
|
+
layout: {
|
|
71
|
+
type: 'flex',
|
|
72
|
+
orientation: 'horizontal',
|
|
73
|
+
justifyContent: 'left',
|
|
74
|
+
},
|
|
75
|
+
viewportOverrides: {
|
|
76
|
+
justifyContent: 'right',
|
|
77
|
+
},
|
|
78
|
+
style: {},
|
|
79
|
+
blockName: 'test-block',
|
|
80
|
+
hasBlockGapSupport: false,
|
|
81
|
+
layoutDefinitions: undefined,
|
|
82
|
+
} );
|
|
83
|
+
|
|
84
|
+
expect( result ).not.toContain( 'flex-direction' );
|
|
85
|
+
expect( result ).toContain( 'justify-content: flex-end' );
|
|
86
|
+
} );
|
|
37
87
|
} );
|
|
38
88
|
|
|
39
89
|
describe( 'FlexLayoutInspectorControls', () => {
|