@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, test, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { click } from '@ariakit/test';
|
|
3
4
|
import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
|
|
@@ -7,6 +8,8 @@ import {
|
|
|
7
8
|
InheritanceToolsPanelItem,
|
|
8
9
|
} from '../';
|
|
9
10
|
|
|
11
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
12
|
+
|
|
10
13
|
describe( 'InheritanceResetButton', () => {
|
|
11
14
|
test( 'renders an always-visible reset button labelled for the inherited value', () => {
|
|
12
15
|
render( <InheritanceResetButton onResetToInherited={ () => {} } /> );
|
|
@@ -18,7 +21,7 @@ describe( 'InheritanceResetButton', () => {
|
|
|
18
21
|
} );
|
|
19
22
|
|
|
20
23
|
test( 'invokes the reset handler when activated', async () => {
|
|
21
|
-
const onResetToInherited =
|
|
24
|
+
const onResetToInherited = vi.fn();
|
|
22
25
|
render(
|
|
23
26
|
<InheritanceResetButton onResetToInherited={ onResetToInherited } />
|
|
24
27
|
);
|
|
@@ -230,7 +233,7 @@ describe( 'InheritanceToolsPanelItem local-override reset dot', () => {
|
|
|
230
233
|
} );
|
|
231
234
|
|
|
232
235
|
test( 'the reset dot invokes the deselect handler', async () => {
|
|
233
|
-
const onDeselect =
|
|
236
|
+
const onDeselect = vi.fn();
|
|
234
237
|
renderItem( { hasLocalOverride: true, onDeselect } );
|
|
235
238
|
await click(
|
|
236
239
|
screen.getByRole( 'button', { name: 'Reset to inherited value' } )
|
package/src/components/global-styles/test/{background-panel.jsx → background-panel.jsdom.test.jsx}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterEach, beforeEach, 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 BackgroundPanel, {
|
|
@@ -7,6 +8,10 @@ import BackgroundPanel, {
|
|
|
7
8
|
hasLegacyColorGradientValue,
|
|
8
9
|
} from '../background-panel';
|
|
9
10
|
|
|
11
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
12
|
+
|
|
13
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
14
|
+
|
|
10
15
|
// The inheritance treatment sits behind the
|
|
11
16
|
// `gutenberg-global-styles-inheritance-ui` experiment. Turn it on so these
|
|
12
17
|
// tests exercise the inheriting path.
|
|
@@ -165,7 +170,7 @@ describe( 'BackgroundPanel — duplicate gradient preset slug identity', () => {
|
|
|
165
170
|
|
|
166
171
|
it( 'commits the inherited preset slug when accepting the preselected inherited gradient', async () => {
|
|
167
172
|
const user = userEvent.setup();
|
|
168
|
-
const onChange =
|
|
173
|
+
const onChange = vi.fn();
|
|
169
174
|
|
|
170
175
|
render(
|
|
171
176
|
<BackgroundPanel
|
|
@@ -202,7 +207,7 @@ describe( 'BackgroundPanel — duplicate gradient preset slug identity', () => {
|
|
|
202
207
|
} }
|
|
203
208
|
inheritedValue={ {} }
|
|
204
209
|
settings={ duplicateGradientSettings }
|
|
205
|
-
onChange={
|
|
210
|
+
onChange={ vi.fn() }
|
|
206
211
|
panelId="test-panel"
|
|
207
212
|
/>
|
|
208
213
|
);
|
|
@@ -256,7 +261,7 @@ describe( 'BackgroundPanel — inherited Global Styles label treatment', () => {
|
|
|
256
261
|
'linear-gradient(135deg, rgb(74, 0, 224) 0%, rgb(142, 45, 226) 100%)',
|
|
257
262
|
},
|
|
258
263
|
};
|
|
259
|
-
const onChange =
|
|
264
|
+
const onChange = vi.fn();
|
|
260
265
|
|
|
261
266
|
render(
|
|
262
267
|
<BackgroundPanel
|
|
@@ -322,7 +327,7 @@ describe( 'BackgroundPanel — inherited Global Styles label treatment', () => {
|
|
|
322
327
|
},
|
|
323
328
|
},
|
|
324
329
|
};
|
|
325
|
-
const onChange =
|
|
330
|
+
const onChange = vi.fn();
|
|
326
331
|
|
|
327
332
|
render(
|
|
328
333
|
<BackgroundPanel
|
|
@@ -365,7 +370,7 @@ describe( 'BackgroundPanel — inherited Global Styles label treatment', () => {
|
|
|
365
370
|
},
|
|
366
371
|
},
|
|
367
372
|
};
|
|
368
|
-
const onChange =
|
|
373
|
+
const onChange = vi.fn();
|
|
369
374
|
|
|
370
375
|
render(
|
|
371
376
|
<BackgroundPanel
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { afterEach, beforeEach, 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 BorderPanel from '../border-panel';
|
|
4
5
|
|
|
6
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
+
|
|
5
8
|
// The inheritance treatment sits behind the
|
|
6
9
|
// `gutenberg-global-styles-inheritance-ui` experiment. Turn it on so these
|
|
7
10
|
// tests exercise the inheriting path.
|
|
@@ -53,6 +56,103 @@ const settingsAll = {
|
|
|
53
56
|
},
|
|
54
57
|
};
|
|
55
58
|
|
|
59
|
+
const shadowOnlySettings = { shadow: settingsAll.shadow };
|
|
60
|
+
const borderOnlySettings = { border: settingsAll.border };
|
|
61
|
+
|
|
62
|
+
describe( 'BorderPanel — panel and control labels', () => {
|
|
63
|
+
it( 'titles the panel "Borders" when border and shadow controls are available', () => {
|
|
64
|
+
render(
|
|
65
|
+
<BorderPanel
|
|
66
|
+
value={ {} }
|
|
67
|
+
settings={ settingsAll }
|
|
68
|
+
onChange={ () => {} }
|
|
69
|
+
panelId="test-panel"
|
|
70
|
+
/>
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
expect(
|
|
74
|
+
screen.getByRole( 'heading', { name: 'Borders' } )
|
|
75
|
+
).toBeInTheDocument();
|
|
76
|
+
} );
|
|
77
|
+
|
|
78
|
+
it( 'titles the panel "Borders" when only a shadow control is available', () => {
|
|
79
|
+
// A shadow is treated as a soft border, so the title does not change
|
|
80
|
+
// with whichever controls a theme or block opts into. A stable title
|
|
81
|
+
// is what lets each control keep its own visible label.
|
|
82
|
+
render(
|
|
83
|
+
<BorderPanel
|
|
84
|
+
value={ {} }
|
|
85
|
+
settings={ shadowOnlySettings }
|
|
86
|
+
onChange={ () => {} }
|
|
87
|
+
panelId="test-panel"
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
expect(
|
|
92
|
+
screen.getByRole( 'heading', { name: 'Borders' } )
|
|
93
|
+
).toBeInTheDocument();
|
|
94
|
+
} );
|
|
95
|
+
|
|
96
|
+
it( 'labels the border control, and puts its unlink toggle in that label row, when no shadow control is available', () => {
|
|
97
|
+
// The case that motivated the change: with no Shadow control to
|
|
98
|
+
// disambiguate it from, the Border label used to be hidden, which left
|
|
99
|
+
// its unlink toggle beside the inputs while the Radius one sat in a
|
|
100
|
+
// label row. Both now share the same layout.
|
|
101
|
+
render(
|
|
102
|
+
<BorderPanel
|
|
103
|
+
value={ {} }
|
|
104
|
+
settings={ borderOnlySettings }
|
|
105
|
+
onChange={ () => {} }
|
|
106
|
+
panelId="test-panel"
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
expect( screen.getByText( 'Border' ) ).toBeInTheDocument();
|
|
111
|
+
|
|
112
|
+
// `getAllByRole` returns document order, so the toggle preceding the
|
|
113
|
+
// border color/style picker is what places it in the label row rather
|
|
114
|
+
// than alongside the inputs.
|
|
115
|
+
const buttons = screen.getAllByRole( 'button' );
|
|
116
|
+
expect(
|
|
117
|
+
buttons.indexOf( screen.getByLabelText( 'Unlink sides' ) )
|
|
118
|
+
).toBeLessThan(
|
|
119
|
+
buttons.indexOf(
|
|
120
|
+
screen.getByLabelText( /Border color( and style)* picker/ )
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
} );
|
|
124
|
+
|
|
125
|
+
it( 'labels the border control when the inheritance indicators are off', () => {
|
|
126
|
+
// Global Styles renders the panel without the inheritance treatment.
|
|
127
|
+
// That used to be the other half of the condition hiding the label, so
|
|
128
|
+
// a border-only panel showed no label there either.
|
|
129
|
+
render(
|
|
130
|
+
<BorderPanel
|
|
131
|
+
value={ {} }
|
|
132
|
+
settings={ borderOnlySettings }
|
|
133
|
+
onChange={ () => {} }
|
|
134
|
+
panelId="test-panel"
|
|
135
|
+
showInheritanceLabelIndicators={ false }
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
expect( screen.getByText( 'Border' ) ).toBeInTheDocument();
|
|
140
|
+
} );
|
|
141
|
+
|
|
142
|
+
it( 'labels the shadow control even when no border control is available', () => {
|
|
143
|
+
render(
|
|
144
|
+
<BorderPanel
|
|
145
|
+
value={ {} }
|
|
146
|
+
settings={ shadowOnlySettings }
|
|
147
|
+
onChange={ () => {} }
|
|
148
|
+
panelId="test-panel"
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
expect( screen.getByText( 'Shadow' ) ).toBeInTheDocument();
|
|
153
|
+
} );
|
|
154
|
+
} );
|
|
155
|
+
|
|
56
156
|
describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
57
157
|
describe( 'Border radius (input archetype)', () => {
|
|
58
158
|
it( 'renders an inherited string radius as the displayed value when local is empty', () => {
|
|
@@ -125,7 +225,7 @@ describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
|
125
225
|
} );
|
|
126
226
|
|
|
127
227
|
it( 'does not invoke onChange on mount when only an inherited radius is present (display-without-commit)', () => {
|
|
128
|
-
const onChange =
|
|
228
|
+
const onChange = vi.fn();
|
|
129
229
|
const inheritedValue = { border: { radius: '8px' } };
|
|
130
230
|
|
|
131
231
|
render(
|
|
@@ -143,7 +243,7 @@ describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
|
143
243
|
|
|
144
244
|
it( 'commits a typed local radius override without copying any inherited values (strip-not-copy)', async () => {
|
|
145
245
|
const user = userEvent.setup();
|
|
146
|
-
const onChange =
|
|
246
|
+
const onChange = vi.fn();
|
|
147
247
|
const inheritedValue = {
|
|
148
248
|
border: { radius: '8px' },
|
|
149
249
|
shadow: 'var:preset|shadow|soft',
|
|
@@ -172,7 +272,7 @@ describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
|
172
272
|
|
|
173
273
|
it( 'does not bake the inherited border color/style/width into the local override when only a radius is set', async () => {
|
|
174
274
|
const user = userEvent.setup();
|
|
175
|
-
const onChange =
|
|
275
|
+
const onChange = vi.fn();
|
|
176
276
|
const inheritedValue = {
|
|
177
277
|
border: {
|
|
178
278
|
color: '#000000',
|
|
@@ -252,7 +352,7 @@ describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
|
252
352
|
// renders the blue dot) even though the user never
|
|
253
353
|
// customised the radius.
|
|
254
354
|
const user = userEvent.setup();
|
|
255
|
-
const onChange =
|
|
355
|
+
const onChange = vi.fn();
|
|
256
356
|
const inheritedValue = {
|
|
257
357
|
border: {
|
|
258
358
|
color: '#000000',
|
|
@@ -289,7 +389,7 @@ describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
|
289
389
|
} );
|
|
290
390
|
|
|
291
391
|
it( 'does not invoke onChange on mount when only an inherited border is present', () => {
|
|
292
|
-
const onChange =
|
|
392
|
+
const onChange = vi.fn();
|
|
293
393
|
const inheritedValue = {
|
|
294
394
|
border: {
|
|
295
395
|
color: '#000000',
|
|
@@ -337,7 +437,7 @@ describe( 'BorderPanel — inherited Global Styles label treatment', () => {
|
|
|
337
437
|
} );
|
|
338
438
|
|
|
339
439
|
it( 'does not invoke onChange on mount when only an inherited shadow is present', () => {
|
|
340
|
-
const onChange =
|
|
440
|
+
const onChange = vi.fn();
|
|
341
441
|
const inheritedValue = {
|
|
342
442
|
shadow: 'var:preset|shadow|soft',
|
|
343
443
|
};
|
|
@@ -463,7 +563,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
463
563
|
|
|
464
564
|
it( 'persists a theme preset as a preset reference when custom presets also exist', async () => {
|
|
465
565
|
const user = userEvent.setup();
|
|
466
|
-
const onChange =
|
|
566
|
+
const onChange = vi.fn();
|
|
467
567
|
|
|
468
568
|
render(
|
|
469
569
|
<BorderPanel
|
|
@@ -487,7 +587,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
487
587
|
|
|
488
588
|
it( 'persists a default preset as a preset reference when custom presets also exist', async () => {
|
|
489
589
|
const user = userEvent.setup();
|
|
490
|
-
const onChange =
|
|
590
|
+
const onChange = vi.fn();
|
|
491
591
|
|
|
492
592
|
render(
|
|
493
593
|
<BorderPanel
|
|
@@ -511,7 +611,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
511
611
|
|
|
512
612
|
it( 'persists a custom preset as a preset reference', async () => {
|
|
513
613
|
const user = userEvent.setup();
|
|
514
|
-
const onChange =
|
|
614
|
+
const onChange = vi.fn();
|
|
515
615
|
|
|
516
616
|
render(
|
|
517
617
|
<BorderPanel
|
|
@@ -535,7 +635,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
535
635
|
|
|
536
636
|
it( 'persists the unset entry as a literal value, not a preset reference', async () => {
|
|
537
637
|
const user = userEvent.setup();
|
|
538
|
-
const onChange =
|
|
638
|
+
const onChange = vi.fn();
|
|
539
639
|
|
|
540
640
|
render(
|
|
541
641
|
<BorderPanel
|
|
@@ -556,7 +656,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
556
656
|
|
|
557
657
|
it( 'does not reference default presets the theme has opted out of', async () => {
|
|
558
658
|
const user = userEvent.setup();
|
|
559
|
-
const onChange =
|
|
659
|
+
const onChange = vi.fn();
|
|
560
660
|
|
|
561
661
|
render(
|
|
562
662
|
<BorderPanel
|
|
@@ -591,7 +691,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
591
691
|
|
|
592
692
|
it( 'offers only the most specific preset when a slug is defined twice', async () => {
|
|
593
693
|
const user = userEvent.setup();
|
|
594
|
-
const onChange =
|
|
694
|
+
const onChange = vi.fn();
|
|
595
695
|
|
|
596
696
|
// Custom preset slugs are generated as `shadow-<n>` from the custom
|
|
597
697
|
// presets alone, so they can collide with a theme preset's slug.
|
|
@@ -637,7 +737,7 @@ describe( 'BorderPanel — shadow preset persistence', () => {
|
|
|
637
737
|
|
|
638
738
|
it( 'references the most specific origin when two presets share a value', async () => {
|
|
639
739
|
const user = userEvent.setup();
|
|
640
|
-
const onChange =
|
|
740
|
+
const onChange = vi.fn();
|
|
641
741
|
|
|
642
742
|
// A custom preset starts out with the same value as the `natural`
|
|
643
743
|
// default one, so this is the state right after adding one.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
1
2
|
import { render, renderHook, screen } from '@testing-library/react';
|
|
2
3
|
import { click, render as renderAriakit } from '@ariakit/test/react';
|
|
3
4
|
import ColorPanel, {
|
|
@@ -10,6 +11,10 @@ import ColorPanel, {
|
|
|
10
11
|
useHasCaptionPanel,
|
|
11
12
|
} from '../color-panel';
|
|
12
13
|
|
|
14
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
15
|
+
|
|
16
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
17
|
+
|
|
13
18
|
// The inheritance treatment sits behind the
|
|
14
19
|
// `gutenberg-global-styles-inheritance-ui` experiment. Turn it on so these
|
|
15
20
|
// tests exercise the inheriting path.
|
package/src/components/global-styles/test/{dimensions-panel.jsx → dimensions-panel.jsdom.test.jsx}
RENAMED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import { render, screen, within } from '@testing-library/react';
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { fireEvent, render, screen, within } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
4
5
|
import DimensionsPanel from '../dimensions-panel';
|
|
5
6
|
|
|
7
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
8
|
+
|
|
6
9
|
// The inheritance treatment sits behind the
|
|
7
10
|
// `gutenberg-global-styles-inheritance-ui` experiment. Turn it on so these
|
|
8
11
|
// tests exercise the inheriting path.
|
|
@@ -19,11 +22,11 @@ afterEach( () => {
|
|
|
19
22
|
// full set of inherited and selectable ratios without spinning up a
|
|
20
23
|
// store registry. Per-call resolution lets the same mock answer all
|
|
21
24
|
// of the paths the tool requests on a single render.
|
|
22
|
-
|
|
23
|
-
const actual =
|
|
25
|
+
vi.mock( import( '../../use-settings' ), async ( importOriginal ) => {
|
|
26
|
+
const actual = await importOriginal();
|
|
24
27
|
return {
|
|
25
28
|
...actual,
|
|
26
|
-
useSettings:
|
|
29
|
+
useSettings: vi.fn( ( ...paths ) =>
|
|
27
30
|
paths.map( ( path ) => {
|
|
28
31
|
switch ( path ) {
|
|
29
32
|
case 'dimensions.aspectRatios.default':
|
|
@@ -247,7 +250,7 @@ describe( 'DimensionsPanel — per-control placeholder pattern', () => {
|
|
|
247
250
|
|
|
248
251
|
it( 'commits a local contentSize override on user input without copying any inherited value into other paths (strip-not-copy)', async () => {
|
|
249
252
|
const user = userEvent.setup();
|
|
250
|
-
const onChange =
|
|
253
|
+
const onChange = vi.fn();
|
|
251
254
|
|
|
252
255
|
renderPanel( {
|
|
253
256
|
value: {},
|
|
@@ -540,7 +543,7 @@ describe( 'DimensionsPanel — per-control placeholder pattern', () => {
|
|
|
540
543
|
} );
|
|
541
544
|
|
|
542
545
|
it( 'does not call `onChange` on mount of an at-rest minHeight', () => {
|
|
543
|
-
const onChange =
|
|
546
|
+
const onChange = vi.fn();
|
|
544
547
|
renderPanel( {
|
|
545
548
|
value: {},
|
|
546
549
|
inheritedValue: { dimensions: { minHeight: '320px' } },
|
|
@@ -553,7 +556,7 @@ describe( 'DimensionsPanel — per-control placeholder pattern', () => {
|
|
|
553
556
|
|
|
554
557
|
it( 'commits a local minHeight override on user input without copying any inherited value into other paths', async () => {
|
|
555
558
|
const user = userEvent.setup();
|
|
556
|
-
const onChange =
|
|
559
|
+
const onChange = vi.fn();
|
|
557
560
|
|
|
558
561
|
renderPanel( {
|
|
559
562
|
value: {},
|
|
@@ -612,7 +615,7 @@ describe( 'DimensionsPanel — per-control placeholder pattern', () => {
|
|
|
612
615
|
} );
|
|
613
616
|
|
|
614
617
|
it( 'does not call `onChange` on mount of an at-rest aspectRatio', () => {
|
|
615
|
-
const onChange =
|
|
618
|
+
const onChange = vi.fn();
|
|
616
619
|
renderPanel( {
|
|
617
620
|
value: {},
|
|
618
621
|
inheritedValue: { dimensions: { aspectRatio: '16/9' } },
|
|
@@ -625,7 +628,7 @@ describe( 'DimensionsPanel — per-control placeholder pattern', () => {
|
|
|
625
628
|
|
|
626
629
|
it( 'commits a local aspectRatio override on user selection of a different option without copying any inherited value into other paths', async () => {
|
|
627
630
|
const user = userEvent.setup();
|
|
628
|
-
const onChange =
|
|
631
|
+
const onChange = vi.fn();
|
|
629
632
|
|
|
630
633
|
renderPanel( {
|
|
631
634
|
value: {},
|
|
@@ -735,13 +738,10 @@ describe( 'DimensionsPanel — per-control placeholder pattern', () => {
|
|
|
735
738
|
} );
|
|
736
739
|
|
|
737
740
|
it( '(padding) commits to local on slider activation and the displayed value follows the new local value', () => {
|
|
738
|
-
const { fireEvent } = require( '@testing-library/react' );
|
|
739
|
-
|
|
740
741
|
// Controlled wrapper so we can verify the slider follows local
|
|
741
742
|
// value updates after onChange writes through.
|
|
742
743
|
function Wrapper() {
|
|
743
|
-
const [ value, setValue ] =
|
|
744
|
-
require( '@wordpress/element' ).useState( {} );
|
|
744
|
+
const [ value, setValue ] = useState( {} );
|
|
745
745
|
return (
|
|
746
746
|
<DimensionsPanel
|
|
747
747
|
value={ value }
|
package/src/components/global-styles/test/{filters-panel.jsx → filters-panel.jsdom.test.jsx}
RENAMED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { afterEach, beforeEach, 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 FiltersPanel from '../filters-panel';
|
|
4
5
|
|
|
6
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
+
|
|
5
8
|
// The inheritance treatment sits behind the
|
|
6
9
|
// `gutenberg-global-styles-inheritance-ui` experiment. Turn it on so these
|
|
7
10
|
// tests exercise the inheriting path.
|
|
@@ -101,7 +104,7 @@ describe( 'FiltersPanel — visual treatment and display-without-commit', () =>
|
|
|
101
104
|
} );
|
|
102
105
|
|
|
103
106
|
it( 'does not invoke onChange on mount when only inherited duotone is present (display-without-commit)', () => {
|
|
104
|
-
const onChange =
|
|
107
|
+
const onChange = vi.fn();
|
|
105
108
|
const inheritedValue = {
|
|
106
109
|
filter: { duotone: [ '#000000', '#ffffff' ] },
|
|
107
110
|
};
|
|
@@ -121,7 +124,7 @@ describe( 'FiltersPanel — visual treatment and display-without-commit', () =>
|
|
|
121
124
|
|
|
122
125
|
it( 'commits the inherited value when the user clicks the preselected duotone preset', async () => {
|
|
123
126
|
const user = userEvent.setup();
|
|
124
|
-
const onChange =
|
|
127
|
+
const onChange = vi.fn();
|
|
125
128
|
const inheritedValue = {
|
|
126
129
|
filter: { duotone: [ '#000000', '#ffffff' ] },
|
|
127
130
|
};
|
|
@@ -167,7 +170,7 @@ describe( 'FiltersPanel — visual treatment and display-without-commit', () =>
|
|
|
167
170
|
} );
|
|
168
171
|
|
|
169
172
|
it( 'does not invoke onChange on mount when a local duotone is set (no spurious commit)', () => {
|
|
170
|
-
const onChange =
|
|
173
|
+
const onChange = vi.fn();
|
|
171
174
|
const value = {
|
|
172
175
|
filter: { duotone: [ '#8c00b7', '#fcff41' ] },
|
|
173
176
|
};
|
|
@@ -247,7 +250,7 @@ describe( 'FiltersPanel — duplicate duotone presets', () => {
|
|
|
247
250
|
|
|
248
251
|
it( 'saves the slug of the preset that was picked', async () => {
|
|
249
252
|
const user = userEvent.setup();
|
|
250
|
-
const onChange =
|
|
253
|
+
const onChange = vi.fn();
|
|
251
254
|
|
|
252
255
|
render(
|
|
253
256
|
<FiltersPanel
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { renderHook } from '@testing-library/react';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import { useResolvedStyle } from '../inherited-value-context';
|
|
@@ -19,28 +20,28 @@ afterEach( () => {
|
|
|
19
20
|
|
|
20
21
|
// Only `useSelect` is called by the hook. The other four are needed at import
|
|
21
22
|
// time by the store modules this file pulls in transitively.
|
|
22
|
-
|
|
23
|
-
useSelect:
|
|
24
|
-
register:
|
|
25
|
-
createReduxStore:
|
|
26
|
-
createSelector:
|
|
27
|
-
combineReducers:
|
|
23
|
+
vi.mock( import( '@wordpress/data' ), () => ( {
|
|
24
|
+
useSelect: vi.fn(),
|
|
25
|
+
register: vi.fn(),
|
|
26
|
+
createReduxStore: vi.fn(),
|
|
27
|
+
createSelector: vi.fn( ( callback ) => callback ),
|
|
28
|
+
combineReducers: vi.fn( ( reducers ) => reducers ),
|
|
28
29
|
} ) );
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
vi.mock( import( '../../../store' ), () => ( {
|
|
31
32
|
store: { name: 'core/block-editor' },
|
|
32
33
|
} ) );
|
|
33
34
|
|
|
34
35
|
// `inherited-value-context.jsx` imports the blocks store for
|
|
35
36
|
// `useVariationAndElements`. Its real import chain needs data-module exports
|
|
36
37
|
// the stub above does not provide, so stub the blocks module too.
|
|
37
|
-
|
|
38
|
+
vi.mock( import( '@wordpress/blocks' ), () => ( {
|
|
38
39
|
store: { name: 'core/blocks' },
|
|
39
40
|
getBlockType: ( blockName ) =>
|
|
40
41
|
( { 'core/heading': { title: 'Heading' } } )[ blockName ],
|
|
41
42
|
} ) );
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
vi.mock( import( '../../../hooks/block-style-variation' ), () => ( {
|
|
44
45
|
getVariationNameFromClass: ( className ) => {
|
|
45
46
|
const match = /is-style-([\w-]+)/.exec( className || '' );
|
|
46
47
|
return match ? match[ 1 ] : null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { useSelect } from '@wordpress/data';
|
|
3
4
|
import { useResolvedStyle } from '../inherited-value-context';
|
|
@@ -16,23 +17,23 @@ afterEach( () => {
|
|
|
16
17
|
delete window.__experimentalGlobalStylesInheritanceUI;
|
|
17
18
|
} );
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
useSelect:
|
|
21
|
-
useDispatch:
|
|
22
|
-
useRegistry:
|
|
23
|
-
createSelector:
|
|
24
|
-
createReduxStore:
|
|
25
|
-
createRegistry:
|
|
26
|
-
register:
|
|
27
|
-
select:
|
|
28
|
-
dispatch:
|
|
29
|
-
combineReducers:
|
|
30
|
-
subscribe:
|
|
20
|
+
vi.mock( import( '@wordpress/data' ), () => ( {
|
|
21
|
+
useSelect: vi.fn(),
|
|
22
|
+
useDispatch: vi.fn( () => ( {} ) ),
|
|
23
|
+
useRegistry: vi.fn( () => ( {} ) ),
|
|
24
|
+
createSelector: vi.fn( ( callback ) => callback ),
|
|
25
|
+
createReduxStore: vi.fn(),
|
|
26
|
+
createRegistry: vi.fn(),
|
|
27
|
+
register: vi.fn(),
|
|
28
|
+
select: vi.fn(),
|
|
29
|
+
dispatch: vi.fn(),
|
|
30
|
+
combineReducers: vi.fn( ( reducers ) => reducers ),
|
|
31
|
+
subscribe: vi.fn(),
|
|
31
32
|
RegistryProvider: ( { children } ) => children,
|
|
32
33
|
RegistryConsumer: ( { children } ) => children( {} ),
|
|
33
34
|
AsyncModeProvider: ( { children } ) => children,
|
|
34
|
-
useRegistrySelect:
|
|
35
|
-
useRegistryDispatch:
|
|
35
|
+
useRegistrySelect: vi.fn(),
|
|
36
|
+
useRegistryDispatch: vi.fn( () => ( {} ) ),
|
|
36
37
|
withSelect: ( mapStateToProps ) => ( Component ) => ( props ) =>
|
|
37
38
|
Component( {
|
|
38
39
|
...props,
|
|
@@ -42,7 +43,7 @@ jest.mock( '@wordpress/data', () => ( {
|
|
|
42
43
|
withRegistry: ( Component ) => Component,
|
|
43
44
|
} ) );
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
vi.mock( import( '../../../store' ), () => ( {
|
|
46
47
|
store: { name: 'core/block-editor' },
|
|
47
48
|
} ) );
|
|
48
49
|
|
|
@@ -51,7 +52,7 @@ jest.mock( '../../../store', () => ( {
|
|
|
51
52
|
// transitive import chain fails under this file's `@wordpress/data` mock
|
|
52
53
|
// (missing `createSelector`), so stub the blocks module with just the shape
|
|
53
54
|
// needed.
|
|
54
|
-
|
|
55
|
+
vi.mock( import( '@wordpress/blocks' ), () => ( {
|
|
55
56
|
store: { name: 'core/blocks' },
|
|
56
57
|
getBlockType: ( blockName ) =>
|
|
57
58
|
( {
|
|
@@ -65,7 +66,7 @@ jest.mock( '@wordpress/blocks', () => ( {
|
|
|
65
66
|
// `className`; map `is-style-<slug>` to `<slug>` for these tests. The
|
|
66
67
|
// variation-ref resolution itself now lives in `resolveStyle`
|
|
67
68
|
// (`@wordpress/global-styles-engine`) and is covered by its own tests.
|
|
68
|
-
|
|
69
|
+
vi.mock( import( '../../../hooks/block-style-variation' ), () => ( {
|
|
69
70
|
getVariationNameFromClass: ( className ) => {
|
|
70
71
|
const match = /is-style-([\w-]+)/.exec( className || '' );
|
|
71
72
|
return match ? match[ 1 ] : null;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import StateControlBadges from '../state-control-badges';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
const actual =
|
|
5
|
+
vi.mock( import( '@wordpress/ui' ), async ( importOriginal ) => {
|
|
6
|
+
const actual = await importOriginal();
|
|
6
7
|
|
|
7
8
|
return {
|
|
8
9
|
...actual,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { click, render as renderAriakit } from '@ariakit/test/react';
|
|
3
4
|
import TypographyPanel from '../typography-panel';
|
|
4
5
|
|
|
6
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
+
|
|
5
8
|
// Coverage for `TypographyPanel` with the `gutenberg-global-styles-inheritance-ui`
|
|
6
9
|
// experiment off, which is what WordPress Core gets. Deleted rather than set to
|
|
7
10
|
// `false`, because an experiment that was never turned on leaves the global
|
|
@@ -99,7 +102,7 @@ describe( 'TypographyPanel — experiment off', () => {
|
|
|
99
102
|
inheritedValue={ { color: { text: 'var:preset|color|red' } } }
|
|
100
103
|
settings={ PALETTE_SETTINGS }
|
|
101
104
|
panelId="test"
|
|
102
|
-
onChange={
|
|
105
|
+
onChange={ vi.fn() }
|
|
103
106
|
/>
|
|
104
107
|
);
|
|
105
108
|
|
|
@@ -116,7 +119,7 @@ describe( 'TypographyPanel — experiment off', () => {
|
|
|
116
119
|
|
|
117
120
|
describe( 'TypographyPanel — experiment off, setTextColor link sync', () => {
|
|
118
121
|
async function pickRed( value, inheritedValue ) {
|
|
119
|
-
const onChange =
|
|
122
|
+
const onChange = vi.fn();
|
|
120
123
|
await renderAriakit(
|
|
121
124
|
<TypographyPanel
|
|
122
125
|
value={ value }
|