carbon-react 138.2.2 → 139.0.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/esm/__internal__/fieldset/fieldset.component.js +1 -1
- package/esm/__internal__/focus-trap/focus-trap.component.js +2 -2
- package/esm/__internal__/form-field/form-field.component.js +1 -1
- package/esm/__internal__/form-spacing-provider/form-spacing-provider.component.d.ts +1 -1
- package/esm/__internal__/form-spacing-provider/form-spacing-provider.component.js +1 -1
- package/esm/__internal__/form-spacing-provider/index.d.ts +2 -2
- package/esm/__internal__/form-spacing-provider/index.js +1 -1
- package/esm/__internal__/input/input-presentation.component.js +1 -1
- package/esm/__internal__/input/input.component.js +1 -1
- package/esm/__internal__/popover/popover.component.js +1 -1
- package/esm/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/esm/components/action-popover/action-popover-item/action-popover-item.component.d.ts +1 -1
- package/esm/components/action-popover/action-popover-item/action-popover-item.component.js +1 -1
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +1 -1
- package/esm/components/action-popover/action-popover-menu/action-popover-menu.component.js +1 -1
- package/esm/components/action-popover/action-popover.component.d.ts +1 -1
- package/esm/components/action-popover/action-popover.component.js +1 -1
- package/esm/components/button/button.component.js +1 -1
- package/esm/components/button-bar/__internal__/button-bar.context.d.ts +13 -0
- package/esm/components/button-bar/button-bar.component.d.ts +1 -11
- package/esm/components/button-bar/button-bar.component.js +1 -1
- package/esm/components/button-minor/button-minor.component.js +1 -1
- package/esm/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.d.ts +16 -0
- package/esm/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.js +9 -0
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +0 -14
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +3 -10
- package/esm/components/button-toggle/button-toggle.component.js +1 -1
- package/esm/components/carbon-provider/__internal__/new-validation.context.d.ts +14 -0
- package/esm/components/carbon-provider/__internal__/top-modal-provider.component.d.ts +5 -0
- package/esm/components/carbon-provider/{top-modal-context.js → __internal__/top-modal-provider.component.js} +5 -6
- package/esm/components/carbon-provider/__internal__/top-modal.context.d.ts +6 -0
- package/esm/components/carbon-provider/__internal__/top-modal.context.js +4 -0
- package/esm/components/carbon-provider/carbon-provider.component.d.ts +2 -9
- package/esm/components/carbon-provider/carbon-provider.component.js +4 -4
- package/esm/components/card/__internal__/{card-context/index.d.ts → card.context.d.ts} +1 -1
- package/esm/components/card/card-footer/card-footer.component.d.ts +1 -1
- package/esm/components/card/card-footer/card-footer.component.js +1 -1
- package/esm/components/card/card-footer/card-footer.style.d.ts +1 -1
- package/esm/components/card/card-row/card-row.component.js +1 -1
- package/esm/components/card/card.component.d.ts +1 -1
- package/esm/components/card/card.component.js +1 -1
- package/esm/components/card/card.style.d.ts +1 -1
- package/esm/components/checkbox/checkbox-group/__internal__/checkbox-group.context.d.ts +4 -0
- package/esm/components/checkbox/checkbox-group/__internal__/checkbox-group.context.js +2 -0
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +0 -1
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +2 -2
- package/esm/components/checkbox/checkbox.component.js +2 -2
- package/esm/components/date/date.component.d.ts +1 -1
- package/esm/components/date/date.component.js +1 -1
- package/esm/components/date-range/__internal__/date-range.context.js +2 -0
- package/esm/components/date-range/date-range.component.js +1 -1
- package/esm/components/date-range/index.d.ts +1 -1
- package/esm/components/drawer/__internal__/drawer-sidebar.context.d.ts +6 -0
- package/esm/components/drawer/__internal__/drawer-sidebar.context.js +4 -0
- package/esm/components/drawer/drawer.component.d.ts +4 -6
- package/esm/components/drawer/drawer.component.js +13 -7
- package/esm/components/drawer/index.d.ts +2 -2
- package/esm/components/drawer/index.js +1 -1
- package/esm/components/duelling-picklist/duelling-picklist.component.js +1 -1
- package/esm/components/duelling-picklist/picklist/picklist.component.js +1 -1
- package/esm/components/duelling-picklist/picklist-group/picklist-group.component.js +1 -1
- package/esm/components/duelling-picklist/picklist-item/picklist-item.component.js +1 -1
- package/esm/components/fieldset/fieldset.component.js +1 -1
- package/esm/components/flat-table/__internal__/flat-table.context.d.ts +7 -0
- package/esm/components/flat-table/__internal__/flat-table.context.js +4 -0
- package/esm/components/flat-table/__internal__/use-table-cell.js +3 -3
- package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +1 -1
- package/esm/components/flat-table/flat-table-head/__internal__/flat-table-head.context.d.ts +6 -0
- package/esm/components/flat-table/flat-table-head/__internal__/flat-table-head.context.js +4 -0
- package/esm/components/flat-table/flat-table-head/flat-table-head.component.d.ts +0 -4
- package/esm/components/flat-table/flat-table-head/flat-table-head.component.js +1 -3
- package/esm/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +1 -1
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +2 -2
- package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +5 -5
- package/esm/components/flat-table/flat-table.component.d.ts +0 -4
- package/esm/components/flat-table/flat-table.component.js +3 -5
- package/esm/components/flat-table/flat-table.style.d.ts +1 -1
- package/esm/components/flat-table/sort/sort.component.js +2 -2
- package/esm/components/form/form.component.js +2 -2
- package/esm/components/icon/icon.component.js +1 -1
- package/esm/components/link/link.component.js +1 -1
- package/esm/components/menu/__internal__/submenu/submenu.component.js +2 -2
- package/esm/components/menu/__internal__/submenu/submenu.style.d.ts +1 -1
- package/esm/components/menu/menu-divider/menu-divider.component.js +1 -1
- package/esm/components/menu/menu-divider/menu-divider.style.d.ts +1 -1
- package/esm/components/menu/menu-full-screen/menu-full-screen.component.js +1 -1
- package/esm/components/menu/menu-full-screen/menu-full-screen.style.d.ts +1 -1
- package/esm/components/menu/menu-item/menu-item.component.js +1 -1
- package/esm/components/menu/menu-item/menu-item.style.d.ts +1 -1
- package/esm/components/menu/menu-segment-title/menu-segment-title.component.js +1 -1
- package/esm/components/menu/menu-segment-title/menu-segment-title.style.d.ts +1 -1
- package/esm/components/menu/menu.component.d.ts +1 -1
- package/esm/components/menu/menu.component.js +1 -1
- package/esm/components/menu/scrollable-block/scrollable-block.component.js +1 -1
- package/esm/components/menu/scrollable-block/scrollable-block.style.d.ts +1 -1
- package/esm/components/modal/__internal__/modal.context.d.ts +8 -0
- package/esm/components/modal/__internal__/modal.context.js +2 -0
- package/esm/components/modal/index.d.ts +2 -2
- package/esm/components/modal/index.js +1 -1
- package/esm/components/modal/modal.component.d.ts +0 -6
- package/esm/components/modal/modal.component.js +1 -1
- package/{lib/components/navigation-bar → esm/components/navigation-bar/__internal__}/fixed-navigation-bar.context.d.ts +1 -1
- package/esm/components/navigation-bar/{fixed-navigation-bar.context.js → __internal__/fixed-navigation-bar.context.js} +1 -1
- package/esm/components/navigation-bar/navigation-bar.component.js +1 -1
- package/esm/components/note/note.component.js +1 -1
- package/esm/components/numeral-date/__internal__/numeral-date.context.js +2 -0
- package/esm/components/numeral-date/numeral-date.component.js +2 -2
- package/esm/components/pill/pill.style.js +7 -6
- package/esm/components/popover-container/popover-container.component.js +1 -1
- package/esm/components/portal/__internal__/portal.context.d.ts +6 -0
- package/esm/components/portal/__internal__/portal.context.js +2 -0
- package/esm/components/portal/portal.d.ts +0 -4
- package/esm/components/portal/portal.js +1 -1
- package/esm/components/portrait/portrait.component.js +1 -1
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +1 -1
- package/esm/components/radio-button/radio-button.component.js +1 -1
- package/esm/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.component.js +2 -2
- package/esm/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.style.js +1 -1
- package/esm/components/select/{select-list → __internal__/select-list}/select-list.component.js +8 -8
- package/esm/components/select/{select-list → __internal__/select-list}/select-list.style.js +1 -1
- package/esm/components/select/__internal__/select-text/select-text.component.d.ts +0 -8
- package/{lib/components/select → esm/components/select/__internal__}/select-textbox/select-textbox.component.d.ts +3 -3
- package/esm/components/select/{select-textbox → __internal__/select-textbox}/select-textbox.component.js +5 -5
- package/esm/components/select/{utils → __internal__/utils}/is-expected-option.js +2 -2
- package/esm/components/select/{utils → __internal__/utils}/with-filter.hoc.js +5 -5
- package/esm/components/select/filterable-select/filterable-select.component.d.ts +1 -1
- package/esm/components/select/filterable-select/filterable-select.component.js +5 -5
- package/esm/components/select/multi-select/multi-select.component.d.ts +1 -1
- package/esm/components/select/multi-select/multi-select.component.js +6 -6
- package/esm/components/select/option/option.component.js +1 -1
- package/esm/components/select/option-row/option-row.component.js +1 -1
- package/esm/components/select/simple-select/simple-select.component.d.ts +1 -1
- package/esm/components/select/simple-select/simple-select.component.js +5 -5
- package/esm/components/sidebar/__internal__/sidebar.context.d.ts +6 -0
- package/esm/components/sidebar/__internal__/sidebar.context.js +2 -0
- package/esm/components/sidebar/index.d.ts +1 -1
- package/esm/components/sidebar/index.js +1 -1
- package/esm/components/sidebar/sidebar.component.d.ts +0 -4
- package/esm/components/sidebar/sidebar.component.js +1 -1
- package/esm/components/switch/switch.component.js +1 -1
- package/esm/components/tabs/__internal__/tab-title/index.d.ts +1 -1
- package/esm/components/tabs/__internal__/tab-title/index.js +1 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.d.ts +0 -4
- package/esm/components/tabs/__internal__/tab-title/tab-title.component.js +1 -1
- package/esm/components/tabs/__internal__/tab-title/tab-title.context.d.ts +6 -0
- package/esm/components/tabs/__internal__/tab-title/tab-title.context.js +2 -0
- package/esm/components/tabs/tab/__internal__/tab.context.d.ts +8 -0
- package/esm/components/tabs/tab/__internal__/tab.context.js +2 -0
- package/esm/components/tabs/tab/index.d.ts +2 -2
- package/esm/components/tabs/tab/index.js +1 -1
- package/esm/components/tabs/tab/tab.component.d.ts +0 -7
- package/esm/components/tabs/tab/tab.component.js +1 -2
- package/esm/components/tabs/tabs.component.js +1 -1
- package/esm/components/text-editor/__internal__/editor-link/editor-link.component.js +1 -1
- package/esm/components/text-editor/__internal__/editor.context.d.ts +6 -0
- package/esm/components/text-editor/__internal__/editor.context.js +2 -0
- package/esm/components/text-editor/text-editor.component.d.ts +0 -4
- package/esm/components/text-editor/text-editor.component.js +2 -2
- package/esm/components/textarea/textarea.component.js +1 -1
- package/esm/components/textbox/textbox.component.js +2 -2
- package/esm/components/tile/tile-content/tile-content.component.js +1 -1
- package/esm/components/tile/tile.component.js +1 -1
- package/esm/components/vertical-divider/vertical-divider.component.js +2 -0
- package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +1 -1
- package/esm/components/vertical-menu/vertical-menu-item/__internal__/menu-item.context.d.ts +5 -0
- package/esm/components/vertical-menu/vertical-menu-item/__internal__/menu-item.context.js +4 -0
- package/esm/components/vertical-menu/vertical-menu-item/vertical-menu-item.component.js +2 -4
- package/esm/hooks/__internal__/useModalAria/useModalAria.js +1 -1
- package/lib/__internal__/fieldset/fieldset.component.js +2 -2
- package/lib/__internal__/focus-trap/focus-trap.component.js +4 -4
- package/lib/__internal__/form-field/form-field.component.js +2 -2
- package/lib/__internal__/form-spacing-provider/form-spacing-provider.component.d.ts +1 -1
- package/lib/__internal__/form-spacing-provider/form-spacing-provider.component.js +2 -2
- package/lib/__internal__/form-spacing-provider/index.d.ts +2 -2
- package/lib/__internal__/form-spacing-provider/index.js +2 -2
- package/lib/__internal__/input/input-presentation.component.js +2 -2
- package/lib/__internal__/input/input.component.js +2 -2
- package/lib/__internal__/popover/popover.component.js +2 -2
- package/lib/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.d.ts +1 -1
- package/lib/components/action-popover/action-popover-item/action-popover-item.component.js +2 -2
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.d.ts +1 -1
- package/lib/components/action-popover/action-popover-menu/action-popover-menu.component.js +2 -2
- package/lib/components/action-popover/action-popover.component.d.ts +1 -1
- package/lib/components/action-popover/action-popover.component.js +2 -2
- package/lib/components/button/button.component.js +2 -2
- package/lib/components/button-bar/__internal__/button-bar.context.d.ts +13 -0
- package/lib/components/button-bar/button-bar.component.d.ts +1 -11
- package/lib/components/button-bar/button-bar.component.js +3 -3
- package/lib/components/button-minor/button-minor.component.js +2 -2
- package/lib/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.d.ts +16 -0
- package/lib/components/button-toggle/button-toggle-group/__internal__/button-toggle-group.context.js +16 -0
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +0 -14
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +5 -12
- package/lib/components/button-toggle/button-toggle.component.js +2 -2
- package/lib/components/carbon-provider/__internal__/new-validation.context.d.ts +14 -0
- package/lib/components/carbon-provider/__internal__/top-modal-provider.component.d.ts +5 -0
- package/lib/components/carbon-provider/{top-modal-context.js → __internal__/top-modal-provider.component.js} +8 -8
- package/lib/components/carbon-provider/__internal__/top-modal.context.d.ts +6 -0
- package/lib/components/carbon-provider/__internal__/top-modal.context.js +11 -0
- package/lib/components/carbon-provider/carbon-provider.component.d.ts +2 -9
- package/lib/components/carbon-provider/carbon-provider.component.js +6 -6
- package/lib/components/card/__internal__/{card-context/index.d.ts → card.context.d.ts} +1 -1
- package/lib/components/card/card-footer/card-footer.component.d.ts +1 -1
- package/lib/components/card/card-footer/card-footer.component.js +2 -2
- package/lib/components/card/card-footer/card-footer.style.d.ts +1 -1
- package/lib/components/card/card-row/card-row.component.js +2 -2
- package/lib/components/card/card.component.d.ts +1 -1
- package/lib/components/card/card.component.js +5 -5
- package/lib/components/card/card.style.d.ts +1 -1
- package/lib/components/checkbox/checkbox-group/__internal__/checkbox-group.context.d.ts +4 -0
- package/lib/components/checkbox/checkbox-group/__internal__/checkbox-group.context.js +9 -0
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +0 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +6 -6
- package/lib/components/checkbox/checkbox.component.js +4 -4
- package/lib/components/date/date.component.d.ts +1 -1
- package/lib/components/date/date.component.js +1 -1
- package/lib/components/date-range/__internal__/date-range.context.js +9 -0
- package/lib/components/date-range/date-range.component.js +1 -1
- package/lib/components/date-range/index.d.ts +1 -1
- package/lib/components/drawer/__internal__/drawer-sidebar.context.d.ts +6 -0
- package/lib/components/drawer/__internal__/drawer-sidebar.context.js +11 -0
- package/lib/components/drawer/drawer.component.d.ts +4 -6
- package/lib/components/drawer/drawer.component.js +22 -9
- package/lib/components/drawer/index.d.ts +2 -2
- package/lib/components/drawer/index.js +2 -9
- package/lib/components/duelling-picklist/duelling-picklist.component.js +1 -1
- package/lib/components/duelling-picklist/picklist/picklist.component.js +1 -1
- package/lib/components/duelling-picklist/picklist-group/picklist-group.component.js +1 -1
- package/lib/components/duelling-picklist/picklist-item/picklist-item.component.js +1 -1
- package/lib/components/fieldset/fieldset.component.js +2 -2
- package/lib/components/flat-table/__internal__/flat-table.context.d.ts +7 -0
- package/lib/components/flat-table/__internal__/flat-table.context.js +11 -0
- package/lib/components/flat-table/__internal__/use-table-cell.js +4 -4
- package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +2 -2
- package/lib/components/flat-table/flat-table-head/__internal__/flat-table-head.context.d.ts +6 -0
- package/lib/components/flat-table/flat-table-head/__internal__/flat-table-head.context.js +11 -0
- package/lib/components/flat-table/flat-table-head/flat-table-head.component.d.ts +0 -4
- package/lib/components/flat-table/flat-table-head/flat-table-head.component.js +3 -5
- package/lib/components/flat-table/flat-table-header/flat-table-header-utils.d.ts +1 -1
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +2 -2
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +8 -8
- package/lib/components/flat-table/flat-table.component.d.ts +0 -4
- package/lib/components/flat-table/flat-table.component.js +5 -7
- package/lib/components/flat-table/flat-table.style.d.ts +1 -1
- package/lib/components/flat-table/sort/sort.component.js +2 -2
- package/lib/components/form/form.component.js +4 -4
- package/lib/components/icon/icon.component.js +2 -2
- package/lib/components/link/link.component.js +1 -1
- package/lib/components/menu/__internal__/submenu/submenu.component.js +2 -2
- package/lib/components/menu/__internal__/submenu/submenu.style.d.ts +1 -1
- package/lib/components/menu/menu-divider/menu-divider.component.js +1 -1
- package/lib/components/menu/menu-divider/menu-divider.style.d.ts +1 -1
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +1 -1
- package/lib/components/menu/menu-full-screen/menu-full-screen.style.d.ts +1 -1
- package/lib/components/menu/menu-item/menu-item.component.js +1 -1
- package/lib/components/menu/menu-item/menu-item.style.d.ts +1 -1
- package/lib/components/menu/menu-segment-title/menu-segment-title.component.js +1 -1
- package/lib/components/menu/menu-segment-title/menu-segment-title.style.d.ts +1 -1
- package/lib/components/menu/menu.component.d.ts +1 -1
- package/lib/components/menu/menu.component.js +1 -1
- package/lib/components/menu/scrollable-block/scrollable-block.component.js +1 -1
- package/lib/components/menu/scrollable-block/scrollable-block.style.d.ts +1 -1
- package/lib/components/modal/__internal__/modal.context.d.ts +8 -0
- package/lib/components/modal/__internal__/modal.context.js +9 -0
- package/lib/components/modal/index.d.ts +2 -2
- package/lib/components/modal/index.js +2 -9
- package/lib/components/modal/modal.component.d.ts +0 -6
- package/lib/components/modal/modal.component.js +3 -3
- package/{esm/components/navigation-bar → lib/components/navigation-bar/__internal__}/fixed-navigation-bar.context.d.ts +1 -1
- package/lib/components/navigation-bar/{fixed-navigation-bar.context.js → __internal__/fixed-navigation-bar.context.js} +1 -1
- package/lib/components/navigation-bar/navigation-bar.component.js +1 -1
- package/lib/components/note/note.component.js +2 -2
- package/lib/components/numeral-date/__internal__/numeral-date.context.js +9 -0
- package/lib/components/numeral-date/numeral-date.component.js +4 -4
- package/lib/components/pill/pill.style.js +7 -6
- package/lib/components/popover-container/popover-container.component.js +2 -2
- package/lib/components/portal/__internal__/portal.context.d.ts +6 -0
- package/lib/components/portal/__internal__/portal.context.js +9 -0
- package/lib/components/portal/portal.d.ts +0 -4
- package/lib/components/portal/portal.js +3 -3
- package/lib/components/portrait/portrait.component.js +2 -2
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +2 -2
- package/lib/components/radio-button/radio-button.component.js +2 -2
- package/lib/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.component.js +2 -2
- package/lib/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.style.js +1 -1
- package/lib/components/select/__internal__/list-action-button/package.json +6 -0
- package/lib/components/select/__internal__/select-list/package.json +6 -0
- package/lib/components/select/{select-list → __internal__/select-list}/select-list.component.js +9 -9
- package/lib/components/select/{select-list → __internal__/select-list}/select-list.style.js +1 -1
- package/lib/components/select/__internal__/select-text/select-text.component.d.ts +0 -8
- package/lib/components/select/__internal__/select-textbox/package.json +6 -0
- package/{esm/components/select → lib/components/select/__internal__}/select-textbox/select-textbox.component.d.ts +3 -3
- package/lib/components/select/{select-textbox → __internal__/select-textbox}/select-textbox.component.js +6 -6
- package/lib/components/select/{utils → __internal__/utils}/is-expected-option.js +2 -2
- package/lib/components/select/{utils → __internal__/utils}/with-filter.hoc.js +5 -5
- package/lib/components/select/filterable-select/filterable-select.component.d.ts +1 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +5 -5
- package/lib/components/select/multi-select/multi-select.component.d.ts +1 -1
- package/lib/components/select/multi-select/multi-select.component.js +6 -6
- package/lib/components/select/option/option.component.js +2 -2
- package/lib/components/select/option-row/option-row.component.js +2 -2
- package/lib/components/select/simple-select/simple-select.component.d.ts +1 -1
- package/lib/components/select/simple-select/simple-select.component.js +5 -5
- package/lib/components/sidebar/__internal__/sidebar.context.d.ts +6 -0
- package/lib/components/sidebar/__internal__/sidebar.context.js +9 -0
- package/lib/components/sidebar/index.d.ts +1 -1
- package/lib/components/sidebar/index.js +2 -9
- package/lib/components/sidebar/sidebar.component.d.ts +0 -4
- package/lib/components/sidebar/sidebar.component.js +3 -3
- package/lib/components/switch/switch.component.js +2 -2
- package/lib/components/tabs/__internal__/tab-title/index.d.ts +1 -1
- package/lib/components/tabs/__internal__/tab-title/index.js +2 -9
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.d.ts +0 -4
- package/lib/components/tabs/__internal__/tab-title/tab-title.component.js +3 -3
- package/lib/components/tabs/__internal__/tab-title/tab-title.context.d.ts +6 -0
- package/lib/components/tabs/__internal__/tab-title/tab-title.context.js +9 -0
- package/lib/components/tabs/tab/__internal__/tab.context.d.ts +8 -0
- package/lib/components/tabs/tab/__internal__/tab.context.js +9 -0
- package/lib/components/tabs/tab/index.d.ts +2 -2
- package/lib/components/tabs/tab/index.js +2 -9
- package/lib/components/tabs/tab/tab.component.d.ts +0 -7
- package/lib/components/tabs/tab/tab.component.js +3 -3
- package/lib/components/tabs/tabs.component.js +2 -2
- package/lib/components/text-editor/__internal__/editor-link/editor-link.component.js +2 -2
- package/lib/components/text-editor/__internal__/editor.context.d.ts +6 -0
- package/lib/components/text-editor/__internal__/editor.context.js +9 -0
- package/lib/components/text-editor/text-editor.component.d.ts +0 -4
- package/lib/components/text-editor/text-editor.component.js +5 -5
- package/lib/components/textarea/textarea.component.js +2 -2
- package/lib/components/textbox/textbox.component.js +4 -4
- package/lib/components/tile/tile-content/tile-content.component.js +2 -2
- package/lib/components/tile/tile.component.js +2 -2
- package/lib/components/vertical-divider/vertical-divider.component.js +2 -0
- package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +1 -1
- package/lib/components/vertical-menu/vertical-menu-item/__internal__/menu-item.context.d.ts +5 -0
- package/lib/components/vertical-menu/vertical-menu-item/__internal__/menu-item.context.js +11 -0
- package/lib/components/vertical-menu/vertical-menu-item/vertical-menu-item.component.js +4 -6
- package/lib/hooks/__internal__/useModalAria/useModalAria.js +2 -2
- package/package.json +1 -1
- package/esm/__spec_helper__/enzyme-snapshot-helper.js +0 -22
- package/esm/__spec_helper__/expect.d.ts +0 -8
- package/esm/__spec_helper__/expect.js +0 -28
- package/esm/__spec_helper__/index.d.ts +0 -1
- package/esm/__spec_helper__/index.js +0 -12
- package/esm/__spec_helper__/select-test-utils.d.ts +0 -3
- package/esm/__spec_helper__/select-test-utils.js +0 -39
- package/esm/__spec_helper__/test-utils.d.ts +0 -51
- package/esm/__spec_helper__/test-utils.js +0 -358
- package/esm/components/carbon-provider/top-modal-context.d.ts +0 -9
- package/lib/__spec_helper__/enzyme-snapshot-helper.js +0 -29
- package/lib/__spec_helper__/expect.d.ts +0 -8
- package/lib/__spec_helper__/expect.js +0 -30
- package/lib/__spec_helper__/index.d.ts +0 -1
- package/lib/__spec_helper__/index.js +0 -15
- package/lib/__spec_helper__/package.json +0 -6
- package/lib/__spec_helper__/select-test-utils.d.ts +0 -3
- package/lib/__spec_helper__/select-test-utils.js +0 -46
- package/lib/__spec_helper__/test-utils.d.ts +0 -51
- package/lib/__spec_helper__/test-utils.js +0 -391
- package/lib/components/carbon-provider/top-modal-context.d.ts +0 -9
- package/lib/components/card/__internal__/card-context/package.json +0 -6
- package/lib/components/select/list-action-button/package.json +0 -6
- package/lib/components/select/select-list/package.json +0 -6
- package/lib/components/select/select-textbox/package.json +0 -6
- /package/esm/__internal__/form-spacing-provider/{form-spacing-context.d.ts → form-spacing.context.d.ts} +0 -0
- /package/esm/__internal__/form-spacing-provider/{form-spacing-context.js → form-spacing.context.js} +0 -0
- /package/esm/components/action-popover/{action-popover-context.d.ts → __internal__/action-popover.context.d.ts} +0 -0
- /package/esm/components/action-popover/{action-popover-context.js → __internal__/action-popover.context.js} +0 -0
- /package/esm/components/{date-range/date-range.context.js → button-bar/__internal__/button-bar.context.js} +0 -0
- /package/esm/components/{numeral-date/numeral-date-context.js → carbon-provider/__internal__/new-validation.context.js} +0 -0
- /package/esm/components/card/__internal__/{card-context/index.js → card.context.js} +0 -0
- /package/esm/components/date-range/{date-range.context.d.ts → __internal__/date-range.context.d.ts} +0 -0
- /package/esm/components/duelling-picklist/{duelling-picklist.context.d.ts → __internal__/duelling-picklist.context.d.ts} +0 -0
- /package/esm/components/duelling-picklist/{duelling-picklist.context.js → __internal__/duelling-picklist.context.js} +0 -0
- /package/esm/components/flat-table/flat-table-row/__internal__/{flat-table-row-context.d.ts → flat-table-row.context.d.ts} +0 -0
- /package/esm/components/flat-table/flat-table-row/__internal__/{flat-table-row-context.js → flat-table-row.context.js} +0 -0
- /package/esm/components/menu/{menu.context.d.ts → __internal__/menu.context.d.ts} +0 -0
- /package/esm/components/menu/{menu.context.js → __internal__/menu.context.js} +0 -0
- /package/esm/components/numeral-date/{numeral-date-context.d.ts → __internal__/numeral-date.context.d.ts} +0 -0
- /package/esm/components/select/{list-action-button → __internal__/list-action-button}/index.d.ts +0 -0
- /package/esm/components/select/{list-action-button → __internal__/list-action-button}/index.js +0 -0
- /package/esm/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.component.d.ts +0 -0
- /package/esm/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.style.d.ts +0 -0
- /package/esm/components/select/{select-list → __internal__/select-list}/index.d.ts +0 -0
- /package/esm/components/select/{select-list → __internal__/select-list}/index.js +0 -0
- /package/esm/components/select/{select-list → __internal__/select-list}/select-list.component.d.ts +0 -0
- /package/esm/components/select/__internal__/{select-list-context.d.ts → select-list/select-list.context.d.ts} +0 -0
- /package/esm/components/select/__internal__/{select-list-context.js → select-list/select-list.context.js} +0 -0
- /package/esm/components/select/{select-list → __internal__/select-list}/select-list.style.d.ts +0 -0
- /package/esm/components/select/{select-textbox → __internal__/select-textbox}/index.d.ts +0 -0
- /package/esm/components/select/{select-textbox → __internal__/select-textbox}/index.js +0 -0
- /package/esm/components/select/{select-textbox/select-textbox-context.d.ts → __internal__/select-textbox/select-textbox.context.d.ts} +0 -0
- /package/esm/components/select/{select-textbox/select-textbox-context.js → __internal__/select-textbox/select-textbox.context.js} +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/get-next-child-by-text.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/get-next-child-by-text.js +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/get-next-index-by-key.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/get-next-index-by-key.js +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/highlight-part-of-text.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/highlight-part-of-text.js +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/is-expected-option.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/is-expected-value.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/is-expected-value.js +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/is-navigation-key.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/is-navigation-key.js +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/matching-text.style.d.ts +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/matching-text.style.js +0 -0
- /package/esm/components/select/{utils → __internal__/utils}/with-filter.hoc.d.ts +0 -0
- /package/esm/components/tile/__internal__/{tile-context.d.ts → tile.context.d.ts} +0 -0
- /package/esm/components/tile/__internal__/{tile-context.js → tile.context.js} +0 -0
- /package/esm/components/vertical-menu/vertical-menu-full-screen/{vertical-menu-full-screen.context.d.ts → __internal__/vertical-menu-full-screen.context.d.ts} +0 -0
- /package/esm/components/vertical-menu/vertical-menu-full-screen/{vertical-menu-full-screen.context.js → __internal__/vertical-menu-full-screen.context.js} +0 -0
- /package/lib/__internal__/form-spacing-provider/{form-spacing-context.d.ts → form-spacing.context.d.ts} +0 -0
- /package/lib/__internal__/form-spacing-provider/{form-spacing-context.js → form-spacing.context.js} +0 -0
- /package/lib/components/action-popover/{action-popover-context.d.ts → __internal__/action-popover.context.d.ts} +0 -0
- /package/lib/components/action-popover/{action-popover-context.js → __internal__/action-popover.context.js} +0 -0
- /package/lib/components/{date-range/date-range.context.js → button-bar/__internal__/button-bar.context.js} +0 -0
- /package/lib/components/{numeral-date/numeral-date-context.js → carbon-provider/__internal__/new-validation.context.js} +0 -0
- /package/lib/components/card/__internal__/{card-context/index.js → card.context.js} +0 -0
- /package/lib/components/date-range/{date-range.context.d.ts → __internal__/date-range.context.d.ts} +0 -0
- /package/lib/components/duelling-picklist/{duelling-picklist.context.d.ts → __internal__/duelling-picklist.context.d.ts} +0 -0
- /package/lib/components/duelling-picklist/{duelling-picklist.context.js → __internal__/duelling-picklist.context.js} +0 -0
- /package/lib/components/flat-table/flat-table-row/__internal__/{flat-table-row-context.d.ts → flat-table-row.context.d.ts} +0 -0
- /package/lib/components/flat-table/flat-table-row/__internal__/{flat-table-row-context.js → flat-table-row.context.js} +0 -0
- /package/lib/components/menu/{menu.context.d.ts → __internal__/menu.context.d.ts} +0 -0
- /package/lib/components/menu/{menu.context.js → __internal__/menu.context.js} +0 -0
- /package/lib/components/numeral-date/{numeral-date-context.d.ts → __internal__/numeral-date.context.d.ts} +0 -0
- /package/lib/components/select/{list-action-button → __internal__/list-action-button}/index.d.ts +0 -0
- /package/lib/components/select/{list-action-button → __internal__/list-action-button}/index.js +0 -0
- /package/lib/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.component.d.ts +0 -0
- /package/lib/components/select/{list-action-button → __internal__/list-action-button}/list-action-button.style.d.ts +0 -0
- /package/lib/components/select/{select-list → __internal__/select-list}/index.d.ts +0 -0
- /package/lib/components/select/{select-list → __internal__/select-list}/index.js +0 -0
- /package/lib/components/select/{select-list → __internal__/select-list}/select-list.component.d.ts +0 -0
- /package/lib/components/select/__internal__/{select-list-context.d.ts → select-list/select-list.context.d.ts} +0 -0
- /package/lib/components/select/__internal__/{select-list-context.js → select-list/select-list.context.js} +0 -0
- /package/lib/components/select/{select-list → __internal__/select-list}/select-list.style.d.ts +0 -0
- /package/lib/components/select/{select-textbox → __internal__/select-textbox}/index.d.ts +0 -0
- /package/lib/components/select/{select-textbox → __internal__/select-textbox}/index.js +0 -0
- /package/lib/components/select/{select-textbox/select-textbox-context.d.ts → __internal__/select-textbox/select-textbox.context.d.ts} +0 -0
- /package/lib/components/select/{select-textbox/select-textbox-context.js → __internal__/select-textbox/select-textbox.context.js} +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/get-next-child-by-text.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/get-next-child-by-text.js +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/get-next-index-by-key.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/get-next-index-by-key.js +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/highlight-part-of-text.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/highlight-part-of-text.js +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/is-expected-option.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/is-expected-value.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/is-expected-value.js +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/is-navigation-key.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/is-navigation-key.js +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/matching-text.style.d.ts +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/matching-text.style.js +0 -0
- /package/lib/components/select/{utils → __internal__/utils}/with-filter.hoc.d.ts +0 -0
- /package/lib/components/tile/__internal__/{tile-context.d.ts → tile.context.d.ts} +0 -0
- /package/lib/components/tile/__internal__/{tile-context.js → tile.context.js} +0 -0
- /package/lib/components/vertical-menu/vertical-menu-full-screen/{vertical-menu-full-screen.context.d.ts → __internal__/vertical-menu-full-screen.context.d.ts} +0 -0
- /package/lib/components/vertical-menu/vertical-menu-full-screen/{vertical-menu-full-screen.context.js → __internal__/vertical-menu-full-screen.context.js} +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("jest-styled-components");
|
|
4
|
-
var _enzyme = require("enzyme");
|
|
5
|
-
var _jestMatcherUtils = require("jest-matcher-utils");
|
|
6
|
-
expect.extend({
|
|
7
|
-
toBeFocused(received) {
|
|
8
|
-
const expected = document.activeElement;
|
|
9
|
-
const DOMNode = received instanceof _enzyme.ReactWrapper ? received.getDOMNode() : received;
|
|
10
|
-
const pass = this.equals(expected, DOMNode);
|
|
11
|
-
const options = {
|
|
12
|
-
isNot: this.isNot
|
|
13
|
-
};
|
|
14
|
-
const hint = this.utils.matcherHint("toBeFocused", "DOMNode", "", options);
|
|
15
|
-
const positive = () => {
|
|
16
|
-
const diffString = (0, _jestMatcherUtils.diff)(expected, DOMNode, {
|
|
17
|
-
expand: this.expand
|
|
18
|
-
});
|
|
19
|
-
return `${hint}\n\n${
|
|
20
|
-
// eslint-disable-next-line multiline-ternary
|
|
21
|
-
diffString && diffString.includes("- Expect") ? `Difference:\n\n${diffString}` : `Expected: ${this.utils.printExpected(expected)}\nReceived: ${this.utils.printReceived(DOMNode)}`}`;
|
|
22
|
-
};
|
|
23
|
-
const negative = () => `${hint}\n\nDOMNode should not have focus`;
|
|
24
|
-
const message = pass ? negative : positive;
|
|
25
|
-
return {
|
|
26
|
-
pass,
|
|
27
|
-
message
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
var _jestFetchMock = require("jest-fetch-mock");
|
|
5
|
-
var _mockMatchMedia = require("./mock-match-media");
|
|
6
|
-
var _mockResizeObserver = _interopRequireDefault(require("./mock-resize-observer"));
|
|
7
|
-
var _mockElementScrollto = _interopRequireDefault(require("./mock-element-scrollto"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
(0, _jestFetchMock.enableFetchMocks)();
|
|
10
|
-
(0, _mockResizeObserver.default)();
|
|
11
|
-
(0, _mockMatchMedia.setupMatchMediaMock)();
|
|
12
|
-
(0, _mockElementScrollto.default)();
|
|
13
|
-
(0, _react.configure)({
|
|
14
|
-
testIdAttribute: "data-role" /** Configure React Testing Library *ByTestId queries to use data-role tag */
|
|
15
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.simulateDropdownEvent = simulateDropdownEvent;
|
|
7
|
-
exports.simulateSelectTextboxEvent = simulateSelectTextboxEvent;
|
|
8
|
-
var _testUtils = require("react-dom/test-utils");
|
|
9
|
-
var _jsdomTestingMocks = require("jsdom-testing-mocks");
|
|
10
|
-
var _selectList = require("../components/select/select-list/select-list.style");
|
|
11
|
-
const resizeObserver = (0, _jsdomTestingMocks.mockResizeObserver)();
|
|
12
|
-
function simulateSelectTextboxEvent(container, eventType,
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
...eventArgs) {
|
|
15
|
-
const selectText = container.find('input[type="text"]').first();
|
|
16
|
-
selectText.simulate(eventType, ...eventArgs);
|
|
17
|
-
const selectList = container.find(_selectList.StyledSelectListContainer).getDOMNode();
|
|
18
|
-
// need to manually trigger a resize to make react-virtual realise that child options should be rendered
|
|
19
|
-
(0, _testUtils.act)(() => {
|
|
20
|
-
resizeObserver.mockElementSize(selectList, {
|
|
21
|
-
contentBoxSize: {
|
|
22
|
-
inlineSize: 500,
|
|
23
|
-
blockSize: 180
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
resizeObserver.resize();
|
|
27
|
-
});
|
|
28
|
-
if (eventType === "focus") jest.runOnlyPendingTimers();
|
|
29
|
-
container.update();
|
|
30
|
-
}
|
|
31
|
-
function simulateDropdownEvent(container, eventType) {
|
|
32
|
-
const dropdown = container.find('[type="dropdown"]').first();
|
|
33
|
-
dropdown.simulate(eventType);
|
|
34
|
-
const selectList = container.find(_selectList.StyledSelectListContainer).getDOMNode();
|
|
35
|
-
// need to manually trigger a resize to make react-virtual realise that child options should be rendered
|
|
36
|
-
(0, _testUtils.act)(() => {
|
|
37
|
-
resizeObserver.mockElementSize(selectList, {
|
|
38
|
-
contentBoxSize: {
|
|
39
|
-
inlineSize: 500,
|
|
40
|
-
blockSize: 180
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
resizeObserver.resize();
|
|
44
|
-
});
|
|
45
|
-
container.update();
|
|
46
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ReactWrapper } from "enzyme";
|
|
2
|
-
import { LayoutProps, FlexboxProps, BackgroundProps, PositionProps, GridProps } from "styled-system";
|
|
3
|
-
import { mockMatchMedia } from "./mock-match-media";
|
|
4
|
-
declare const toCSSCase: (str: string) => string;
|
|
5
|
-
declare const assertStyleMatch: any;
|
|
6
|
-
declare const makeArrayKeys: (n: number) => number[];
|
|
7
|
-
declare const keyboard: Record<string, () => void>;
|
|
8
|
-
declare const simulate: {
|
|
9
|
-
keydown: Record<string, (target: ReactWrapper<any>, { shiftKey }?: {
|
|
10
|
-
shiftKey: boolean;
|
|
11
|
-
} | undefined) => void>;
|
|
12
|
-
};
|
|
13
|
-
declare const listFrom: (wrapper: ReactWrapper) => ReactWrapper;
|
|
14
|
-
declare const childrenFrom: (node: ReactWrapper) => ReactWrapper;
|
|
15
|
-
declare const hoverList: (wrapper: ReactWrapper) => (item: number) => void;
|
|
16
|
-
declare const click: unknown;
|
|
17
|
-
declare const selectedItemOf: (wrapper: ReactWrapper) => number;
|
|
18
|
-
declare const assertKeyboardTraversal: ({ num, nonSelectables, }: {
|
|
19
|
-
num: number;
|
|
20
|
-
nonSelectables?: number[] | undefined;
|
|
21
|
-
}) => (wrapper: ReactWrapper) => void;
|
|
22
|
-
declare const assertHoverTraversal: ({ num, nonSelectables, }: {
|
|
23
|
-
num: number;
|
|
24
|
-
nonSelectables?: number[] | undefined;
|
|
25
|
-
}) => (wrapper: ReactWrapper) => void;
|
|
26
|
-
declare const marginProps: readonly [readonly ["m", "margin"], readonly ["ml", "marginLeft"], readonly ["mr", "marginRight"], readonly ["mt", "marginTop"], readonly ["mb", "marginBottom"], readonly ["mx", "marginLeft"], readonly ["mx", "marginRight"], readonly ["my", "marginTop"], readonly ["my", "marginBottom"]];
|
|
27
|
-
declare type MarginProps = {
|
|
28
|
-
[K in typeof marginProps[number][0]]?: string | number;
|
|
29
|
-
};
|
|
30
|
-
declare const paddingProps: readonly [readonly ["p", "padding"], readonly ["pl", "paddingLeft"], readonly ["pr", "paddingRight"], readonly ["pt", "paddingTop"], readonly ["pb", "paddingBottom"], readonly ["px", "paddingLeft"], readonly ["px", "paddingRight"], readonly ["py", "paddingTop"], readonly ["py", "paddingBottom"]];
|
|
31
|
-
declare type PaddingProps = {
|
|
32
|
-
[K in typeof paddingProps[number][0]]?: string | number;
|
|
33
|
-
};
|
|
34
|
-
export declare const getDefaultValue: (value?: string | number) => string | number | undefined;
|
|
35
|
-
declare const testStyledSystemMargin: (component: (spacingProps?: MarginProps) => JSX.Element, defaults?: MarginProps, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined, assertOpts?: jest.Options) => void;
|
|
36
|
-
declare const testStyledSystemPadding: (component: (spacingProps?: PaddingProps) => JSX.Element, defaults?: PaddingProps, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined, assertOpts?: jest.Options) => void;
|
|
37
|
-
declare const testStyledSystemSpacing: (component: (spacingProps?: MarginProps | PaddingProps) => JSX.Element, defaults?: MarginProps | PaddingProps, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined, assertOpts?: jest.Options) => void;
|
|
38
|
-
declare const testStyledSystemColor: (component: (colorProperties?: any) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => void) | undefined) => void;
|
|
39
|
-
declare const testStyledSystemWidth: (component: (widthProperties?: {
|
|
40
|
-
width: string;
|
|
41
|
-
}) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
42
|
-
declare const testStyledSystemHeight: (component: (heightProperties?: {
|
|
43
|
-
height: string;
|
|
44
|
-
}) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
45
|
-
declare const testStyledSystemLayout: (component: (layoutProperties?: LayoutProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
46
|
-
declare const testStyledSystemFlexBox: (component: (flexboxProperties?: FlexboxProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
47
|
-
declare const testStyledSystemGrid: (component: (gridProperties?: GridProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
48
|
-
declare const testStyledSystemBackground: (component: (backgroundProperties?: BackgroundProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
49
|
-
declare const testStyledSystemPosition: (component: (positionProperties?: PositionProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
50
|
-
declare const expectConsoleOutput: (message: string, type?: "warn" | "error") => () => void;
|
|
51
|
-
export { assertStyleMatch, toCSSCase, hoverList, selectedItemOf, childrenFrom, makeArrayKeys, keyboard, assertKeyboardTraversal, assertHoverTraversal, listFrom, click, simulate, mockMatchMedia, testStyledSystemSpacing, testStyledSystemMargin, testStyledSystemPadding, testStyledSystemColor, testStyledSystemWidth, testStyledSystemHeight, testStyledSystemLayout, testStyledSystemFlexBox, testStyledSystemGrid, testStyledSystemBackground, testStyledSystemPosition, expectConsoleOutput, };
|
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.makeArrayKeys = exports.listFrom = exports.keyboard = exports.hoverList = exports.getDefaultValue = exports.expectConsoleOutput = exports.click = exports.childrenFrom = exports.assertStyleMatch = exports.assertKeyboardTraversal = exports.assertHoverTraversal = void 0;
|
|
7
|
-
Object.defineProperty(exports, "mockMatchMedia", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _mockMatchMedia.mockMatchMedia;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
exports.toCSSCase = exports.testStyledSystemWidth = exports.testStyledSystemSpacing = exports.testStyledSystemPosition = exports.testStyledSystemPadding = exports.testStyledSystemMargin = exports.testStyledSystemLayout = exports.testStyledSystemHeight = exports.testStyledSystemGrid = exports.testStyledSystemFlexBox = exports.testStyledSystemColor = exports.testStyledSystemBackground = exports.simulate = exports.selectedItemOf = void 0;
|
|
14
|
-
var _enzyme = require("enzyme");
|
|
15
|
-
var _sprintfJs = require("sprintf-js");
|
|
16
|
-
var _baseTheme = require("../style/themes/base/base-theme.config");
|
|
17
|
-
var _mockMatchMedia = require("./mock-match-media");
|
|
18
|
-
/* eslint-disable jest/no-conditional-expect */
|
|
19
|
-
/* eslint-disable jest/no-identical-title */
|
|
20
|
-
/* eslint-disable jest/no-export */
|
|
21
|
-
|
|
22
|
-
const isUpper = char => char.toUpperCase() === char;
|
|
23
|
-
const humpToDash = (acc, char) => `${acc}${isUpper(char) ? `-${char.toLowerCase()}` : char}`;
|
|
24
|
-
const toCSSCase = str => {
|
|
25
|
-
return str.split("").reduce(humpToDash, "");
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
exports.toCSSCase = toCSSCase;
|
|
30
|
-
const assertStyleMatch = (styleSpec, component, opts) => {
|
|
31
|
-
Object.entries(styleSpec).forEach(([attr, value]) => {
|
|
32
|
-
expect(component).toHaveStyleRule(toCSSCase(attr), value, opts);
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
exports.assertStyleMatch = assertStyleMatch;
|
|
36
|
-
const makeArrayKeys = n => [...Array(n).keys()];
|
|
37
|
-
exports.makeArrayKeys = makeArrayKeys;
|
|
38
|
-
const dispatchKeyPress = code => {
|
|
39
|
-
const ev = new KeyboardEvent("keydown", {
|
|
40
|
-
key: code
|
|
41
|
-
});
|
|
42
|
-
document.dispatchEvent(ev);
|
|
43
|
-
};
|
|
44
|
-
const keys = ["ArrowUp", "ArrowDown", "ArrowRight", "ArrowLeft", "Enter", "Tab", " ", "Escape", "End", "Home", "D", "E", "P", "Z", "1"];
|
|
45
|
-
const keyboard = exports.keyboard = keys.reduce((acc, key) => {
|
|
46
|
-
const methodName = `press${key === " " ? "Space" : key}`;
|
|
47
|
-
acc[methodName] = () => dispatchKeyPress(key);
|
|
48
|
-
return acc;
|
|
49
|
-
}, {});
|
|
50
|
-
|
|
51
|
-
// Build an object of Enzyme simulate helpers
|
|
52
|
-
// e.g. simulate.keydown.pressTab(target, { shiftKey: true })
|
|
53
|
-
// e.g. simulate.keydown.pressEscape(target)
|
|
54
|
-
const keydown = keys.reduce((acc, key) => {
|
|
55
|
-
const methodName = `press${key === " " ? "Space" : key}`;
|
|
56
|
-
acc[methodName] = (target, {
|
|
57
|
-
shiftKey
|
|
58
|
-
} = {
|
|
59
|
-
shiftKey: false
|
|
60
|
-
}) => {
|
|
61
|
-
target.simulate("keydown", {
|
|
62
|
-
shiftKey,
|
|
63
|
-
key
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
return acc;
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
-
}, {});
|
|
69
|
-
const simulate = exports.simulate = {
|
|
70
|
-
keydown
|
|
71
|
-
};
|
|
72
|
-
const listFrom = wrapper => wrapper.find("ul");
|
|
73
|
-
exports.listFrom = listFrom;
|
|
74
|
-
const childrenFrom = node => node.children();
|
|
75
|
-
exports.childrenFrom = childrenFrom;
|
|
76
|
-
const hoverList = wrapper => item => {
|
|
77
|
-
childrenFrom(listFrom(wrapper)).at(item).simulate("mouseover");
|
|
78
|
-
};
|
|
79
|
-
exports.hoverList = hoverList;
|
|
80
|
-
const simulateEvent = eventName => wrapper => wrapper.simulate(eventName);
|
|
81
|
-
const click = exports.click = simulateEvent("click");
|
|
82
|
-
const selectedItemOf = wrapper => wrapper.state().selectedItem;
|
|
83
|
-
exports.selectedItemOf = selectedItemOf;
|
|
84
|
-
const isUnique = (val, index, self) => self.indexOf(val) === index;
|
|
85
|
-
const isSelectableGiven = nonSelectables => i => !nonSelectables.includes(i);
|
|
86
|
-
const selectedItemReducer = method => wrapper => (acc, i) => {
|
|
87
|
-
method(wrapper)(i);
|
|
88
|
-
return [...acc, selectedItemOf(wrapper)];
|
|
89
|
-
};
|
|
90
|
-
const arraysEqual = (arr1, arr2) => arr1.sort().join(",") === arr2.sort().join(",");
|
|
91
|
-
const assertCorrectTraversal = method => expect => ({
|
|
92
|
-
num,
|
|
93
|
-
nonSelectables = []
|
|
94
|
-
}) => wrapper => {
|
|
95
|
-
const array = makeArrayKeys(num);
|
|
96
|
-
const validIndexes = array.filter(isSelectableGiven(nonSelectables));
|
|
97
|
-
const selectedItem = selectedItemOf(wrapper);
|
|
98
|
-
const indexesThatWereSelected = array.reduce(selectedItemReducer(method)(wrapper), [selectedItem]).filter(isUnique);
|
|
99
|
-
expect(arraysEqual(validIndexes, indexesThatWereSelected)).toBeTruthy();
|
|
100
|
-
};
|
|
101
|
-
const assertKeyboardTraversal = exports.assertKeyboardTraversal = assertCorrectTraversal(() => keyboard.pressArrowDown)(expect);
|
|
102
|
-
const assertHoverTraversal = exports.assertHoverTraversal = assertCorrectTraversal(wrapper => hoverList(wrapper))(expect);
|
|
103
|
-
const marginProps = [["m", "margin"], ["ml", "marginLeft"], ["mr", "marginRight"], ["mt", "marginTop"], ["mb", "marginBottom"], ["mx", "marginLeft"], ["mx", "marginRight"], ["my", "marginTop"], ["my", "marginBottom"]];
|
|
104
|
-
const paddingProps = [["p", "padding"], ["pl", "paddingLeft"], ["pr", "paddingRight"], ["pt", "paddingTop"], ["pb", "paddingBottom"], ["px", "paddingLeft"], ["px", "paddingRight"], ["py", "paddingTop"], ["py", "paddingBottom"]];
|
|
105
|
-
const colorProps = [["color", "color", "#CCCCCC"], ["bg", "background-color", "#FFFFFF"], ["opacity", "opacity", "0.5"]];
|
|
106
|
-
const widthProps = ["width", "width", "200px"];
|
|
107
|
-
const heightProps = ["height", "height", "200px"];
|
|
108
|
-
const layoutProps = [widthProps, heightProps, ["minWidth", "min-width", "120px"], ["maxWidth", "max-width", "120px"], ["minHeight", "min-height", "120px"], ["maxHeight", "max-height", "120px"], ["size", "width", "120px"], ["size", "height", "120px"], ["display", "display", "inline-block"], ["verticalAlign", "vertical-align", "baseline"], ["overflow", "overflow", "hidden"], ["overflowX", "overflow-x", "hidden"], ["overflowY", "overflow-y", "hidden"]];
|
|
109
|
-
const flexBoxProps = [["alignItems", "alignItems", "center"], ["alignContent", "alignContent", "center"], ["justifyItems", "justifyItems", "center"], ["justifyContent", "justifyContent", "center"], ["flexWrap", "flexWrap", "wrap"], ["flexDirection", "flexDirection", "row-reverse"], ["flex", "flex", "1"], ["flexGrow", "flexGrow", "1"], ["flexShrink", "flexShrink", "1"], ["flexBasis", "flexBasis", "100px"], ["justifySelf", "justifySelf", "center"], ["alignSelf", "alignSelf", "center"], ["order", "order", "1"]];
|
|
110
|
-
const gridProps = [["gridColumn", "gridColumn", "1 / span 2"], ["gridRow", "gridRow", "1 / span 2"], ["gridArea", "gridArea", "myArea"], ["gridAutoFlow", "gridAutoFlow", "column"], ["gridAutoRows", "gridAutoRows", "150px"], ["gridAutoColumns", "gridAutoColumns", "50px"], ["gridTemplateRows", "gridTemplateRows", "100px 300px"], ["gridTemplateColumns", "gridTemplateColumns", "auto auto auto auto"], ["gridTemplateAreas", "gridTemplateAreas", "myArea myArea . . ."]];
|
|
111
|
-
const backgroundProps = [["background", "background", "lightblue url('foo.jpg') no-repeat fixed center"], ["backgroundImage", "background-image", "url(foo.jpg)"], ["backgroundSize", "background-size", "center"], ["backgroundRepeat", "background-repeat", "no-repeat"]];
|
|
112
|
-
const positionProps = [["top", "0px"], ["bottom", "0px"], ["right", "0px"], ["left", "0px"], ["position", "fixed"], ["position", "sticky"], ["position", "absolute"], ["position", "static"], ["position", "relative"]];
|
|
113
|
-
const getDefaultValue = value => {
|
|
114
|
-
const spaceArrayLength = _baseTheme.space.length - 1;
|
|
115
|
-
if (value === undefined) return value;
|
|
116
|
-
const parsedValue = +value;
|
|
117
|
-
if (typeof value === "string" && parsedValue > spaceArrayLength) {
|
|
118
|
-
return `${value}px`;
|
|
119
|
-
}
|
|
120
|
-
if (parsedValue <= spaceArrayLength) {
|
|
121
|
-
return _baseTheme.space[parsedValue];
|
|
122
|
-
}
|
|
123
|
-
if (parsedValue > spaceArrayLength) {
|
|
124
|
-
return `${parsedValue * 8}px`;
|
|
125
|
-
}
|
|
126
|
-
return value;
|
|
127
|
-
};
|
|
128
|
-
exports.getDefaultValue = getDefaultValue;
|
|
129
|
-
const testStyledSystemMargin = (component, defaults, styleContainer, assertOpts) => {
|
|
130
|
-
describe("default props", () => {
|
|
131
|
-
let wrapper;
|
|
132
|
-
let StyleElement;
|
|
133
|
-
beforeAll(() => {
|
|
134
|
-
wrapper = (0, _enzyme.mount)(component({
|
|
135
|
-
...defaults
|
|
136
|
-
}));
|
|
137
|
-
StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
138
|
-
});
|
|
139
|
-
it("should set the correct margins", () => {
|
|
140
|
-
let margin;
|
|
141
|
-
let marginLeft;
|
|
142
|
-
let marginRight;
|
|
143
|
-
let marginTop;
|
|
144
|
-
let marginBottom;
|
|
145
|
-
if (defaults) {
|
|
146
|
-
margin = getDefaultValue(defaults.m);
|
|
147
|
-
marginLeft = getDefaultValue(defaults.ml || defaults.mx);
|
|
148
|
-
marginRight = getDefaultValue(defaults.mr || defaults.mx);
|
|
149
|
-
marginTop = getDefaultValue(defaults.mt || defaults.my);
|
|
150
|
-
marginBottom = getDefaultValue(defaults.mb || defaults.my);
|
|
151
|
-
assertStyleMatch({
|
|
152
|
-
margin,
|
|
153
|
-
marginLeft,
|
|
154
|
-
marginRight,
|
|
155
|
-
marginTop,
|
|
156
|
-
marginBottom
|
|
157
|
-
}, StyleElement, assertOpts);
|
|
158
|
-
} else {
|
|
159
|
-
expect(StyleElement).not.toHaveStyleRule("marginLeft");
|
|
160
|
-
expect(StyleElement).not.toHaveStyleRule("marginRight");
|
|
161
|
-
expect(StyleElement).not.toHaveStyleRule("marginTop");
|
|
162
|
-
expect(StyleElement).not.toHaveStyleRule("marginBottom");
|
|
163
|
-
expect(StyleElement).not.toHaveStyleRule("margin");
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
describe.each(marginProps)('when a custom spacing is specified using the "%s" styled system props', (styledSystemProp, propName) => {
|
|
168
|
-
it(`then that ${propName} should have been set correctly`, () => {
|
|
169
|
-
const props = {
|
|
170
|
-
[styledSystemProp]: 2
|
|
171
|
-
};
|
|
172
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
173
|
-
...props
|
|
174
|
-
}));
|
|
175
|
-
assertStyleMatch({
|
|
176
|
-
[propName]: "var(--spacing200)"
|
|
177
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
exports.testStyledSystemMargin = testStyledSystemMargin;
|
|
182
|
-
const testStyledSystemPadding = (component, defaults, styleContainer, assertOpts) => {
|
|
183
|
-
describe("default props", () => {
|
|
184
|
-
let wrapper;
|
|
185
|
-
let StyleElement;
|
|
186
|
-
beforeAll(() => {
|
|
187
|
-
wrapper = (0, _enzyme.mount)(component({
|
|
188
|
-
...defaults
|
|
189
|
-
}));
|
|
190
|
-
StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
191
|
-
});
|
|
192
|
-
it("should set the correct paddings", () => {
|
|
193
|
-
let padding;
|
|
194
|
-
let paddingLeft;
|
|
195
|
-
let paddingRight;
|
|
196
|
-
let paddingTop;
|
|
197
|
-
let paddingBottom;
|
|
198
|
-
if (defaults) {
|
|
199
|
-
padding = getDefaultValue(defaults.p);
|
|
200
|
-
paddingLeft = getDefaultValue(defaults.pl || defaults.px);
|
|
201
|
-
paddingRight = getDefaultValue(defaults.pr || defaults.px);
|
|
202
|
-
paddingTop = getDefaultValue(defaults.pt || defaults.py);
|
|
203
|
-
paddingBottom = getDefaultValue(defaults.pb || defaults.py);
|
|
204
|
-
assertStyleMatch({
|
|
205
|
-
padding,
|
|
206
|
-
paddingLeft,
|
|
207
|
-
paddingRight,
|
|
208
|
-
paddingTop,
|
|
209
|
-
paddingBottom
|
|
210
|
-
}, StyleElement, assertOpts);
|
|
211
|
-
} else {
|
|
212
|
-
expect(StyleElement).not.toHaveStyleRule("paddingLeft");
|
|
213
|
-
expect(StyleElement).not.toHaveStyleRule("paddingRight");
|
|
214
|
-
expect(StyleElement).not.toHaveStyleRule("paddingTop");
|
|
215
|
-
expect(StyleElement).not.toHaveStyleRule("paddingBottom");
|
|
216
|
-
expect(StyleElement).not.toHaveStyleRule("padding");
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
describe.each(paddingProps)('when a custom spacing is specified using the "%s" styled system props', (styledSystemProp, propName) => {
|
|
221
|
-
it(`then that ${propName} should have been set correctly`, () => {
|
|
222
|
-
const props = {
|
|
223
|
-
[styledSystemProp]: 2
|
|
224
|
-
};
|
|
225
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
226
|
-
...props
|
|
227
|
-
}));
|
|
228
|
-
assertStyleMatch({
|
|
229
|
-
[propName]: "var(--spacing200)"
|
|
230
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper, assertOpts);
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
};
|
|
234
|
-
exports.testStyledSystemPadding = testStyledSystemPadding;
|
|
235
|
-
const testStyledSystemSpacing = (component, defaults, styleContainer, assertOpts) => {
|
|
236
|
-
testStyledSystemMargin(component, defaults, styleContainer, assertOpts);
|
|
237
|
-
testStyledSystemPadding(component, defaults, styleContainer, assertOpts);
|
|
238
|
-
};
|
|
239
|
-
exports.testStyledSystemSpacing = testStyledSystemSpacing;
|
|
240
|
-
const testStyledSystemColor = (component, styleContainer) => {
|
|
241
|
-
describe.each(colorProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
242
|
-
it(`then ${propName} should have been set correctly`, () => {
|
|
243
|
-
const props = {
|
|
244
|
-
[styledSystemProp]: value
|
|
245
|
-
};
|
|
246
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
247
|
-
...props
|
|
248
|
-
}));
|
|
249
|
-
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
250
|
-
// Some props need to have camelcase so used toHaveStyleRule rather than assertStyleMatch
|
|
251
|
-
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
};
|
|
255
|
-
exports.testStyledSystemColor = testStyledSystemColor;
|
|
256
|
-
const testStyledSystemWidth = (component, styleContainer) => {
|
|
257
|
-
describe("when a width prop is specified using styled system props", () => {
|
|
258
|
-
it("then width should have been set correctly", () => {
|
|
259
|
-
const [styledSystemProp, propName, value] = widthProps;
|
|
260
|
-
const props = {
|
|
261
|
-
[styledSystemProp]: value
|
|
262
|
-
};
|
|
263
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
264
|
-
...props
|
|
265
|
-
}));
|
|
266
|
-
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
267
|
-
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
exports.testStyledSystemWidth = testStyledSystemWidth;
|
|
272
|
-
const testStyledSystemHeight = (component, styleContainer) => {
|
|
273
|
-
describe("when a height prop is specified using styled system props", () => {
|
|
274
|
-
it("then height should have been set correctly", () => {
|
|
275
|
-
const [styledSystemProp, propName, value] = heightProps;
|
|
276
|
-
const props = {
|
|
277
|
-
[styledSystemProp]: value
|
|
278
|
-
};
|
|
279
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
280
|
-
...props
|
|
281
|
-
}));
|
|
282
|
-
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
283
|
-
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
|
-
exports.testStyledSystemHeight = testStyledSystemHeight;
|
|
288
|
-
const testStyledSystemLayout = (component, styleContainer) => {
|
|
289
|
-
describe.each(layoutProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
290
|
-
it(`then ${propName} should have been set correctly`, () => {
|
|
291
|
-
const props = {
|
|
292
|
-
[styledSystemProp]: value
|
|
293
|
-
};
|
|
294
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
295
|
-
...props
|
|
296
|
-
}));
|
|
297
|
-
const StyleElement = styleContainer ? styleContainer(wrapper) : wrapper;
|
|
298
|
-
// Some props need to have camelcase so used toHaveStyleRule rather than assertStyleMatch
|
|
299
|
-
expect(StyleElement).toHaveStyleRule(propName, value);
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
exports.testStyledSystemLayout = testStyledSystemLayout;
|
|
304
|
-
const testStyledSystemFlexBox = (component, styleContainer) => {
|
|
305
|
-
describe.each(flexBoxProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
306
|
-
it(`then ${propName} should have been set correctly`, () => {
|
|
307
|
-
const props = {
|
|
308
|
-
[styledSystemProp]: value
|
|
309
|
-
};
|
|
310
|
-
const wrapper = (0, _enzyme.mount)(component(props));
|
|
311
|
-
assertStyleMatch({
|
|
312
|
-
[propName]: value
|
|
313
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
exports.testStyledSystemFlexBox = testStyledSystemFlexBox;
|
|
318
|
-
const testStyledSystemGrid = (component, styleContainer) => {
|
|
319
|
-
describe.each(gridProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
320
|
-
it(`then ${propName} should have been set correctly`, () => {
|
|
321
|
-
const props = {
|
|
322
|
-
[styledSystemProp]: value
|
|
323
|
-
};
|
|
324
|
-
const wrapper = (0, _enzyme.mount)(component(props));
|
|
325
|
-
assertStyleMatch({
|
|
326
|
-
[propName]: value
|
|
327
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
};
|
|
331
|
-
exports.testStyledSystemGrid = testStyledSystemGrid;
|
|
332
|
-
const testStyledSystemBackground = (component, styleContainer) => {
|
|
333
|
-
describe.each(backgroundProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
334
|
-
it(`then ${propName} should have been set correctly`, () => {
|
|
335
|
-
const props = {
|
|
336
|
-
[styledSystemProp]: value
|
|
337
|
-
};
|
|
338
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
339
|
-
...props
|
|
340
|
-
}));
|
|
341
|
-
assertStyleMatch({
|
|
342
|
-
[styledSystemProp]: value
|
|
343
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
exports.testStyledSystemBackground = testStyledSystemBackground;
|
|
348
|
-
const testStyledSystemPosition = (component, styleContainer) => {
|
|
349
|
-
describe.each(positionProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, value) => {
|
|
350
|
-
it(`then ${styledSystemProp} should have been set correctly`, () => {
|
|
351
|
-
const props = {
|
|
352
|
-
[styledSystemProp]: value
|
|
353
|
-
};
|
|
354
|
-
const wrapper = (0, _enzyme.mount)(component({
|
|
355
|
-
...props
|
|
356
|
-
}));
|
|
357
|
-
assertStyleMatch({
|
|
358
|
-
[styledSystemProp]: value
|
|
359
|
-
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
// this util will catch that a console output occurred without polluting the output when running the unit tests
|
|
365
|
-
exports.testStyledSystemPosition = testStyledSystemPosition;
|
|
366
|
-
const expectConsoleOutput = (message, type = "error") => {
|
|
367
|
-
if (!message) {
|
|
368
|
-
throw new Error(`no ${type} message provided`);
|
|
369
|
-
}
|
|
370
|
-
expect.assertions(1);
|
|
371
|
-
const consoleType = global.console[type];
|
|
372
|
-
let consoleArgs;
|
|
373
|
-
jest.spyOn(global.console, type).mockImplementation((...args) => {
|
|
374
|
-
if (!args.length) return;
|
|
375
|
-
const msg = args.join(" ");
|
|
376
|
-
const params = args.slice(1, args.length);
|
|
377
|
-
if ((0, _sprintfJs.sprintf)(msg, ...params).includes(message)) {
|
|
378
|
-
consoleArgs = args;
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
consoleType(...args);
|
|
382
|
-
});
|
|
383
|
-
return () => {
|
|
384
|
-
if (consoleArgs) {
|
|
385
|
-
// eslint-disable-next-line no-console
|
|
386
|
-
expect(console[type]).toHaveBeenCalledWith(...consoleArgs);
|
|
387
|
-
}
|
|
388
|
-
global.console[type] = consoleType;
|
|
389
|
-
};
|
|
390
|
-
};
|
|
391
|
-
exports.expectConsoleOutput = expectConsoleOutput;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from "react";
|
|
2
|
-
declare type TopModalContextProps = {
|
|
3
|
-
topModal: HTMLElement | null;
|
|
4
|
-
};
|
|
5
|
-
declare const TopModalContext: React.Context<TopModalContextProps>;
|
|
6
|
-
export declare const TopModalContextProvider: ({ children, }: {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}) => React.JSX.Element;
|
|
9
|
-
export default TopModalContext;
|
|
File without changes
|
/package/esm/__internal__/form-spacing-provider/{form-spacing-context.js → form-spacing.context.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/esm/components/date-range/{date-range.context.d.ts → __internal__/date-range.context.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/esm/components/select/{list-action-button → __internal__/list-action-button}/index.d.ts
RENAMED
|
File without changes
|
/package/esm/components/select/{list-action-button → __internal__/list-action-button}/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/esm/components/select/{select-list → __internal__/select-list}/select-list.component.d.ts
RENAMED
|
File without changes
|