@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,14 +1,20 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import userEvent from '@testing-library/user-event';
|
|
3
4
|
import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';
|
|
4
5
|
import ChildLayoutControl from '../';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
8
|
+
|
|
9
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
10
|
+
|
|
11
|
+
vi.mock( import( '../../use-settings' ), () => ( {
|
|
7
12
|
useSettings: () => [ undefined ],
|
|
8
13
|
} ) );
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
vi.mock( import( '@wordpress/data' ), async ( importOriginal ) => ( {
|
|
16
|
+
...( await importOriginal() ),
|
|
17
|
+
useSelect: vi.fn( ( mapSelect ) => {
|
|
12
18
|
if ( typeof mapSelect === 'function' ) {
|
|
13
19
|
return mapSelect( () => ( {
|
|
14
20
|
getBlockRootClientId: () => 'root-client-id',
|
|
@@ -19,19 +25,16 @@ jest.mock( '@wordpress/data/src/components/use-select', () =>
|
|
|
19
25
|
getBlockAttributes: () => ( {} ),
|
|
20
26
|
getBlockOrder: () => [],
|
|
21
27
|
};
|
|
22
|
-
} )
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
jest.mock( '@wordpress/data/src/components/use-dispatch', () => ( {
|
|
28
|
+
} ),
|
|
26
29
|
useDispatch: () => ( {
|
|
27
|
-
__unstableMarkNextChangeAsNotPersistent:
|
|
28
|
-
moveBlocksToPosition:
|
|
30
|
+
__unstableMarkNextChangeAsNotPersistent: vi.fn(),
|
|
31
|
+
moveBlocksToPosition: vi.fn(),
|
|
29
32
|
} ),
|
|
30
33
|
} ) );
|
|
31
34
|
|
|
32
35
|
describe( 'ChildLayoutControl', () => {
|
|
33
36
|
const baseProps = {
|
|
34
|
-
onChange:
|
|
37
|
+
onChange: vi.fn(),
|
|
35
38
|
parentLayout: {
|
|
36
39
|
type: 'grid',
|
|
37
40
|
},
|
|
@@ -40,14 +43,14 @@ describe( 'ChildLayoutControl', () => {
|
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
afterEach( () => {
|
|
43
|
-
|
|
46
|
+
vi.clearAllMocks();
|
|
44
47
|
} );
|
|
45
48
|
|
|
46
49
|
function renderControl( props ) {
|
|
47
50
|
return render(
|
|
48
51
|
<ToolsPanel
|
|
49
52
|
label="Dimensions"
|
|
50
|
-
resetAll={
|
|
53
|
+
resetAll={ vi.fn() }
|
|
51
54
|
panelId="client-id"
|
|
52
55
|
>
|
|
53
56
|
<ChildLayoutControl { ...baseProps } { ...props } />
|
|
@@ -96,7 +99,7 @@ describe( 'ChildLayoutControl', () => {
|
|
|
96
99
|
|
|
97
100
|
it( 'sets a numeric span when entering 1 into an empty span control', async () => {
|
|
98
101
|
const user = userEvent.setup();
|
|
99
|
-
const onChange =
|
|
102
|
+
const onChange = vi.fn();
|
|
100
103
|
|
|
101
104
|
renderControl( {
|
|
102
105
|
value: {},
|
|
@@ -134,7 +137,7 @@ describe( 'ChildLayoutControl', () => {
|
|
|
134
137
|
|
|
135
138
|
it( 'sets fixedNoShrink when selecting fixed flex sizing', async () => {
|
|
136
139
|
const user = userEvent.setup();
|
|
137
|
-
const onChange =
|
|
140
|
+
const onChange = vi.fn();
|
|
138
141
|
|
|
139
142
|
renderControl( {
|
|
140
143
|
parentLayout: {
|
|
@@ -155,7 +158,7 @@ describe( 'ChildLayoutControl', () => {
|
|
|
155
158
|
|
|
156
159
|
it( 'sets legacy fixed when selecting max sizing', async () => {
|
|
157
160
|
const user = userEvent.setup();
|
|
158
|
-
const onChange =
|
|
161
|
+
const onChange = vi.fn();
|
|
159
162
|
|
|
160
163
|
renderControl( {
|
|
161
164
|
parentLayout: {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
render,
|
|
4
|
+
screen,
|
|
5
|
+
waitFor,
|
|
6
|
+
queryByAttribute,
|
|
7
|
+
} from '@testing-library/react';
|
|
2
8
|
import ColorPaletteControl from '../control';
|
|
3
9
|
|
|
10
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
11
|
+
|
|
4
12
|
const noop = () => {};
|
|
5
13
|
|
|
6
14
|
async function renderAndValidate( ...renderArgs ) {
|
|
@@ -17,8 +25,8 @@ async function renderAndValidate( ...renderArgs ) {
|
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
describe( 'ColorPaletteControl', () => {
|
|
20
|
-
it( '
|
|
21
|
-
|
|
28
|
+
it( 'marks the selected color as active', async () => {
|
|
29
|
+
await renderAndValidate(
|
|
22
30
|
<ColorPaletteControl
|
|
23
31
|
label="Test Color"
|
|
24
32
|
value="#f00"
|
|
@@ -28,6 +36,9 @@ describe( 'ColorPaletteControl', () => {
|
|
|
28
36
|
/>
|
|
29
37
|
);
|
|
30
38
|
|
|
31
|
-
expect(
|
|
39
|
+
expect( screen.getByRole( 'option', { name: 'red' } ) ).toHaveAttribute(
|
|
40
|
+
'aria-selected',
|
|
41
|
+
'true'
|
|
42
|
+
);
|
|
32
43
|
} );
|
|
33
44
|
} );
|
|
@@ -1,3 +1,4 @@
|
|
|
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 { createCustomColorsHOC } from '../with-colors';
|
|
@@ -7,7 +8,7 @@ describe( 'createCustomColorsHOC', () => {
|
|
|
7
8
|
const withCustomColors = createCustomColorsHOC( [
|
|
8
9
|
{ name: 'Red', slug: 'red', color: 'ff0000' },
|
|
9
10
|
] );
|
|
10
|
-
const BaseComponent =
|
|
11
|
+
const BaseComponent = vi.fn( () => <div /> );
|
|
11
12
|
const EnhancedComponent =
|
|
12
13
|
withCustomColors( 'backgroundColor' )( BaseComponent );
|
|
13
14
|
|
|
@@ -46,7 +47,7 @@ describe( 'createCustomColorsHOC', () => {
|
|
|
46
47
|
)
|
|
47
48
|
);
|
|
48
49
|
|
|
49
|
-
const setAttributes =
|
|
50
|
+
const setAttributes = vi.fn();
|
|
50
51
|
|
|
51
52
|
render(
|
|
52
53
|
<EnhancedComponent
|
|
@@ -76,7 +77,7 @@ describe( 'createCustomColorsHOC', () => {
|
|
|
76
77
|
)
|
|
77
78
|
);
|
|
78
79
|
|
|
79
|
-
const setAttributes =
|
|
80
|
+
const setAttributes = vi.fn();
|
|
80
81
|
|
|
81
82
|
render(
|
|
82
83
|
<EnhancedComponent
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { screen } from '@testing-library/react';
|
|
2
3
|
import { click, render } from '@ariakit/test/react';
|
|
3
4
|
import ColorGradientControl from '../control';
|
|
4
5
|
|
|
6
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
+
|
|
8
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
9
|
+
|
|
5
10
|
const noop = () => {};
|
|
6
11
|
|
|
7
12
|
describe( 'ColorPaletteControl', () => {
|
|
@@ -160,7 +165,7 @@ describe( 'ColorPaletteControl', () => {
|
|
|
160
165
|
} );
|
|
161
166
|
|
|
162
167
|
it( 'calls onColorChange with (color, slug) when a swatch is clicked (color-only palette)', async () => {
|
|
163
|
-
const onColorChange =
|
|
168
|
+
const onColorChange = vi.fn();
|
|
164
169
|
|
|
165
170
|
await render(
|
|
166
171
|
<ColorGradientControl
|
|
@@ -183,8 +188,8 @@ describe( 'ColorPaletteControl', () => {
|
|
|
183
188
|
} );
|
|
184
189
|
|
|
185
190
|
it( 'calls onColorChange with (color, slug) and calls onGradientChange() when both colors and gradients are available', async () => {
|
|
186
|
-
const onColorChange =
|
|
187
|
-
const onGradientChange =
|
|
191
|
+
const onColorChange = vi.fn();
|
|
192
|
+
const onGradientChange = vi.fn();
|
|
188
193
|
|
|
189
194
|
await render(
|
|
190
195
|
<ColorGradientControl
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
|
1
2
|
import { render, screen } from '@testing-library/react';
|
|
2
3
|
import { speak } from '@wordpress/a11y';
|
|
3
4
|
import ContrastChecker from '../';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
vi.mock( import( '@wordpress/a11y' ), () => ( { speak: vi.fn() } ) );
|
|
6
7
|
|
|
7
8
|
describe( 'ContrastChecker', () => {
|
|
8
9
|
const backgroundColor = '#ffffff';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`DefaultBlockAppender should append a default block when input focused 1`] = `
|
|
3
|
+
exports[`DefaultBlockAppender > should append a default block when input focused 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
6
|
class="block-editor-default-block-appender has-visible-prompt"
|
|
@@ -18,7 +18,7 @@ exports[`DefaultBlockAppender should append a default block when input focused 1
|
|
|
18
18
|
</div>
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
|
-
exports[`DefaultBlockAppender should match snapshot 1`] = `
|
|
21
|
+
exports[`DefaultBlockAppender > should match snapshot 1`] = `
|
|
22
22
|
<div>
|
|
23
23
|
<div
|
|
24
24
|
class="block-editor-default-block-appender has-visible-prompt"
|
|
@@ -36,7 +36,7 @@ exports[`DefaultBlockAppender should match snapshot 1`] = `
|
|
|
36
36
|
</div>
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
|
-
exports[`DefaultBlockAppender should optionally show without prompt 1`] = `
|
|
39
|
+
exports[`DefaultBlockAppender > should optionally show without prompt 1`] = `
|
|
40
40
|
<div>
|
|
41
41
|
<div
|
|
42
42
|
class="block-editor-default-block-appender"
|
|
@@ -1,20 +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 DefaultBlockAppender, { ZWNBSP } from '../';
|
|
4
5
|
import * as blockEditorActions from '../../../store/actions';
|
|
5
6
|
import * as blockEditorSelectors from '../../../store/selectors';
|
|
6
|
-
|
|
7
|
-
const actions =
|
|
7
|
+
vi.mock( import( '../../../store/actions' ), async ( importOriginal ) => {
|
|
8
|
+
const actions = await importOriginal();
|
|
8
9
|
return {
|
|
9
10
|
...actions,
|
|
10
|
-
startTyping:
|
|
11
|
+
startTyping: vi.fn( actions.startTyping ),
|
|
11
12
|
};
|
|
12
13
|
} );
|
|
13
|
-
|
|
14
|
-
const selectors =
|
|
14
|
+
vi.mock( import( '../../../store/selectors' ), async ( importOriginal ) => {
|
|
15
|
+
const selectors = await importOriginal();
|
|
15
16
|
return {
|
|
16
17
|
...selectors,
|
|
17
|
-
getBlockCount:
|
|
18
|
+
getBlockCount: vi.fn( selectors.getBlockCount ),
|
|
18
19
|
};
|
|
19
20
|
} );
|
|
20
21
|
|
|
@@ -26,7 +27,7 @@ describe( 'DefaultBlockAppender', () => {
|
|
|
26
27
|
} );
|
|
27
28
|
|
|
28
29
|
it( 'should append a default block when input focused', async () => {
|
|
29
|
-
const startTyping =
|
|
30
|
+
const startTyping = vi.spyOn( blockEditorActions, 'startTyping' );
|
|
30
31
|
const user = userEvent.setup();
|
|
31
32
|
|
|
32
33
|
const { container } = render( <DefaultBlockAppender /> );
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { act, 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 { useEffect, useState } from '@wordpress/element';
|
|
5
6
|
import DimensionsTool from '../';
|
|
6
7
|
|
|
8
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
9
|
+
|
|
10
|
+
globalThis.wpVitest.mockResizeObserver();
|
|
11
|
+
|
|
7
12
|
const EMPTY_OBJECT = {};
|
|
8
13
|
const ASPECT_RATIO_OPTIONS = [
|
|
9
14
|
{ label: 'Original', value: 'auto' },
|
|
@@ -100,7 +105,7 @@ function ControlledExample( { value, onChange, ...props } ) {
|
|
|
100
105
|
describe( 'DimensionsTool', () => {
|
|
101
106
|
describe( 'controlled values', () => {
|
|
102
107
|
it( 'updates the aspect ratio control when the value prop changes', () => {
|
|
103
|
-
const onChange =
|
|
108
|
+
const onChange = vi.fn();
|
|
104
109
|
const { rerender } = render(
|
|
105
110
|
<ControlledExample
|
|
106
111
|
value={ { aspectRatio: '16/9' } }
|
|
@@ -131,7 +136,7 @@ describe( 'DimensionsTool', () => {
|
|
|
131
136
|
} );
|
|
132
137
|
|
|
133
138
|
it( 'displays an aspect ratio that is written differently to the option with the same ratio', () => {
|
|
134
|
-
const onChange =
|
|
139
|
+
const onChange = vi.fn();
|
|
135
140
|
const { rerender } = render(
|
|
136
141
|
<ControlledExample
|
|
137
142
|
value={ { aspectRatio: '1/1' } }
|
|
@@ -154,7 +159,7 @@ describe( 'DimensionsTool', () => {
|
|
|
154
159
|
} );
|
|
155
160
|
|
|
156
161
|
it( 'displays an aspect ratio without a matching option as custom', () => {
|
|
157
|
-
const onChange =
|
|
162
|
+
const onChange = vi.fn();
|
|
158
163
|
render(
|
|
159
164
|
<ControlledExample
|
|
160
165
|
value={ { aspectRatio: '7/5' } }
|
|
@@ -168,7 +173,7 @@ describe( 'DimensionsTool', () => {
|
|
|
168
173
|
} );
|
|
169
174
|
|
|
170
175
|
it( 'updates the scale control when the value prop changes', () => {
|
|
171
|
-
const onChange =
|
|
176
|
+
const onChange = vi.fn();
|
|
172
177
|
const { rerender } = render(
|
|
173
178
|
<ControlledExample
|
|
174
179
|
value={ { aspectRatio: '16/9', scale: 'cover' } }
|
|
@@ -196,7 +201,7 @@ describe( 'DimensionsTool', () => {
|
|
|
196
201
|
describe( 'external updates', () => {
|
|
197
202
|
it( 'restores the scale that was set externally', async () => {
|
|
198
203
|
const user = userEvent.setup();
|
|
199
|
-
const onChange =
|
|
204
|
+
const onChange = vi.fn();
|
|
200
205
|
const updateRef = { current: null };
|
|
201
206
|
|
|
202
207
|
render(
|
|
@@ -230,7 +235,7 @@ describe( 'DimensionsTool', () => {
|
|
|
230
235
|
|
|
231
236
|
it( 'restores the aspect ratio that was set externally', async () => {
|
|
232
237
|
const user = userEvent.setup();
|
|
233
|
-
const onChange =
|
|
238
|
+
const onChange = vi.fn();
|
|
234
239
|
const updateRef = { current: null };
|
|
235
240
|
|
|
236
241
|
render(
|
|
@@ -271,7 +276,7 @@ describe( 'DimensionsTool', () => {
|
|
|
271
276
|
describe( 'updating aspectRatio', () => {
|
|
272
277
|
it( 'when starting with empty initial state, setting aspectRatio also sets scale (0000) -> (1100)', async () => {
|
|
273
278
|
const user = userEvent.setup();
|
|
274
|
-
const onChange =
|
|
279
|
+
const onChange = vi.fn();
|
|
275
280
|
|
|
276
281
|
const initialValue = {
|
|
277
282
|
// aspectRatio,
|
|
@@ -311,7 +316,7 @@ describe( 'DimensionsTool', () => {
|
|
|
311
316
|
|
|
312
317
|
it( 'when starting with just height, setting aspectRatio also sets scale (0001) -> (1101)', async () => {
|
|
313
318
|
const user = userEvent.setup();
|
|
314
|
-
const onChange =
|
|
319
|
+
const onChange = vi.fn();
|
|
315
320
|
|
|
316
321
|
const initialValue = {
|
|
317
322
|
// aspectRatio,
|
|
@@ -351,7 +356,7 @@ describe( 'DimensionsTool', () => {
|
|
|
351
356
|
|
|
352
357
|
it( 'when starting with just width, setting aspectRatio also sets scale (0010) -> (1110)', async () => {
|
|
353
358
|
const user = userEvent.setup();
|
|
354
|
-
const onChange =
|
|
359
|
+
const onChange = vi.fn();
|
|
355
360
|
|
|
356
361
|
const initialValue = {
|
|
357
362
|
// aspectRatio,
|
|
@@ -391,7 +396,7 @@ describe( 'DimensionsTool', () => {
|
|
|
391
396
|
|
|
392
397
|
it( 'when starting with scale, width, and height, setting aspectRatio also clears height (0111) -> (1110)', async () => {
|
|
393
398
|
const user = userEvent.setup();
|
|
394
|
-
const onChange =
|
|
399
|
+
const onChange = vi.fn();
|
|
395
400
|
|
|
396
401
|
const initialValue = {
|
|
397
402
|
// aspectRatio,
|
|
@@ -431,7 +436,7 @@ describe( 'DimensionsTool', () => {
|
|
|
431
436
|
|
|
432
437
|
it( 'when starting with aspectRatio and scale, setting aspectRatio to "Original" also clears scale (1100) -> (0000)', async () => {
|
|
433
438
|
const user = userEvent.setup();
|
|
434
|
-
const onChange =
|
|
439
|
+
const onChange = vi.fn();
|
|
435
440
|
|
|
436
441
|
const initialValue = {
|
|
437
442
|
aspectRatio: '16/9',
|
|
@@ -463,7 +468,7 @@ describe( 'DimensionsTool', () => {
|
|
|
463
468
|
|
|
464
469
|
it( 'when starting with aspectRatio, scale, and height, setting aspectRatio to "Original" also clears scale (1101) -> (0001)', async () => {
|
|
465
470
|
const user = userEvent.setup();
|
|
466
|
-
const onChange =
|
|
471
|
+
const onChange = vi.fn();
|
|
467
472
|
|
|
468
473
|
const initialValue = {
|
|
469
474
|
aspectRatio: '16/9',
|
|
@@ -497,7 +502,7 @@ describe( 'DimensionsTool', () => {
|
|
|
497
502
|
|
|
498
503
|
it( 'when starting with aspectRatio, scale, and width, setting aspectRatio to "Original" also clears scale (1110) -> (0010)', async () => {
|
|
499
504
|
const user = userEvent.setup();
|
|
500
|
-
const onChange =
|
|
505
|
+
const onChange = vi.fn();
|
|
501
506
|
|
|
502
507
|
const initialValue = {
|
|
503
508
|
aspectRatio: '16/9',
|
|
@@ -533,7 +538,7 @@ describe( 'DimensionsTool', () => {
|
|
|
533
538
|
describe( 'updating scale', () => {
|
|
534
539
|
it( 'when default scale is cover, setting scale to fill preserves the fill value', async () => {
|
|
535
540
|
const user = userEvent.setup();
|
|
536
|
-
const onChange =
|
|
541
|
+
const onChange = vi.fn();
|
|
537
542
|
|
|
538
543
|
const initialValue = {
|
|
539
544
|
aspectRatio: '16/9',
|
|
@@ -560,7 +565,7 @@ describe( 'DimensionsTool', () => {
|
|
|
560
565
|
describe( 'updating dimensions', () => {
|
|
561
566
|
it( 'when starting with just height, setting width also sets scale (0001) -> (0111)', async () => {
|
|
562
567
|
const user = userEvent.setup();
|
|
563
|
-
const onChange =
|
|
568
|
+
const onChange = vi.fn();
|
|
564
569
|
|
|
565
570
|
const initialValue = {
|
|
566
571
|
// aspectRatio,
|
|
@@ -600,7 +605,7 @@ describe( 'DimensionsTool', () => {
|
|
|
600
605
|
|
|
601
606
|
it( 'when starting with just width, setting height also sets scale (0010) -> (0111)', async () => {
|
|
602
607
|
const user = userEvent.setup();
|
|
603
|
-
const onChange =
|
|
608
|
+
const onChange = vi.fn();
|
|
604
609
|
|
|
605
610
|
const initialValue = {
|
|
606
611
|
// aspectRatio,
|
|
@@ -640,7 +645,7 @@ describe( 'DimensionsTool', () => {
|
|
|
640
645
|
|
|
641
646
|
it( 'when starting with scale, width, and height, clearing width also clears scale (0111) -> (0001)', async () => {
|
|
642
647
|
const user = userEvent.setup();
|
|
643
|
-
const onChange =
|
|
648
|
+
const onChange = vi.fn();
|
|
644
649
|
|
|
645
650
|
const initialValue = {
|
|
646
651
|
// aspectRatio,
|
|
@@ -674,7 +679,7 @@ describe( 'DimensionsTool', () => {
|
|
|
674
679
|
|
|
675
680
|
it( 'when starting with scale, width, and height, clearing height also clears scale (0111) -> (0010)', async () => {
|
|
676
681
|
const user = userEvent.setup();
|
|
677
|
-
const onChange =
|
|
682
|
+
const onChange = vi.fn();
|
|
678
683
|
|
|
679
684
|
const initialValue = {
|
|
680
685
|
// aspectRatio,
|
|
@@ -708,7 +713,7 @@ describe( 'DimensionsTool', () => {
|
|
|
708
713
|
|
|
709
714
|
it( 'when starting with aspectRatio, scale, and height, setting width also clears aspectRatio (1101) -> (0111)', async () => {
|
|
710
715
|
const user = userEvent.setup();
|
|
711
|
-
const onChange =
|
|
716
|
+
const onChange = vi.fn();
|
|
712
717
|
|
|
713
718
|
const initialValue = {
|
|
714
719
|
aspectRatio: '16/9',
|
|
@@ -754,7 +759,7 @@ describe( 'DimensionsTool', () => {
|
|
|
754
759
|
|
|
755
760
|
it( 'when starting with aspectRatio, scale, and width, setting height also clears aspectRatio (1110) -> (0111)', async () => {
|
|
756
761
|
const user = userEvent.setup();
|
|
757
|
-
const onChange =
|
|
762
|
+
const onChange = vi.fn();
|
|
758
763
|
|
|
759
764
|
const initialValue = {
|
|
760
765
|
aspectRatio: '16/9',
|
|
@@ -802,7 +807,7 @@ describe( 'DimensionsTool', () => {
|
|
|
802
807
|
describe( 'internal component state', () => {
|
|
803
808
|
it( 'when aspect ratio is change to custom by setting width and height then removing a width value should return the original aspect ratio (1100) -> (1110) -> (0111) -> (1101)', async () => {
|
|
804
809
|
const user = userEvent.setup();
|
|
805
|
-
const onChange =
|
|
810
|
+
const onChange = vi.fn();
|
|
806
811
|
|
|
807
812
|
const value = {
|
|
808
813
|
aspectRatio: '16/9',
|
|
@@ -841,7 +846,7 @@ describe( 'DimensionsTool', () => {
|
|
|
841
846
|
|
|
842
847
|
it( 'when custom scale is set then aspect ratio is set to original and then aspect ratio is changed back (1100) -> (1100) -> (0000) -> (1100)', async () => {
|
|
843
848
|
const user = userEvent.setup();
|
|
844
|
-
const onChange =
|
|
849
|
+
const onChange = vi.fn();
|
|
845
850
|
|
|
846
851
|
const value = {
|
|
847
852
|
aspectRatio: '16/9',
|
|
@@ -1,7 +1,10 @@
|
|
|
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 DuotoneControl from '../';
|
|
4
5
|
|
|
6
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
7
|
+
|
|
5
8
|
// Adding two custom duotones in Global Styles seeds both from the palette's
|
|
6
9
|
// darkest and lightest colors, so two presets holding the same pair is the
|
|
7
10
|
// ordinary case. Only the slug tells them apart.
|
|
@@ -32,7 +35,7 @@ async function openControl( user ) {
|
|
|
32
35
|
describe( 'DuotoneControl', () => {
|
|
33
36
|
it( 'reports the slug of the duplicate that was picked', async () => {
|
|
34
37
|
const user = userEvent.setup();
|
|
35
|
-
const onChange =
|
|
38
|
+
const onChange = vi.fn();
|
|
36
39
|
|
|
37
40
|
render(
|
|
38
41
|
<DuotoneControl
|
|
@@ -64,7 +67,7 @@ describe( 'DuotoneControl', () => {
|
|
|
64
67
|
colorPalette={ COLOR_PALETTE }
|
|
65
68
|
value={ [ '#000000', '#ffffff' ] }
|
|
66
69
|
selectedSlug="custom-duotone-2"
|
|
67
|
-
onChange={
|
|
70
|
+
onChange={ vi.fn() }
|
|
68
71
|
/>
|
|
69
72
|
);
|
|
70
73
|
await openControl( user );
|
|
@@ -85,7 +88,7 @@ describe( 'DuotoneControl', () => {
|
|
|
85
88
|
duotonePalette={ DUPLICATE_PALETTE }
|
|
86
89
|
colorPalette={ COLOR_PALETTE }
|
|
87
90
|
value={ [ '#000000', '#ffffff' ] }
|
|
88
|
-
onChange={
|
|
91
|
+
onChange={ vi.fn() }
|
|
89
92
|
/>
|
|
90
93
|
);
|
|
91
94
|
await openControl( user );
|
|
@@ -12,7 +12,6 @@ import BorderRadiusControl from '../border-radius-control';
|
|
|
12
12
|
import { useColorsPerOrigin } from './hooks';
|
|
13
13
|
import { useToolsPanelDropdownMenuProps } from './utils';
|
|
14
14
|
import { setImmutably } from '../../utils/object';
|
|
15
|
-
import { useBorderPanelLabel } from '../../hooks/border';
|
|
16
15
|
import { ShadowPopover, useShadowPresets } from './shadow-panel-components';
|
|
17
16
|
import {
|
|
18
17
|
getInheritanceProps,
|
|
@@ -365,24 +364,18 @@ export default function BorderPanel( {
|
|
|
365
364
|
const showBorderByDefault =
|
|
366
365
|
defaultControls?.color || defaultControls?.width;
|
|
367
366
|
|
|
368
|
-
const hasBorderControl =
|
|
369
|
-
showBorderColor ||
|
|
370
|
-
showBorderStyle ||
|
|
371
|
-
showBorderWidth ||
|
|
372
|
-
showBorderRadius;
|
|
373
|
-
|
|
374
|
-
const label = useBorderPanelLabel( {
|
|
375
|
-
hasShadowControl,
|
|
376
|
-
hasBorderControl,
|
|
377
|
-
} );
|
|
378
|
-
|
|
379
367
|
return (
|
|
380
368
|
<Wrapper
|
|
381
369
|
resetAllFilter={ resetAllFilter }
|
|
382
370
|
value={ value }
|
|
383
371
|
onChange={ onChange }
|
|
384
372
|
panelId={ panelId }
|
|
385
|
-
|
|
373
|
+
// A shadow is treated as a soft border, so the panel keeps one
|
|
374
|
+
// name whichever of its controls a theme or block opts into.
|
|
375
|
+
// A stable title is what lets each control show its own label
|
|
376
|
+
// unconditionally, which in turn keeps their unlink toggles
|
|
377
|
+
// aligned.
|
|
378
|
+
label={ __( 'Borders' ) }
|
|
386
379
|
>
|
|
387
380
|
{ ( showBorderWidth || showBorderColor ) && (
|
|
388
381
|
<InheritanceToolsPanelItem
|
|
@@ -394,37 +387,23 @@ export default function BorderPanel( {
|
|
|
394
387
|
) }
|
|
395
388
|
hasValue={ () => isDefinedBorder( value?.border ) }
|
|
396
389
|
label={ __( 'Border' ) }
|
|
390
|
+
hasInlineEndToggle
|
|
397
391
|
onDeselect={ () => resetBorder() }
|
|
398
392
|
isShownByDefault={ showBorderByDefault }
|
|
399
393
|
panelId={ panelId }
|
|
400
394
|
>
|
|
401
|
-
{
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
// className. The inheritance treatment and the
|
|
408
|
-
// local-override reset affordance both target
|
|
409
|
-
// `.components-base-control__label`, so the visible
|
|
410
|
-
// "Border" label has to be a `BaseControl` label to
|
|
411
|
-
// receive them.
|
|
412
|
-
//
|
|
413
|
-
// Render it whenever a Shadow control is also present so
|
|
414
|
-
// the two controls stay disambiguated (mirrors the
|
|
415
|
-
// Shadow label's `hasBorderControl` guard below, and
|
|
416
|
-
// trunk's `hideLabelFromVision={ ! hasShadowControl }`),
|
|
417
|
-
// even when inheritance indicators are off (e.g. in
|
|
418
|
-
// Global Styles).
|
|
419
|
-
<BaseControl.VisualLabel as="legend">
|
|
420
|
-
{ __( 'Border' ) }
|
|
421
|
-
</BaseControl.VisualLabel>
|
|
422
|
-
) }
|
|
395
|
+
{ /* The visible label is always rendered, so the control's
|
|
396
|
+
linked/unlinked toggle sits in a label row and lines up
|
|
397
|
+
with the Radius control's. `BorderBoxControl` renders the
|
|
398
|
+
label as `BaseControl.VisualLabel`, which is what the
|
|
399
|
+
inheritance treatment and the local-override reset
|
|
400
|
+
affordance target. */ }
|
|
423
401
|
<BorderBoxControl
|
|
424
402
|
colors={ colors }
|
|
425
403
|
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
426
404
|
enableAlpha
|
|
427
405
|
enableStyle={ showBorderStyle }
|
|
406
|
+
label={ __( 'Border' ) }
|
|
428
407
|
onChange={ onBorderChange }
|
|
429
408
|
popoverOffset={ 40 }
|
|
430
409
|
popoverPlacement="left-start"
|
|
@@ -472,11 +451,9 @@ export default function BorderPanel( {
|
|
|
472
451
|
showLocalOverrideActionsInLabel={ false }
|
|
473
452
|
panelId={ panelId }
|
|
474
453
|
>
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
</BaseControl.VisualLabel>
|
|
479
|
-
) : null }
|
|
454
|
+
<BaseControl.VisualLabel>
|
|
455
|
+
{ __( 'Shadow' ) }
|
|
456
|
+
</BaseControl.VisualLabel>
|
|
480
457
|
|
|
481
458
|
<ShadowPopover
|
|
482
459
|
shadow={ shadow }
|
|
@@ -8,7 +8,7 @@ import { useToolsPanelDropdownMenuProps } from './utils';
|
|
|
8
8
|
|
|
9
9
|
export function useHasImageSettingsPanel( name, value, inheritedValue ) {
|
|
10
10
|
// Note: If lightbox `value` exists, that means it was
|
|
11
|
-
// defined via the
|
|
11
|
+
// defined via the Global Styles UI and will NOT
|
|
12
12
|
// be a boolean value or contain the `allowEditing` property,
|
|
13
13
|
// so we should show the settings panel in those cases.
|
|
14
14
|
return (
|