@wordpress/components 19.2.1-next.33ec3857e2.0 → 19.2.1
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 +6 -29
- package/build/angle-picker-control/index.js +0 -2
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/button/index.native.js +3 -13
- package/build/button/index.native.js.map +1 -1
- package/build/checkbox-control/index.js +1 -1
- package/build/checkbox-control/index.js.map +1 -1
- package/build/clipboard-button/index.js +2 -1
- package/build/clipboard-button/index.js.map +1 -1
- package/build/color-palette/index.js +1 -13
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/color-display.js +2 -4
- package/build/color-picker/color-display.js.map +1 -1
- package/build/color-picker/hex-input.js +1 -3
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js +1 -3
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/custom-gradient-picker/index.js +0 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/date-time/date.js +86 -63
- package/build/date-time/date.js.map +1 -1
- package/build/divider/component.js +7 -8
- package/build/divider/component.js.map +1 -1
- package/build/divider/styles.js +13 -38
- package/build/divider/styles.js.map +1 -1
- package/build/drop-zone/index.js +6 -14
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/provider.js +0 -1
- package/build/drop-zone/provider.js.map +1 -1
- package/build/flyout/styles.js +2 -2
- package/build/flyout/styles.js.map +1 -1
- package/build/focusable-iframe/index.js +0 -1
- package/build/focusable-iframe/index.js.map +1 -1
- package/build/higher-order/with-focus-outside/index.js +0 -2
- package/build/higher-order/with-focus-outside/index.js.map +1 -1
- package/build/index.js +0 -8
- package/build/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +32 -44
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +3 -10
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +2 -4
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +6 -7
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +1 -1
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/gridicons/index.native.js +1 -3
- package/build/mobile/gridicons/index.native.js.map +1 -1
- package/build/mobile/link-picker/index.native.js +4 -45
- package/build/mobile/link-picker/index.native.js.map +1 -1
- package/build/mobile/link-settings/index.native.js +0 -10
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/modal/aria-helper.js +0 -2
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +8 -17
- package/build/modal/index.js.map +1 -1
- package/build/palette-edit/index.js +31 -27
- package/build/palette-edit/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +9 -33
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/style-provider/index.js +0 -2
- package/build/style-provider/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +2 -7
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +14 -25
- package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build/tools-panel/styles.js +10 -12
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +8 -6
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +8 -6
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +41 -23
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/z-stack/component.js.map +1 -1
- package/build/z-stack/styles.js +8 -10
- package/build/z-stack/styles.js.map +1 -1
- package/build-module/angle-picker-control/index.js +0 -2
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/button/index.native.js +3 -13
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/checkbox-control/index.js +1 -1
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/clipboard-button/index.js +2 -1
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/color-palette/index.js +2 -14
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/color-display.js +2 -3
- package/build-module/color-picker/color-display.js.map +1 -1
- package/build-module/color-picker/hex-input.js +1 -2
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +0 -1
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/date-time/date.js +87 -63
- package/build-module/date-time/date.js.map +1 -1
- package/build-module/divider/component.js +7 -8
- package/build-module/divider/component.js.map +1 -1
- package/build-module/divider/styles.js +13 -37
- package/build-module/divider/styles.js.map +1 -1
- package/build-module/drop-zone/index.js +6 -14
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/provider.js +0 -1
- package/build-module/drop-zone/provider.js.map +1 -1
- package/build-module/flyout/styles.js +2 -2
- package/build-module/flyout/styles.js.map +1 -1
- package/build-module/focusable-iframe/index.js +0 -1
- package/build-module/focusable-iframe/index.js.map +1 -1
- package/build-module/higher-order/with-focus-outside/index.js +0 -1
- package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
- package/build-module/index.js +0 -1
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +32 -44
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +4 -10
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +2 -4
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +6 -7
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/gridicons/index.native.js +0 -1
- package/build-module/mobile/gridicons/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/index.native.js +8 -50
- package/build-module/mobile/link-picker/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/index.native.js +0 -10
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/modal/aria-helper.js +0 -2
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +8 -15
- package/build-module/modal/index.js.map +1 -1
- package/build-module/palette-edit/index.js +30 -27
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +9 -33
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/style-provider/index.js +0 -1
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +3 -8
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js +14 -25
- package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
- package/build-module/tools-panel/styles.js +11 -12
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +8 -5
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +8 -6
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +41 -23
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/z-stack/component.js.map +1 -1
- package/build-module/z-stack/styles.js +8 -13
- package/build-module/z-stack/styles.js.map +1 -1
- package/build-style/style-rtl.css +11 -23
- package/build-style/style.css +11 -23
- package/build-types/base-field/hook.d.ts +16 -16
- package/build-types/card/card/hook.d.ts +16 -16
- package/build-types/card/card-body/hook.d.ts +16 -16
- package/build-types/card/card-divider/hook.d.ts +18 -18
- package/build-types/card/card-footer/hook.d.ts +17 -17
- package/build-types/card/card-header/hook.d.ts +16 -16
- package/build-types/card/card-media/hook.d.ts +16 -16
- package/build-types/divider/component.d.ts +7 -8
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/divider/styles.d.ts +2 -2
- package/build-types/divider/styles.d.ts.map +1 -1
- package/build-types/divider/types.d.ts +5 -5
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +15 -15
- package/build-types/flex/flex/hook.d.ts +16 -16
- package/build-types/flex/flex-block/hook.d.ts +16 -16
- package/build-types/flex/flex-item/hook.d.ts +16 -16
- package/build-types/flyout/flyout/hook.d.ts +17 -17
- package/build-types/flyout/styles.d.ts +9 -7
- package/build-types/flyout/styles.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +16 -16
- package/build-types/h-stack/hook.d.ts +16 -16
- package/build-types/heading/hook.d.ts +16 -16
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +2 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +1 -2
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +16 -16
- package/build-types/item-group/item-group/hook.d.ts +16 -16
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/scrollable/hook.d.ts +16 -16
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +1 -1
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +16 -16
- package/build-types/surface/hook.d.ts +16 -16
- package/build-types/text/hook.d.ts +16 -16
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +16 -16
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +16 -16
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +16 -16
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +16 -16
- package/build-types/ui/control-group/hook.d.ts +18 -18
- package/build-types/ui/control-label/hook.d.ts +16 -16
- package/build-types/ui/form-group/form-group.d.ts +4 -4
- package/build-types/ui/form-group/use-form-group.d.ts +55 -55
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +0 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +2 -2
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +16 -16
- package/build-types/z-stack/component.d.ts +1 -1
- package/build-types/z-stack/styles.d.ts.map +1 -1
- package/package.json +23 -21
- package/src/alignment-matrix-control/stories/index.js +1 -1
- package/src/angle-picker-control/index.js +0 -2
- package/src/base-control/stories/index.js +1 -1
- package/src/button/index.native.js +1 -15
- package/src/button/stories/index.js +1 -1
- package/src/button/style.scss +0 -14
- package/src/card/card/README.md +3 -3
- package/src/card/stories/index.js +1 -1
- package/src/card/test/__snapshots__/index.js.snap +6 -6
- package/src/checkbox-control/index.js +1 -1
- package/src/checkbox-control/stories/index.js +1 -1
- package/src/clipboard-button/index.js +2 -1
- package/src/color-indicator/stories/index.js +1 -1
- package/src/color-indicator/style.scss +8 -5
- package/src/color-palette/index.js +5 -13
- package/src/color-palette/stories/index.js +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +0 -1
- package/src/color-picker/color-display.tsx +2 -3
- package/src/color-picker/hex-input.tsx +1 -2
- package/src/color-picker/input-with-slider.tsx +1 -2
- package/src/color-picker/stories/index.js +1 -1
- package/src/combobox-control/README.md +2 -2
- package/src/custom-gradient-picker/index.js +0 -1
- package/src/custom-gradient-picker/style.scss +4 -0
- package/src/date-time/README.md +0 -7
- package/src/date-time/date.js +84 -67
- package/src/date-time/stories/index.js +1 -1
- package/src/date-time/stories/time.js +1 -1
- package/src/date-time/test/date.js +29 -3
- package/src/dimension-control/README.md +1 -1
- package/src/divider/README.md +5 -33
- package/src/divider/component.tsx +7 -8
- package/src/divider/stories/index.js +17 -43
- package/src/divider/styles.ts +16 -53
- package/src/divider/test/__snapshots__/index.js.snap +11 -11
- package/src/divider/test/index.js +4 -4
- package/src/divider/types.ts +5 -5
- package/src/drop-zone/index.js +6 -14
- package/src/drop-zone/provider.js +0 -1
- package/src/dropdown-menu/stories/index.js +1 -1
- package/src/duotone-picker/README.md +1 -1
- package/src/elevation/stories/index.js +1 -1
- package/src/external-link/stories/index.js +1 -1
- package/src/flyout/styles.ts +2 -4
- package/src/focusable-iframe/index.js +0 -1
- package/src/font-size-picker/stories/index.js +1 -1
- package/src/form-token-field/stories/index.js +1 -1
- package/src/gradient-picker/stories/index.js +1 -1
- package/src/grid/stories/index.js +1 -1
- package/src/guide/stories/index.js +1 -1
- package/src/higher-order/with-focus-outside/index.js +0 -2
- package/src/icon/stories/index.js +1 -1
- package/src/index.js +0 -1
- package/src/input-control/stories/index.js +1 -2
- package/src/input-control/styles/input-control-styles.tsx +6 -16
- package/src/input-control/types.ts +1 -3
- package/src/item-group/stories/index.js +2 -84
- package/src/menu-item/README.md +2 -2
- package/src/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -6
- package/src/mobile/color-settings/index.native.js +0 -2
- package/src/mobile/color-settings/palette.screen.native.js +5 -8
- package/src/mobile/color-settings/style.native.scss +1 -1
- package/src/mobile/global-styles-context/utils.native.js +1 -1
- package/src/mobile/gridicons/index.native.js +3 -3
- package/src/mobile/inserter-button/style.native.scss +0 -1
- package/src/mobile/link-picker/index.native.js +7 -41
- package/src/mobile/link-settings/index.native.js +0 -11
- package/src/modal/README.md +0 -10
- package/src/modal/aria-helper.js +0 -2
- package/src/modal/index.js +55 -72
- package/src/modal/stories/index.js +1 -6
- package/src/modal/style.scss +0 -9
- package/src/modal/test/index.js +0 -11
- package/src/navigation/README.md +9 -0
- package/src/notice/stories/index.js +1 -1
- package/src/number-control/stories/index.js +1 -1
- package/src/palette-edit/index.js +106 -73
- package/src/panel/stories/index.js +1 -1
- package/src/placeholder/stories/index.js +1 -1
- package/src/popover/stories/index.js +1 -1
- package/src/query-controls/README.md +6 -138
- package/src/radio-group/README.md +1 -4
- package/src/range-control/stories/index.js +1 -1
- package/src/resizable-box/stories/index.js +1 -1
- package/src/scrollable/stories/index.js +1 -1
- package/src/search-control/stories/index.js +1 -1
- package/src/select-control/stories/index.js +1 -2
- package/src/select-control/styles/select-control-styles.ts +2 -25
- package/src/select-control/types.ts +1 -1
- package/src/slot-fill/stories/index.js +1 -1
- package/src/snackbar/stories/index.js +1 -1
- package/src/spacer/stories/index.js +1 -1
- package/src/style-provider/index.js +0 -2
- package/src/surface/stories/index.js +1 -1
- package/src/tab-panel/stories/index.js +1 -1
- package/src/text-control/stories/index.js +1 -1
- package/src/text-highlight/stories/index.js +1 -1
- package/src/textarea-control/stories/index.js +1 -1
- package/src/tip/stories/index.js +1 -1
- package/src/toggle-control/stories/index.js +1 -1
- package/src/toggle-group-control/stories/index.js +1 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +2 -7
- package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +9 -24
- package/src/toolbar-button/stories/index.js +1 -1
- package/src/tools-panel/stories/index.js +0 -54
- package/src/tools-panel/styles.ts +1 -41
- package/src/tools-panel/test/index.js +137 -19
- package/src/tools-panel/tools-panel/README.md +3 -11
- package/src/tools-panel/tools-panel/component.tsx +5 -2
- package/src/tools-panel/tools-panel-item/hook.ts +14 -6
- package/src/tooltip/stories/index.js +1 -1
- package/src/tree-select/stories/index.js +1 -1
- package/src/truncate/stories/index.js +1 -1
- package/src/unit-control/stories/index.js +1 -19
- package/src/unit-control/styles/unit-control-styles.ts +46 -33
- package/src/unit-control/types.ts +2 -5
- package/src/z-stack/README.md +1 -1
- package/src/z-stack/component.tsx +1 -1
- package/src/z-stack/stories/index.js +1 -1
- package/src/z-stack/styles.ts +2 -7
- package/tsconfig.json +2 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/build/confirm-dialog/component.js +0 -103
- package/build/confirm-dialog/component.js.map +0 -1
- package/build/confirm-dialog/index.js +0 -16
- package/build/confirm-dialog/index.js.map +0 -1
- package/build/confirm-dialog/types.js +0 -6
- package/build/confirm-dialog/types.js.map +0 -1
- package/build/date-time/utils.js +0 -32
- package/build/date-time/utils.js.map +0 -1
- package/build-module/confirm-dialog/component.js +0 -84
- package/build-module/confirm-dialog/component.js.map +0 -1
- package/build-module/confirm-dialog/index.js +0 -6
- package/build-module/confirm-dialog/index.js.map +0 -1
- package/build-module/confirm-dialog/types.js +0 -2
- package/build-module/confirm-dialog/types.js.map +0 -1
- package/build-module/date-time/utils.js +0 -20
- package/build-module/date-time/utils.js.map +0 -1
- package/src/confirm-dialog/README.md +0 -128
- package/src/confirm-dialog/component.tsx +0 -114
- package/src/confirm-dialog/index.tsx +0 -6
- package/src/confirm-dialog/stories/index.js +0 -120
- package/src/confirm-dialog/test/index.js +0 -302
- package/src/confirm-dialog/types.ts +0 -26
- package/src/date-time/test/utils.js +0 -32
- package/src/date-time/utils.js +0 -18
- package/src/mobile/link-settings/test/edit.native.js +0 -432
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
// noinspection DuplicatedCode
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { Clipboard } from 'react-native';
|
|
7
|
-
import { fireEvent, initializeEditor, waitFor } from 'test/helpers';
|
|
8
|
-
/**
|
|
9
|
-
* WordPress dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
12
|
-
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Utility function to unregister all core block types previously registered
|
|
17
|
-
* when staging the Redux Store `beforeAll` integration tests start running.
|
|
18
|
-
*
|
|
19
|
-
* This should probably be extracted into a utility module for future tests.
|
|
20
|
-
*/
|
|
21
|
-
const unregisterBlocks = () => {
|
|
22
|
-
const blocks = getBlockTypes();
|
|
23
|
-
|
|
24
|
-
blocks.forEach( ( { name } ) => unregisterBlockType( name ) );
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* ### TODO
|
|
29
|
-
* + Try to figure out why I can't `console.log(JSON.stringify(subject.toJSON()))` anymore.
|
|
30
|
-
*/
|
|
31
|
-
describe.each( [
|
|
32
|
-
[
|
|
33
|
-
{
|
|
34
|
-
type: 'core/button',
|
|
35
|
-
initialHtml: `
|
|
36
|
-
<!-- wp:button {"style":{"border":{"radius":"5px"}}} -->
|
|
37
|
-
<div class="wp-block-button">
|
|
38
|
-
<a class="wp-block-button__link" style="border-radius:5px">Link</a>
|
|
39
|
-
</div>
|
|
40
|
-
<!-- /wp:button -->
|
|
41
|
-
`,
|
|
42
|
-
toJSON: () => 'core/button',
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
[
|
|
46
|
-
{
|
|
47
|
-
type: 'core/image',
|
|
48
|
-
initialHtml: `
|
|
49
|
-
<!-- wp:image {"id":20,"sizeSlug":"large","linkDestination":"custom"} -->
|
|
50
|
-
<figure class="wp-block-image size-large">
|
|
51
|
-
<img class="wp-image-20" src="https://tonytahmouchtest.files.wordpress.com/2021/10/img_0111-2.jpg?w=1024" alt="" />
|
|
52
|
-
</figure>
|
|
53
|
-
<!-- /wp:image -->
|
|
54
|
-
`,
|
|
55
|
-
toJSON: () => 'core/image',
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
] )( '<LinkSettings/> from %j', ( { type, initialHtml } ) => {
|
|
59
|
-
beforeAll( () => {
|
|
60
|
-
registerCoreBlocks();
|
|
61
|
-
} );
|
|
62
|
-
|
|
63
|
-
afterAll( () => {
|
|
64
|
-
unregisterBlocks();
|
|
65
|
-
} );
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* GIVEN an EDITOR is displayed with an EDIT IMAGE BLOCK or EDIT BUTTON BLOCK;
|
|
69
|
-
* GIVEN the CLIPBOARD has a URL copied;
|
|
70
|
-
* WHEN the USER selects the SETTINGS BUTTON on the EDIT IMAGE BLOCK or EDIT BUTTON BLOCK;
|
|
71
|
-
*/
|
|
72
|
-
// eslint-disable-next-line jest/no-done-callback
|
|
73
|
-
it( 'should display the LINK SETTINGS with an EMPTY LINK TO field.', async ( done ) => {
|
|
74
|
-
// Arrange
|
|
75
|
-
const expectation =
|
|
76
|
-
'The LINK SETTINGS > LINK TO field SHOULD be displayed WITHOUT a URL from the CLIPBOARD.';
|
|
77
|
-
const url = 'https://tonytahmouchtest.files.wordpress.com';
|
|
78
|
-
const subject = await initializeEditor( { initialHtml } );
|
|
79
|
-
Clipboard.getString.mockReturnValue( url );
|
|
80
|
-
|
|
81
|
-
// Act
|
|
82
|
-
try {
|
|
83
|
-
const block = await waitFor( () =>
|
|
84
|
-
subject.getByA11yLabel(
|
|
85
|
-
type === 'core/image' ? /Image Block/ : /Button Block/
|
|
86
|
-
)
|
|
87
|
-
);
|
|
88
|
-
fireEvent.press( block );
|
|
89
|
-
fireEvent.press( block );
|
|
90
|
-
fireEvent.press(
|
|
91
|
-
await waitFor( () => subject.getByA11yLabel( 'Open Settings' ) )
|
|
92
|
-
);
|
|
93
|
-
} catch ( error ) {
|
|
94
|
-
done.fail( error );
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Assert
|
|
98
|
-
try {
|
|
99
|
-
await waitFor( () =>
|
|
100
|
-
subject.getByA11yLabel(
|
|
101
|
-
`Link to, ${
|
|
102
|
-
type === 'core/image' ? 'None' : 'Search or type URL'
|
|
103
|
-
}`
|
|
104
|
-
)
|
|
105
|
-
);
|
|
106
|
-
done();
|
|
107
|
-
} catch ( error ) {
|
|
108
|
-
done.fail( expectation );
|
|
109
|
-
}
|
|
110
|
-
} );
|
|
111
|
-
|
|
112
|
-
describe( '<LinkPicker/>', () => {
|
|
113
|
-
describe( 'Hide Clipboard Link Suggestion - Invalid URL in Clipboard', () => {
|
|
114
|
-
/**
|
|
115
|
-
* GIVEN a SETTINGS BOTTOM SHEET is displayed;
|
|
116
|
-
* GIVEN the CLIPBOARD has a NON-URL copied;
|
|
117
|
-
* GIVEN the STATE has NO URL;
|
|
118
|
-
* WHEN the USER selects the LINK TO cell;
|
|
119
|
-
*/
|
|
120
|
-
// eslint-disable-next-line jest/no-done-callback
|
|
121
|
-
it( 'should display the LINK PICKER with NO FROM CLIPBOARD CELL.', async ( done ) => {
|
|
122
|
-
// Arrange
|
|
123
|
-
const expectation =
|
|
124
|
-
'The LINK PICKER > LINK SUGGESTION SHOULD NOT suggest the URL from the CLIPBOARD.';
|
|
125
|
-
const url = 'tonytahmouchtest.files.wordpress.com';
|
|
126
|
-
const subject = await initializeEditor( { initialHtml } );
|
|
127
|
-
Clipboard.getString.mockReturnValue( url );
|
|
128
|
-
|
|
129
|
-
// Act
|
|
130
|
-
try {
|
|
131
|
-
const block = await waitFor( () =>
|
|
132
|
-
subject.getByA11yLabel(
|
|
133
|
-
type === 'core/image'
|
|
134
|
-
? /Image Block/
|
|
135
|
-
: /Button Block/
|
|
136
|
-
)
|
|
137
|
-
);
|
|
138
|
-
fireEvent.press( block );
|
|
139
|
-
fireEvent.press( block );
|
|
140
|
-
fireEvent.press(
|
|
141
|
-
await waitFor( () =>
|
|
142
|
-
subject.getByA11yLabel( 'Open Settings' )
|
|
143
|
-
)
|
|
144
|
-
);
|
|
145
|
-
fireEvent.press(
|
|
146
|
-
await waitFor( () =>
|
|
147
|
-
subject.getByA11yLabel(
|
|
148
|
-
`Link to, ${
|
|
149
|
-
type === 'core/image'
|
|
150
|
-
? 'None'
|
|
151
|
-
: 'Search or type URL'
|
|
152
|
-
}`
|
|
153
|
-
)
|
|
154
|
-
)
|
|
155
|
-
);
|
|
156
|
-
if ( type === 'core/image' ) {
|
|
157
|
-
fireEvent.press(
|
|
158
|
-
await waitFor( () =>
|
|
159
|
-
subject.getByA11yLabel( /Custom URL/ )
|
|
160
|
-
)
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
await waitFor( () => subject.getByA11yLabel( 'Apply' ) );
|
|
164
|
-
} catch ( error ) {
|
|
165
|
-
done.fail( error );
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Assert
|
|
169
|
-
waitFor(
|
|
170
|
-
() =>
|
|
171
|
-
subject.getByA11yLabel(
|
|
172
|
-
/Copy URL from the clipboard[,]/
|
|
173
|
-
),
|
|
174
|
-
{ timeout: 50, interval: 10 }
|
|
175
|
-
)
|
|
176
|
-
.then( () => done.fail( expectation ) )
|
|
177
|
-
.catch( () => done() );
|
|
178
|
-
} );
|
|
179
|
-
} );
|
|
180
|
-
|
|
181
|
-
describe( 'Hide Clipboard Link Suggestion - Valid and Same URL in Clipboard', () => {
|
|
182
|
-
/**
|
|
183
|
-
* GIVEN a SETTINGS BOTTOM SHEET is displayed;
|
|
184
|
-
* GIVEN the CLIPBOARD has a URL copied;
|
|
185
|
-
* GIVEN the STATE has the SAME URL as the CLIPBOARD;
|
|
186
|
-
* WHEN the USER selects the LINK TO cell;
|
|
187
|
-
*/
|
|
188
|
-
// eslint-disable-next-line jest/no-done-callback
|
|
189
|
-
it( 'should display the LINK PICKER with NO FROM CLIPBOARD CELL.', async ( done ) => {
|
|
190
|
-
// Arrange
|
|
191
|
-
const expectation =
|
|
192
|
-
'The LINK PICKER > LINK SUGGESTION SHOULD NOT suggest the URL from the CLIPBOARD.';
|
|
193
|
-
const url = 'https://tonytahmouchtest.files.wordpress.com';
|
|
194
|
-
const subject = await initializeEditor( { initialHtml } );
|
|
195
|
-
Clipboard.getString.mockReturnValue( url );
|
|
196
|
-
|
|
197
|
-
// Act
|
|
198
|
-
try {
|
|
199
|
-
const block = await waitFor( () =>
|
|
200
|
-
subject.getByA11yLabel(
|
|
201
|
-
type === 'core/image'
|
|
202
|
-
? /Image Block/
|
|
203
|
-
: /Button Block/
|
|
204
|
-
)
|
|
205
|
-
);
|
|
206
|
-
fireEvent.press( block );
|
|
207
|
-
fireEvent.press( block );
|
|
208
|
-
fireEvent.press(
|
|
209
|
-
await waitFor( () =>
|
|
210
|
-
subject.getByA11yLabel( 'Open Settings' )
|
|
211
|
-
)
|
|
212
|
-
);
|
|
213
|
-
fireEvent.press(
|
|
214
|
-
await waitFor( () =>
|
|
215
|
-
subject.getByA11yLabel(
|
|
216
|
-
`Link to, ${
|
|
217
|
-
type === 'core/image'
|
|
218
|
-
? 'None'
|
|
219
|
-
: 'Search or type URL'
|
|
220
|
-
}`
|
|
221
|
-
)
|
|
222
|
-
)
|
|
223
|
-
);
|
|
224
|
-
if ( type === 'core/image' ) {
|
|
225
|
-
fireEvent.press(
|
|
226
|
-
await waitFor( () =>
|
|
227
|
-
subject.getByA11yLabel( 'Custom URL. Empty' )
|
|
228
|
-
)
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
fireEvent.press(
|
|
232
|
-
await waitFor( () =>
|
|
233
|
-
subject.getByA11yLabel(
|
|
234
|
-
`Copy URL from the clipboard, ${ url }`
|
|
235
|
-
)
|
|
236
|
-
)
|
|
237
|
-
);
|
|
238
|
-
fireEvent.press(
|
|
239
|
-
await waitFor( () =>
|
|
240
|
-
subject.getByA11yLabel(
|
|
241
|
-
`Link to, ${
|
|
242
|
-
type === 'core/image' ? 'Custom URL' : url
|
|
243
|
-
}`
|
|
244
|
-
)
|
|
245
|
-
)
|
|
246
|
-
);
|
|
247
|
-
if ( type === 'core/image' ) {
|
|
248
|
-
fireEvent.press(
|
|
249
|
-
await waitFor( () =>
|
|
250
|
-
subject.getByA11yLabel( `Custom URL, ${ url }` )
|
|
251
|
-
)
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
await waitFor( () => subject.getByA11yLabel( 'Apply' ) );
|
|
255
|
-
} catch ( error ) {
|
|
256
|
-
done.fail( error );
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// Assert
|
|
260
|
-
waitFor(
|
|
261
|
-
() =>
|
|
262
|
-
subject.getByA11yLabel(
|
|
263
|
-
/Copy URL from the clipboard[,]/
|
|
264
|
-
),
|
|
265
|
-
{ timeout: 50, interval: 10 }
|
|
266
|
-
)
|
|
267
|
-
.then( () => done.fail( expectation ) )
|
|
268
|
-
.catch( () => done() );
|
|
269
|
-
} );
|
|
270
|
-
} );
|
|
271
|
-
|
|
272
|
-
describe( 'Show Clipboard Link Suggestion - Valid and Different URL in Clipboard', () => {
|
|
273
|
-
/**
|
|
274
|
-
* GIVEN a SETTINGS BOTTOM SHEET is displayed;
|
|
275
|
-
* GIVEN the CLIPBOARD has a URL copied;
|
|
276
|
-
* GIVEN the STATE has NO URL;
|
|
277
|
-
* WHEN the USER selects the LINK TO cell;
|
|
278
|
-
*/
|
|
279
|
-
it(
|
|
280
|
-
'should display the LINK PICKER with the FROM CLIPBOARD CELL populated' +
|
|
281
|
-
' with the URL from the CLIPBOARD.',
|
|
282
|
-
// eslint-disable-next-line jest/no-done-callback
|
|
283
|
-
async ( done ) => {
|
|
284
|
-
// Arrange
|
|
285
|
-
const url = 'https://tonytahmouchtest.files.wordpress.com';
|
|
286
|
-
const expectation =
|
|
287
|
-
'The LINK PICKER > LINK SUGGESTION SHOULD suggest the URL from the CLIPBOARD, e.g.,' +
|
|
288
|
-
`
|
|
289
|
-
${ url }
|
|
290
|
-
${ __( 'From clipboard' ) }
|
|
291
|
-
`;
|
|
292
|
-
const subject = await initializeEditor( { initialHtml } );
|
|
293
|
-
Clipboard.getString.mockReturnValue( url );
|
|
294
|
-
|
|
295
|
-
// Act
|
|
296
|
-
try {
|
|
297
|
-
const block = await waitFor( () =>
|
|
298
|
-
subject.getByA11yLabel(
|
|
299
|
-
type === 'core/image'
|
|
300
|
-
? /Image Block/
|
|
301
|
-
: /Button Block/
|
|
302
|
-
)
|
|
303
|
-
);
|
|
304
|
-
fireEvent.press( block );
|
|
305
|
-
fireEvent.press( block );
|
|
306
|
-
fireEvent.press(
|
|
307
|
-
await waitFor( () =>
|
|
308
|
-
subject.getByA11yLabel( 'Open Settings' )
|
|
309
|
-
)
|
|
310
|
-
);
|
|
311
|
-
fireEvent.press(
|
|
312
|
-
await waitFor( () =>
|
|
313
|
-
subject.getByA11yLabel(
|
|
314
|
-
`Link to, ${
|
|
315
|
-
type === 'core/image'
|
|
316
|
-
? 'None'
|
|
317
|
-
: 'Search or type URL'
|
|
318
|
-
}`
|
|
319
|
-
)
|
|
320
|
-
)
|
|
321
|
-
);
|
|
322
|
-
if ( type === 'core/image' ) {
|
|
323
|
-
fireEvent.press(
|
|
324
|
-
await waitFor( () =>
|
|
325
|
-
subject.getByA11yLabel( /Custom URL/ )
|
|
326
|
-
)
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
await waitFor( () =>
|
|
330
|
-
subject.getByA11yLabel(
|
|
331
|
-
`Copy URL from the clipboard, ${ url }`
|
|
332
|
-
)
|
|
333
|
-
);
|
|
334
|
-
} catch ( error ) {
|
|
335
|
-
done.fail( error );
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// Assert
|
|
339
|
-
try {
|
|
340
|
-
await waitFor( () => subject.getByText( url ) );
|
|
341
|
-
await waitFor( () =>
|
|
342
|
-
subject.getByText( __( 'From clipboard' ) )
|
|
343
|
-
);
|
|
344
|
-
done();
|
|
345
|
-
} catch ( error ) {
|
|
346
|
-
done.fail( expectation );
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
);
|
|
350
|
-
} );
|
|
351
|
-
|
|
352
|
-
describe( 'Press Clipboard Link Suggestion', () => {
|
|
353
|
-
/**
|
|
354
|
-
* GIVEN a LINK PICKER SHEET is displayed;
|
|
355
|
-
* GIVEN the FROM CLIPBOARD CELL is displayed;
|
|
356
|
-
* WHEN the FROM CLIPBOARD CELL is pressed;
|
|
357
|
-
*/
|
|
358
|
-
it(
|
|
359
|
-
'should display the LINK SETTINGS with the URL from the CLIPBOARD' +
|
|
360
|
-
' populated in the LINK TO field.',
|
|
361
|
-
// eslint-disable-next-line jest/no-done-callback
|
|
362
|
-
async ( done ) => {
|
|
363
|
-
// Arrange
|
|
364
|
-
const expectation =
|
|
365
|
-
'The LINK SETTINGS > LINK TO field SHOULD be displayed WITH a URL from the CLIPBOARD.';
|
|
366
|
-
const url = 'https://tonytahmouchtest.files.wordpress.com';
|
|
367
|
-
const subject = await initializeEditor( { initialHtml } );
|
|
368
|
-
Clipboard.getString.mockReturnValue( url );
|
|
369
|
-
|
|
370
|
-
// Act
|
|
371
|
-
try {
|
|
372
|
-
const block = await waitFor( () =>
|
|
373
|
-
subject.getByA11yLabel(
|
|
374
|
-
type === 'core/image'
|
|
375
|
-
? /Image Block/
|
|
376
|
-
: /Button Block/
|
|
377
|
-
)
|
|
378
|
-
);
|
|
379
|
-
fireEvent.press( block );
|
|
380
|
-
fireEvent.press( block );
|
|
381
|
-
fireEvent.press(
|
|
382
|
-
await waitFor( () =>
|
|
383
|
-
subject.getByA11yLabel( 'Open Settings' )
|
|
384
|
-
)
|
|
385
|
-
);
|
|
386
|
-
fireEvent.press(
|
|
387
|
-
await waitFor( () =>
|
|
388
|
-
subject.getByA11yLabel(
|
|
389
|
-
`Link to, ${
|
|
390
|
-
type === 'core/image'
|
|
391
|
-
? 'None'
|
|
392
|
-
: 'Search or type URL'
|
|
393
|
-
}`
|
|
394
|
-
)
|
|
395
|
-
)
|
|
396
|
-
);
|
|
397
|
-
if ( type === 'core/image' ) {
|
|
398
|
-
fireEvent.press(
|
|
399
|
-
await waitFor( () =>
|
|
400
|
-
subject.getByA11yLabel( /Custom URL/ )
|
|
401
|
-
)
|
|
402
|
-
);
|
|
403
|
-
}
|
|
404
|
-
fireEvent.press(
|
|
405
|
-
await waitFor( () =>
|
|
406
|
-
subject.getByA11yLabel(
|
|
407
|
-
`Copy URL from the clipboard, ${ url }`
|
|
408
|
-
)
|
|
409
|
-
)
|
|
410
|
-
);
|
|
411
|
-
} catch ( error ) {
|
|
412
|
-
done.fail( error );
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// Assert
|
|
416
|
-
try {
|
|
417
|
-
await waitFor( () =>
|
|
418
|
-
subject.getByA11yLabel(
|
|
419
|
-
`Link to, ${
|
|
420
|
-
type === 'core/image' ? 'Custom URL' : url
|
|
421
|
-
}`
|
|
422
|
-
)
|
|
423
|
-
);
|
|
424
|
-
done();
|
|
425
|
-
} catch ( error ) {
|
|
426
|
-
done.fail( expectation );
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
);
|
|
430
|
-
} );
|
|
431
|
-
} );
|
|
432
|
-
} );
|