@patternfly/react-core 4.202.30 → 4.202.33
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 +24 -0
- package/dist/esm/components/Wizard/Wizard.d.ts +2 -0
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +3 -2
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/Wizard/WizardHeader.d.ts +2 -0
- package/dist/esm/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardHeader.js +2 -2
- package/dist/esm/components/Wizard/WizardHeader.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +2 -0
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +3 -2
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/Wizard/WizardHeader.d.ts +2 -0
- package/dist/js/components/Wizard/WizardHeader.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardHeader.js +2 -2
- package/dist/js/components/Wizard/WizardHeader.js.map +1 -1
- package/dist/umd/react-core.js +5 -4
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +1 -1
- package/src/components/Page/__tests__/Page.test.tsx +225 -205
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +1088 -2059
- package/src/components/Pagination/__tests__/Pagination.test.tsx +235 -283
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +143 -577
- package/src/components/Radio/__tests__/Radio.test.tsx +38 -44
- package/src/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +30 -30
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +87 -68
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +230 -137
- package/src/components/Select/__tests__/Select.test.tsx +238 -195
- package/src/components/Select/__tests__/SelectToggle.test.tsx +68 -130
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +978 -2149
- package/src/components/Select/__tests__/__snapshots__/SelectToggle.test.tsx.snap +3 -3
- package/src/components/SimpleList/__tests__/SimpleList.test.tsx +29 -32
- package/src/components/SimpleList/__tests__/__snapshots__/SimpleList.test.tsx.snap +4 -366
- package/src/components/Switch/__tests__/Switch.test.tsx +85 -75
- package/src/components/Switch/__tests__/__snapshots__/Switch.test.tsx.snap +30 -40
- package/src/components/TextArea/__tests__/TextArea.test.tsx +98 -103
- package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +24 -103
- package/src/components/TextInput/__tests__/TextInput.test.tsx +71 -70
- package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +15 -103
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +65 -39
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +53 -14
- package/src/components/TimePicker/__tests__/TimePicker.test.tsx +113 -110
- package/src/components/Title/__tests__/Title.test.tsx +21 -20
- package/src/components/Title/__tests__/__snapshots__/Title.test.tsx.snap +24 -30
- package/src/components/ToggleGroup/__tests__/ToggleGroup.test.tsx +43 -39
- package/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap +20 -19
- package/src/components/Wizard/Wizard.tsx +5 -0
- package/src/components/Wizard/WizardHeader.tsx +5 -2
- package/src/components/Wizard/__tests__/Wizard.test.tsx +195 -189
- package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +131 -10
- package/src/components/Wizard/examples/Wizard.md +168 -103
- package/src/helpers/__tests__/util.test.ts +113 -0
- package/src/layouts/Bullseye/__tests__/Bullseye.test.tsx +25 -25
- package/src/layouts/Bullseye/__tests__/__snapshots__/Bullseye.test.tsx.snap +3 -5
- package/src/layouts/Flex/__tests__/Flex.test.tsx +159 -96
- package/src/layouts/Flex/__tests__/__snapshots__/Flex.test.tsx.snap +9 -17
- package/src/components/AboutModal/__tests__/Generated/AboutModal.test.tsx +0 -27
- package/src/components/AboutModal/__tests__/Generated/AboutModalBox.test.tsx +0 -13
- package/src/components/AboutModal/__tests__/Generated/AboutModalBoxBrand.test.tsx +0 -13
- package/src/components/AboutModal/__tests__/Generated/AboutModalBoxCloseButton.test.tsx +0 -13
- package/src/components/AboutModal/__tests__/Generated/AboutModalBoxContent.test.tsx +0 -21
- package/src/components/AboutModal/__tests__/Generated/AboutModalBoxHeader.test.tsx +0 -13
- package/src/components/AboutModal/__tests__/Generated/AboutModalBoxHero.test.tsx +0 -13
- package/src/components/AboutModal/__tests__/Generated/AboutModalContainer.test.tsx +0 -27
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModal.test.tsx.snap +0 -3
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBox.test.tsx.snap +0 -15
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxBrand.test.tsx.snap +0 -15
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap +0 -33
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxContent.test.tsx.snap +0 -27
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxHeader.test.tsx.snap +0 -19
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalBoxHero.test.tsx.snap +0 -10
- package/src/components/AboutModal/__tests__/Generated/__snapshots__/AboutModalContainer.test.tsx.snap +0 -3
- package/src/components/Accordion/__tests__/Generated/Accordion.test.tsx +0 -22
- package/src/components/Accordion/__tests__/Generated/__snapshots__/Accordion.test.tsx.snap +0 -12
- package/src/components/Alert/__tests__/Generated/Alert.test.tsx +0 -26
- package/src/components/Alert/__tests__/Generated/__snapshots__/Alert.test.tsx.snap +0 -47
- package/src/components/ApplicationLauncher/__tests__/Generated/ApplicationLauncher.test.tsx +0 -36
- package/src/components/ApplicationLauncher/__tests__/Generated/__snapshots__/ApplicationLauncher.test.tsx.snap +0 -30
- package/src/components/Avatar/__tests__/Generated/Avatar.test.tsx +0 -13
- package/src/components/Avatar/__tests__/Generated/__snapshots__/Avatar.test.tsx.snap +0 -11
- package/src/components/Backdrop/__tests__/Generated/Backdrop.test.tsx +0 -13
- package/src/components/Backdrop/__tests__/Generated/__snapshots__/Backdrop.test.tsx.snap +0 -11
- package/src/components/BackgroundImage/__tests__/Generated/BackgroundImage.test.tsx +0 -13
- package/src/components/BackgroundImage/__tests__/Generated/__snapshots__/BackgroundImage.test.tsx.snap +0 -47
- package/src/components/Badge/__tests__/Generated/Badge.test.tsx +0 -13
- package/src/components/Badge/__tests__/Generated/__snapshots__/Badge.test.tsx.snap +0 -9
- package/src/components/Brand/__tests__/Generated/Brand.test.tsx +0 -13
- package/src/components/Brand/__tests__/Generated/__snapshots__/Brand.test.tsx.snap +0 -11
- package/src/components/Breadcrumb/__tests__/Generated/Breadcrumb.test.tsx +0 -13
- package/src/components/Breadcrumb/__tests__/Generated/BreadcrumbHeading.test.tsx +0 -15
- package/src/components/Breadcrumb/__tests__/Generated/BreadcrumbItem.test.tsx +0 -22
- package/src/components/Breadcrumb/__tests__/Generated/__snapshots__/Breadcrumb.test.tsx.snap +0 -19
- package/src/components/Breadcrumb/__tests__/Generated/__snapshots__/BreadcrumbHeading.test.tsx.snap +0 -22
- package/src/components/Breadcrumb/__tests__/Generated/__snapshots__/BreadcrumbItem.test.tsx.snap +0 -17
- package/src/components/Button/__tests__/Generated/Button.test.tsx +0 -31
- package/src/components/Button/__tests__/Generated/__snapshots__/Button.test.tsx.snap +0 -17
- package/src/components/Card/__tests__/Generated/Card.test.tsx +0 -15
- package/src/components/Card/__tests__/Generated/CardBody.test.tsx +0 -13
- package/src/components/Card/__tests__/Generated/CardFooter.test.tsx +0 -13
- package/src/components/Card/__tests__/Generated/CardHead.test.tsx +0 -13
- package/src/components/Card/__tests__/Generated/CardHeader.test.tsx +0 -13
- package/src/components/Card/__tests__/Generated/__snapshots__/Card.test.tsx.snap +0 -15
- package/src/components/Card/__tests__/Generated/__snapshots__/CardBody.test.tsx.snap +0 -11
- package/src/components/Card/__tests__/Generated/__snapshots__/CardFooter.test.tsx.snap +0 -11
- package/src/components/Card/__tests__/Generated/__snapshots__/CardHead.test.tsx.snap +0 -11
- package/src/components/Card/__tests__/Generated/__snapshots__/CardHeader.test.tsx.snap +0 -11
- package/src/components/Checkbox/__tests__/Generated/Checkbox.test.tsx +0 -26
- package/src/components/Checkbox/__tests__/Generated/__snapshots__/Checkbox.test.tsx.snap +0 -35
- package/src/components/Chip/__tests__/Generated/Chip.test.tsx +0 -24
- package/src/components/Chip/__tests__/Generated/__snapshots__/Chip.test.tsx.snap +0 -46
- package/src/components/ChipGroup/__tests__/Generated/ChipGroup.test.tsx +0 -24
- package/src/components/ChipGroup/__tests__/Generated/__snapshots__/ChipGroup.test.tsx.snap +0 -33
- package/src/components/ClipboardCopy/__tests__/Generated/ClipboardCopyButton.test.tsx +0 -26
- package/src/components/ClipboardCopy/__tests__/Generated/ClipboardCopyExpanded.test.tsx +0 -21
- package/src/components/ClipboardCopy/__tests__/Generated/ClipboardCopyToggle.test.tsx +0 -22
- package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopyButton.test.tsx.snap +0 -31
- package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopyExpanded.test.tsx.snap +0 -14
- package/src/components/ClipboardCopy/__tests__/Generated/__snapshots__/ClipboardCopyToggle.test.tsx.snap +0 -32
- package/src/components/ContextSelector/__tests__/Generated/ContextSelector.test.tsx +0 -28
- package/src/components/ContextSelector/__tests__/Generated/ContextSelectorItem.test.tsx +0 -23
- package/src/components/ContextSelector/__tests__/Generated/ContextSelectorMenuList.test.tsx +0 -13
- package/src/components/ContextSelector/__tests__/Generated/ContextSelectorToggle.test.tsx +0 -26
- package/src/components/ContextSelector/__tests__/Generated/__snapshots__/ContextSelector.test.tsx.snap +0 -49
- package/src/components/ContextSelector/__tests__/Generated/__snapshots__/ContextSelectorItem.test.tsx.snap +0 -15
- package/src/components/ContextSelector/__tests__/Generated/__snapshots__/ContextSelectorMenuList.test.tsx.snap +0 -12
- package/src/components/ContextSelector/__tests__/Generated/__snapshots__/ContextSelectorToggle.test.tsx.snap +0 -35
- package/src/components/DataList/__tests__/Generated/DataList.test.tsx +0 -21
- package/src/components/DataList/__tests__/Generated/__snapshots__/DataList.test.tsx.snap +0 -12
- package/src/components/Divider/__tests__/Generated/Divider.test.tsx +0 -13
- package/src/components/Divider/__tests__/Generated/__snapshots__/Divider.test.tsx.snap +0 -9
- package/src/components/Drawer/__tests__/Generated/Drawer.test.tsx +0 -13
- package/src/components/Drawer/__tests__/Generated/__snapshots__/Drawer.test.tsx.snap +0 -13
- package/src/components/Dropdown/__tests__/Generated/Dropdown.test.tsx +0 -27
- package/src/components/Dropdown/__tests__/Generated/DropdownGroup.test.tsx +0 -13
- package/src/components/Dropdown/__tests__/Generated/DropdownToggle.test.tsx +0 -34
- package/src/components/Dropdown/__tests__/Generated/DropdownToggleAction.test.tsx +0 -22
- package/src/components/Dropdown/__tests__/Generated/DropdownToggleCheckbox.test.tsx +0 -25
- package/src/components/Dropdown/__tests__/Generated/Toggle.test.tsx +0 -31
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/Dropdown.test.tsx.snap +0 -27
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownGroup.test.tsx.snap +0 -16
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownToggle.test.tsx.snap +0 -34
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownToggleAction.test.tsx.snap +0 -15
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/DropdownToggleCheckbox.test.tsx.snap +0 -30
- package/src/components/Dropdown/__tests__/Generated/__snapshots__/Toggle.test.tsx.snap +0 -17
- package/src/components/EmptyState/__tests__/Generated/EmptyState.test.tsx +0 -13
- package/src/components/EmptyState/__tests__/Generated/__snapshots__/EmptyState.test.tsx.snap +0 -17
- package/src/components/ExpandableSection/__tests__/Generated/ExpandableSection.test.tsx +0 -24
- package/src/components/ExpandableSection/__tests__/Generated/__snapshots__/ExpandableSection.test.tsx.snap +0 -46
- package/src/components/Form/__tests__/Generated/ActionGroup.test.tsx +0 -13
- package/src/components/Form/__tests__/Generated/Form.test.tsx +0 -13
- package/src/components/Form/__tests__/Generated/FormGroup.test.tsx +0 -27
- package/src/components/Form/__tests__/Generated/FormHelperText.test.tsx +0 -13
- package/src/components/Form/__tests__/Generated/__snapshots__/ActionGroup.test.tsx.snap +0 -19
- package/src/components/Form/__tests__/Generated/__snapshots__/Form.test.tsx.snap +0 -12
- package/src/components/Form/__tests__/Generated/__snapshots__/FormGroup.test.tsx.snap +0 -38
- package/src/components/Form/__tests__/Generated/__snapshots__/FormHelperText.test.tsx.snap +0 -11
- package/src/components/FormSelect/__tests__/Generated/FormSelect.test.tsx +0 -26
- package/src/components/FormSelect/__tests__/Generated/__snapshots__/FormSelect.test.tsx.snap +0 -18
- package/src/components/InputGroup/__tests__/Generated/InputGroup.test.tsx +0 -13
- package/src/components/InputGroup/__tests__/Generated/InputGroupText.test.tsx +0 -13
- package/src/components/InputGroup/__tests__/Generated/__snapshots__/InputGroup.test.tsx.snap +0 -13
- package/src/components/InputGroup/__tests__/Generated/__snapshots__/InputGroupText.test.tsx.snap +0 -13
- package/src/components/Label/__tests__/Generated/Label.test.tsx +0 -13
- package/src/components/Label/__tests__/Generated/__snapshots__/Label.test.tsx.snap +0 -17
- package/src/components/LabelGroup/__tests__/Generated/LabelGroup.test.tsx +0 -29
- package/src/components/LabelGroup/__tests__/Generated/__snapshots__/LabelGroup.test.tsx.snap +0 -34
- package/src/components/LoginPage/__tests__/Generated/Login.test.tsx +0 -13
- package/src/components/LoginPage/__tests__/Generated/LoginFooterItem.test.tsx +0 -13
- package/src/components/LoginPage/__tests__/Generated/LoginForm.test.tsx +0 -34
- package/src/components/LoginPage/__tests__/Generated/LoginMainBody.test.tsx +0 -13
- package/src/components/LoginPage/__tests__/Generated/LoginMainFooter.test.tsx +0 -21
- package/src/components/LoginPage/__tests__/Generated/LoginMainFooterBandItem.test.tsx +0 -13
- package/src/components/LoginPage/__tests__/Generated/LoginMainFooterLinksItem.test.tsx +0 -22
- package/src/components/LoginPage/__tests__/Generated/LoginMainHeader.test.tsx +0 -13
- package/src/components/LoginPage/__tests__/Generated/LoginPage.test.tsx +0 -30
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/Login.test.tsx.snap +0 -19
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginFooterItem.test.tsx.snap +0 -7
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginForm.test.tsx.snap +0 -150
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginMainBody.test.tsx.snap +0 -11
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginMainFooter.test.tsx.snap +0 -11
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginMainFooterBandItem.test.tsx.snap +0 -11
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginMainFooterLinksItem.test.tsx.snap +0 -17
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginMainHeader.test.tsx.snap +0 -24
- package/src/components/LoginPage/__tests__/Generated/__snapshots__/LoginPage.test.tsx.snap +0 -60
- package/src/components/Modal/__tests__/Generated/Modal.test.tsx +0 -35
- package/src/components/Modal/__tests__/Generated/ModalBox.test.tsx +0 -22
- package/src/components/Modal/__tests__/Generated/ModalBoxBody.test.tsx +0 -13
- package/src/components/Modal/__tests__/Generated/ModalBoxCloseButton.test.tsx +0 -13
- package/src/components/Modal/__tests__/Generated/ModalBoxDescription.test.tsx +0 -13
- package/src/components/Modal/__tests__/Generated/ModalBoxFooter.test.tsx +0 -13
- package/src/components/Modal/__tests__/Generated/ModalBoxHeader.test.tsx +0 -13
- package/src/components/Modal/__tests__/Generated/ModalContent.test.tsx +0 -36
- package/src/components/Modal/__tests__/Generated/__snapshots__/Modal.test.tsx.snap +0 -3
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalBox.test.tsx.snap +0 -18
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxBody.test.tsx.snap +0 -11
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxCloseButton.test.tsx.snap +0 -29
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxDescription.test.tsx.snap +0 -12
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxFooter.test.tsx.snap +0 -11
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalBoxHeader.test.tsx.snap +0 -11
- package/src/components/Modal/__tests__/Generated/__snapshots__/ModalContent.test.tsx.snap +0 -3
- package/src/components/Nav/__tests__/Generated/Nav.test.tsx +0 -22
- package/src/components/Nav/__tests__/Generated/__snapshots__/Nav.test.tsx.snap +0 -15
- package/src/components/NotificationBadge/__tests__/Generated/NotificationBadge.test.tsx +0 -15
- package/src/components/NotificationBadge/__tests__/Generated/__snapshots__/NotificationBadge.test.tsx.snap +0 -23
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawer.test.tsx +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerBody.test.tsx +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerGroup.test.tsx +0 -23
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerGroupList.test.tsx +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerHeader.test.tsx +0 -15
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerList.test.tsx +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerListItem.test.tsx +0 -22
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerListItemBody.test.tsx +0 -15
- package/src/components/NotificationDrawer/__tests__/Generated/NotificationDrawerListItemHeader.test.tsx +0 -22
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawer.test.tsx.snap +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerBody.test.tsx.snap +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerGroup.test.tsx.snap +0 -51
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerGroupList.test.tsx.snap +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerHeader.test.tsx.snap +0 -31
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerList.test.tsx.snap +0 -13
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerListItem.test.tsx.snap +0 -14
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerListItemBody.test.tsx.snap +0 -20
- package/src/components/NotificationDrawer/__tests__/Generated/__snapshots__/NotificationDrawerListItemHeader.test.tsx.snap +0 -44
- package/src/components/OptionsMenu/__tests__/Generated/OptionsMenu.test.tsx +0 -26
- package/src/components/OptionsMenu/__tests__/Generated/__snapshots__/OptionsMenu.test.tsx.snap +0 -24
- package/src/components/OverflowMenu/__tests__/Generated/OverflowMenu.test.tsx +0 -13
- package/src/components/OverflowMenu/__tests__/Generated/OverflowMenuContent.test.tsx +0 -13
- package/src/components/OverflowMenu/__tests__/Generated/OverflowMenuGroup.test.tsx +0 -15
- package/src/components/OverflowMenu/__tests__/Generated/OverflowMenuItem.test.tsx +0 -13
- package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenu.test.tsx.snap +0 -11
- package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuContent.test.tsx.snap +0 -11
- package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuGroup.test.tsx.snap +0 -11
- package/src/components/OverflowMenu/__tests__/Generated/__snapshots__/OverflowMenuItem.test.tsx.snap +0 -13
- package/src/components/Page/__tests__/Generated/Page.test.tsx +0 -28
- package/src/components/Page/__tests__/Generated/PageHeader.test.tsx +0 -28
- package/src/components/Page/__tests__/Generated/PageSection.test.tsx +0 -22
- package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +0 -19
- package/src/components/Page/__tests__/Generated/__snapshots__/PageHeader.test.tsx.snap +0 -10
- package/src/components/Page/__tests__/Generated/__snapshots__/PageSection.test.tsx.snap +0 -13
- package/src/components/Pagination/__tests__/Generated/Pagination.test.tsx +0 -58
- package/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +0 -205
- package/src/components/Popover/__tests__/Generated/Popover.test.tsx +0 -40
- package/src/components/Popover/__tests__/Generated/__snapshots__/Popover.test.tsx.snap +0 -9
- package/src/components/Progress/__tests__/Generated/Progress.test.tsx +0 -27
- package/src/components/Progress/__tests__/Generated/__snapshots__/Progress.test.tsx.snap +0 -63
- package/src/components/Radio/__tests__/Generated/Radio.test.tsx +0 -29
- package/src/components/Radio/__tests__/Generated/__snapshots__/Radio.test.tsx.snap +0 -36
- package/src/components/Select/__tests__/Generated/Select.test.tsx +0 -49
- package/src/components/Select/__tests__/Generated/SelectToggle.test.tsx +0 -34
- package/src/components/Select/__tests__/Generated/__snapshots__/Select.test.tsx.snap +0 -48
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectToggle.test.tsx.snap +0 -36
- package/src/components/SimpleList/__tests__/Generated/SimpleList.test.tsx +0 -22
- package/src/components/SimpleList/__tests__/Generated/__snapshots__/SimpleList.test.tsx.snap +0 -13
- package/src/components/SkipToContent/__tests__/Generated/SkipToContent.test.tsx +0 -15
- package/src/components/SkipToContent/__tests__/Generated/__snapshots__/SkipToContent.test.tsx.snap +0 -15
- package/src/components/Spinner/__tests__/Generated/Spinner.test.tsx +0 -13
- package/src/components/Spinner/__tests__/Generated/__snapshots__/Spinner.test.tsx.snap +0 -22
- package/src/components/Switch/__tests__/Generated/Switch.test.tsx +0 -24
- package/src/components/Switch/__tests__/Generated/__snapshots__/Switch.test.tsx.snap +0 -36
- package/src/components/Tabs/__tests__/Generated/TabButton.test.tsx +0 -20
- package/src/components/Tabs/__tests__/Generated/Tabs.test.tsx +0 -29
- package/src/components/Tabs/__tests__/Generated/__snapshots__/TabButton.test.tsx.snap +0 -16
- package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +0 -75
- package/src/components/Text/__tests__/Generated/Text.test.tsx +0 -13
- package/src/components/Text/__tests__/Generated/__snapshots__/Text.test.tsx.snap +0 -15
- package/src/components/TextArea/__tests__/Generated/TextArea.test.tsx +0 -23
- package/src/components/TextArea/__tests__/Generated/__snapshots__/TextArea.test.tsx.snap +0 -13
- package/src/components/Title/__tests__/Generated/Title.test.tsx +0 -13
- package/src/components/Title/__tests__/Generated/__snapshots__/Title.test.tsx.snap +0 -12
- package/src/components/Toolbar/__tests__/Generated/Toolbar.test.tsx +0 -24
- package/src/components/Toolbar/__tests__/Generated/ToolbarItem.test.tsx +0 -20
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/Toolbar.test.tsx.snap +0 -25
- package/src/components/Toolbar/__tests__/Generated/__snapshots__/ToolbarItem.test.tsx.snap +0 -14
- package/src/components/Tooltip/__tests__/Generated/Tooltip.test.tsx +0 -33
- package/src/components/Tooltip/__tests__/Generated/__snapshots__/Tooltip.test.tsx.snap +0 -9
- package/src/helpers/__tests__/util.test.js +0 -235
- package/src/layouts/Bullseye/__tests__/Generated/Bullseye.test.tsx +0 -13
- package/src/layouts/Bullseye/__tests__/Generated/__snapshots__/Bullseye.test.tsx.snap +0 -11
- package/src/layouts/Flex/__tests__/Generated/Flex.test.tsx +0 -13
- package/src/layouts/Flex/__tests__/Generated/__snapshots__/Flex.test.tsx.snap +0 -11
- package/src/layouts/Gallery/__tests__/Generated/Gallery.test.tsx +0 -13
- package/src/layouts/Gallery/__tests__/Generated/__snapshots__/Gallery.test.tsx.snap +0 -11
- package/src/layouts/Grid/__tests__/Generated/Grid.test.tsx +0 -15
- package/src/layouts/Grid/__tests__/Generated/GridItem.test.tsx +0 -36
- package/src/layouts/Grid/__tests__/Generated/__snapshots__/Grid.test.tsx.snap +0 -11
- package/src/layouts/Grid/__tests__/Generated/__snapshots__/GridItem.test.tsx.snap +0 -11
- package/src/layouts/Level/__tests__/Generated/Level.test.tsx +0 -13
- package/src/layouts/Level/__tests__/Generated/__snapshots__/Level.test.tsx.snap +0 -11
- package/src/layouts/Split/__tests__/Generated/Split.test.tsx +0 -13
- package/src/layouts/Split/__tests__/Generated/__snapshots__/Split.test.tsx.snap +0 -11
- package/src/layouts/Stack/__tests__/Generated/Stack.test.tsx +0 -13
- package/src/layouts/Stack/__tests__/Generated/__snapshots__/Stack.test.tsx.snap +0 -11
|
@@ -1,332 +1,284 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import { mount } from 'enzyme';
|
|
4
|
-
import { Pagination, PaginationVariant } from '../index';
|
|
5
|
-
|
|
6
|
-
describe('component render', () => {
|
|
7
|
-
test('should render correctly top', () => {
|
|
8
|
-
const wrapper = render(<Pagination itemCount={20} />);
|
|
9
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('should render correctly compact', () => {
|
|
18
|
-
const wrapper = render(<Pagination itemCount={20} isCompact />);
|
|
19
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
20
|
-
});
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
21
6
|
|
|
22
|
-
|
|
23
|
-
const wrapper = render(<Pagination itemCount={20} isSticky />);
|
|
24
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('should render correctly bottom sticky', () => {
|
|
28
|
-
const wrapper = render(<Pagination itemCount={20} variant={PaginationVariant.bottom} isSticky />);
|
|
29
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('should render correctly disabled', () => {
|
|
33
|
-
const wrapper = render(<Pagination itemCount={20} isDisabled />);
|
|
34
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('limited number of pages', () => {
|
|
38
|
-
const wrapper = render(<Pagination itemCount={20} perPage={20} />);
|
|
39
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('zero results', () => {
|
|
43
|
-
const wrapper = render(<Pagination itemCount={0} />);
|
|
44
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('last page', () => {
|
|
48
|
-
const wrapper = render(<Pagination itemCount={20} perPage={10} page={2} />);
|
|
49
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('custom perPageOptions', () => {
|
|
53
|
-
const wrapper = render(<Pagination itemCount={40} perPageOptions={[{ title: 'some', value: 1 }]} />);
|
|
54
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('empty per page options', () => {
|
|
58
|
-
const wrapper = render(<Pagination itemCount={40} perPageOptions={[]} />);
|
|
59
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('no items', () => {
|
|
63
|
-
const wrapper = render(<Pagination itemCount={0} />);
|
|
64
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
test('custom start end', () => {
|
|
68
|
-
const wrapper = render(<Pagination itemCount={40} itemsStart={5} itemsEnd={15} />);
|
|
69
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('titles', () => {
|
|
73
|
-
const wrapper = render(<Pagination itemCount={40} titles={{ items: 'values', page: 'books' }} />);
|
|
74
|
-
expect(wrapper.container).toMatchSnapshot();
|
|
75
|
-
});
|
|
7
|
+
import { Pagination, PaginationVariant } from '../index';
|
|
76
8
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
9
|
+
describe('Pagination', () => {
|
|
10
|
+
describe('component render', () => {
|
|
11
|
+
test('should render correctly top', () => {
|
|
12
|
+
const { asFragment } = render(<Pagination itemCount={20} />);
|
|
13
|
+
expect(asFragment()).toMatchSnapshot();
|
|
14
|
+
});
|
|
84
15
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
16
|
+
test('should render correctly bottom', () => {
|
|
17
|
+
const { asFragment } = render(<Pagination itemCount={20} variant={PaginationVariant.bottom} />);
|
|
18
|
+
expect(asFragment()).toMatchSnapshot();
|
|
19
|
+
});
|
|
89
20
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
94
|
-
expect(toggle.find('b').at(0).text()).toBe('1 - 10');
|
|
95
|
-
expect(toggle).toMatchSnapshot();
|
|
96
|
-
});
|
|
21
|
+
test('should render correctly compact', () => {
|
|
22
|
+
const { asFragment } = render(<Pagination itemCount={20} isCompact />);
|
|
23
|
+
expect(asFragment()).toMatchSnapshot();
|
|
24
|
+
});
|
|
97
25
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
)
|
|
102
|
-
expect(toggle.find('div').text()).toBe('1 - 10 of many');
|
|
103
|
-
expect(toggle).toMatchSnapshot();
|
|
104
|
-
});
|
|
26
|
+
test('should render correctly sticky', () => {
|
|
27
|
+
const { asFragment } = render(<Pagination itemCount={20} isSticky />);
|
|
28
|
+
expect(asFragment()).toMatchSnapshot();
|
|
29
|
+
});
|
|
105
30
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
110
|
-
expect(toggle.text()).toBe('I am a string');
|
|
111
|
-
expect(toggle).toMatchSnapshot();
|
|
112
|
-
});
|
|
113
|
-
});
|
|
31
|
+
test('should render correctly bottom sticky', () => {
|
|
32
|
+
const { asFragment } = render(<Pagination itemCount={20} variant={PaginationVariant.bottom} isSticky />);
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
114
35
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
test('should call first', () => {
|
|
120
|
-
const wrapper = mount(<Pagination onSetPage={onSetPage} itemCount={40} page={2} />);
|
|
121
|
-
wrapper
|
|
122
|
-
.find('[data-action="first"]')
|
|
123
|
-
.first()
|
|
124
|
-
.simulate('click');
|
|
125
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
126
|
-
expect(onSetPage.mock.calls[0][1]).toBe(1);
|
|
36
|
+
test('should render correctly disabled', () => {
|
|
37
|
+
const { asFragment } = render(<Pagination itemCount={20} isDisabled />);
|
|
38
|
+
expect(asFragment()).toMatchSnapshot();
|
|
127
39
|
});
|
|
128
40
|
|
|
129
|
-
test('
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
.find('[data-action="previous"]')
|
|
133
|
-
.first()
|
|
134
|
-
.simulate('click');
|
|
135
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
136
|
-
expect(onSetPage.mock.calls[0][1]).toBe(2);
|
|
41
|
+
test('limited number of pages', () => {
|
|
42
|
+
const { asFragment } = render(<Pagination itemCount={20} perPage={20} />);
|
|
43
|
+
expect(asFragment()).toMatchSnapshot();
|
|
137
44
|
});
|
|
138
45
|
|
|
139
|
-
test('
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
.find('[data-action="next"]')
|
|
143
|
-
.first()
|
|
144
|
-
.simulate('click');
|
|
145
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
146
|
-
expect(onSetPage.mock.calls[0][1]).toBe(2);
|
|
46
|
+
test('zero results', () => {
|
|
47
|
+
const { asFragment } = render(<Pagination itemCount={0} />);
|
|
48
|
+
expect(asFragment()).toMatchSnapshot();
|
|
147
49
|
});
|
|
148
50
|
|
|
149
|
-
test('
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
.find('[data-action="last"]')
|
|
153
|
-
.first()
|
|
154
|
-
.simulate('click');
|
|
155
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
156
|
-
expect(onSetPage.mock.calls[0][1]).toBe(4);
|
|
51
|
+
test('last page', () => {
|
|
52
|
+
const { asFragment } = render(<Pagination itemCount={20} perPage={10} page={2} />);
|
|
53
|
+
expect(asFragment()).toMatchSnapshot();
|
|
157
54
|
});
|
|
158
55
|
|
|
159
|
-
test('
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
.find('input')
|
|
163
|
-
.first()
|
|
164
|
-
.simulate('change', { target: { value: '1' } })
|
|
165
|
-
.simulate('keydown', { keyCode: 13 });
|
|
166
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
167
|
-
expect(onSetPage.mock.calls[0][1]).toBe(1);
|
|
56
|
+
test('custom perPageOptions', () => {
|
|
57
|
+
const { asFragment } = render(<Pagination itemCount={40} perPageOptions={[{ title: 'some', value: 1 }]} />);
|
|
58
|
+
expect(asFragment()).toMatchSnapshot();
|
|
168
59
|
});
|
|
169
60
|
|
|
170
|
-
test('
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
.find('input')
|
|
174
|
-
.first()
|
|
175
|
-
.simulate('change', { target: { value: 'a' } })
|
|
176
|
-
.simulate('keydown', { keyCode: 13 });
|
|
177
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
178
|
-
expect(onSetPage.mock.calls[0][1]).toBe(1);
|
|
61
|
+
test('empty per page options', () => {
|
|
62
|
+
const { asFragment } = render(<Pagination itemCount={40} perPageOptions={[]} />);
|
|
63
|
+
expect(asFragment()).toMatchSnapshot();
|
|
179
64
|
});
|
|
180
65
|
|
|
181
|
-
test('
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
.find('input')
|
|
185
|
-
.first()
|
|
186
|
-
.simulate('change', { target: { value: '10' } })
|
|
187
|
-
.simulate('keydown', { keyCode: 13 });
|
|
188
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
189
|
-
expect(onSetPage.mock.calls[0][1]).toBe(4);
|
|
66
|
+
test('custom start end', () => {
|
|
67
|
+
const { asFragment } = render(<Pagination itemCount={40} itemsStart={5} itemsEnd={15} />);
|
|
68
|
+
expect(asFragment()).toMatchSnapshot();
|
|
190
69
|
});
|
|
191
70
|
|
|
192
|
-
test('
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
.find('input')
|
|
196
|
-
.first()
|
|
197
|
-
.simulate('change', { target: { value: '-10' } })
|
|
198
|
-
.simulate('keydown', { keyCode: 13 });
|
|
199
|
-
expect(onSetPage.mock.calls).toHaveLength(1);
|
|
200
|
-
expect(onSetPage.mock.calls[0][1]).toBe(1);
|
|
71
|
+
test('titles', () => {
|
|
72
|
+
const { asFragment } = render(<Pagination itemCount={40} titles={{ items: 'values', page: 'books' }} />);
|
|
73
|
+
expect(asFragment()).toMatchSnapshot();
|
|
201
74
|
});
|
|
202
75
|
|
|
203
|
-
test('
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
76
|
+
test('custom pagination toggle', () => {
|
|
77
|
+
const { asFragment } = render(
|
|
78
|
+
<Pagination
|
|
79
|
+
itemCount={40}
|
|
80
|
+
toggleTemplate={'${firstIndex} - ${lastIndex} - ${itemCount} - ${itemsTitle}'}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
expect(asFragment()).toMatchSnapshot();
|
|
210
84
|
});
|
|
211
|
-
});
|
|
212
85
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const wrapper = mount(<Pagination onFirstClick={onFirst} itemCount={40} page={2} />);
|
|
217
|
-
wrapper
|
|
218
|
-
.find('[data-action="first"]')
|
|
219
|
-
.first()
|
|
220
|
-
.simulate('click');
|
|
221
|
-
expect(onFirst.mock.calls).toHaveLength(1);
|
|
222
|
-
expect(onFirst.mock.calls[0][1]).toBe(1);
|
|
86
|
+
test('up drop direction', () => {
|
|
87
|
+
const { asFragment } = render(<Pagination itemCount={40} dropDirection="up" />);
|
|
88
|
+
expect(asFragment()).toMatchSnapshot();
|
|
223
89
|
});
|
|
224
90
|
|
|
225
|
-
test('
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
.find('[data-action="first"]')
|
|
229
|
-
.first()
|
|
230
|
-
.simulate('click');
|
|
231
|
-
expect(onFirst.mock.calls).toHaveLength(0);
|
|
91
|
+
test('indeterminate count (no item count)', () => {
|
|
92
|
+
render(<Pagination />);
|
|
93
|
+
expect(screen.getAllByText('1 - 10')[0]).toBeInTheDocument();
|
|
232
94
|
});
|
|
233
|
-
});
|
|
234
95
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
96
|
+
test('toggleTemplate toggle text with function', () => {
|
|
97
|
+
render(
|
|
98
|
+
<Pagination
|
|
99
|
+
toggleTemplate={({ firstIndex, lastIndex }) => (
|
|
100
|
+
<div>
|
|
101
|
+
{firstIndex} - {lastIndex} of many
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
expect(screen.getAllByText('1 - 10 of many')[0]).toBeInTheDocument();
|
|
245
107
|
});
|
|
246
108
|
|
|
247
|
-
test('
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
.find('[data-action="last"]')
|
|
251
|
-
.first()
|
|
252
|
-
.simulate('click');
|
|
253
|
-
expect(onLast.mock.calls).toHaveLength(0);
|
|
109
|
+
test('toggleTemplate toggle text with string', () => {
|
|
110
|
+
render(<Pagination toggleTemplate={'I am a string'} />);
|
|
111
|
+
expect(screen.getAllByText('I am a string')[0]).toBeInTheDocument();
|
|
254
112
|
});
|
|
255
113
|
});
|
|
256
114
|
|
|
257
|
-
describe('
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
.
|
|
265
|
-
|
|
266
|
-
|
|
115
|
+
describe('API', () => {
|
|
116
|
+
describe('onSetPage', () => {
|
|
117
|
+
const onSetPage = jest.fn();
|
|
118
|
+
|
|
119
|
+
test('should call first', () => {
|
|
120
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} page={2} />);
|
|
121
|
+
|
|
122
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to first page' }));
|
|
123
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
test('should call previous', () => {
|
|
127
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} page={3} />);
|
|
128
|
+
|
|
129
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to previous page' }));
|
|
130
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('should call next', () => {
|
|
134
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} />);
|
|
135
|
+
|
|
136
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to next page' }));
|
|
137
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
test('should call last', () => {
|
|
141
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} />);
|
|
142
|
+
|
|
143
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to last page' }));
|
|
144
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('should call input', () => {
|
|
148
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} />);
|
|
149
|
+
|
|
150
|
+
const input = screen.getByLabelText('Current page');
|
|
151
|
+
userEvent.type(input, '1');
|
|
152
|
+
userEvent.type(input, '{enter}');
|
|
153
|
+
|
|
154
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('should call input wrong value', () => {
|
|
158
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} />);
|
|
159
|
+
|
|
160
|
+
const input = screen.getByLabelText('Current page');
|
|
161
|
+
userEvent.type(input, 'a');
|
|
162
|
+
userEvent.type(input, '{enter}');
|
|
163
|
+
|
|
164
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
test('should call input huge page number', () => {
|
|
168
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} />);
|
|
169
|
+
|
|
170
|
+
const input = screen.getByLabelText('Current page');
|
|
171
|
+
userEvent.type(input, '10');
|
|
172
|
+
userEvent.type(input, '{enter}');
|
|
173
|
+
|
|
174
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
test('should call input small page number', () => {
|
|
178
|
+
render(<Pagination onSetPage={onSetPage} itemCount={40} />);
|
|
179
|
+
|
|
180
|
+
const input = screen.getByLabelText('Current page');
|
|
181
|
+
userEvent.type(input, '-10');
|
|
182
|
+
userEvent.type(input, '{enter}');
|
|
183
|
+
|
|
184
|
+
expect(onSetPage).toHaveBeenCalled();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test('should NOT call', () => {
|
|
188
|
+
render(<Pagination itemCount={40} />);
|
|
189
|
+
|
|
190
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to last page' }));
|
|
191
|
+
expect(onSetPage).not.toHaveBeenCalled();
|
|
192
|
+
});
|
|
267
193
|
});
|
|
268
194
|
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
.
|
|
275
|
-
|
|
195
|
+
describe('onFirst', () => {
|
|
196
|
+
const onFirst = jest.fn();
|
|
197
|
+
test('should call', () => {
|
|
198
|
+
render(<Pagination onFirstClick={onFirst} itemCount={40} page={2} />);
|
|
199
|
+
|
|
200
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to first page' }));
|
|
201
|
+
expect(onFirst).toHaveBeenCalled();
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test('should NOT call', () => {
|
|
205
|
+
render(<Pagination itemCount={40} page={2} />);
|
|
206
|
+
|
|
207
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to first page' }));
|
|
208
|
+
expect(onFirst).not.toHaveBeenCalled();
|
|
209
|
+
});
|
|
276
210
|
});
|
|
277
|
-
});
|
|
278
211
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
.
|
|
285
|
-
.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
212
|
+
describe('onLast', () => {
|
|
213
|
+
const onLast = jest.fn();
|
|
214
|
+
test('should call', () => {
|
|
215
|
+
render(<Pagination onLastClick={onLast} itemCount={40} />);
|
|
216
|
+
|
|
217
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to last page' }));
|
|
218
|
+
expect(onLast).toHaveBeenCalled();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
test('should NOT call', () => {
|
|
222
|
+
render(<Pagination itemCount={40} />);
|
|
223
|
+
|
|
224
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to last page' }));
|
|
225
|
+
expect(onLast).not.toHaveBeenCalled();
|
|
226
|
+
});
|
|
289
227
|
});
|
|
290
228
|
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
.
|
|
297
|
-
|
|
229
|
+
describe('onPrevious', () => {
|
|
230
|
+
const onPrevious = jest.fn();
|
|
231
|
+
test('should call', () => {
|
|
232
|
+
render(<Pagination onPreviousClick={onPrevious} itemCount={40} page={3} />);
|
|
233
|
+
|
|
234
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to previous page' }));
|
|
235
|
+
expect(onPrevious).toHaveBeenCalled();
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test('should NOT call', () => {
|
|
239
|
+
render(<Pagination itemCount={40} />);
|
|
240
|
+
|
|
241
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to previous page' }));
|
|
242
|
+
expect(onPrevious).not.toHaveBeenCalled();
|
|
243
|
+
});
|
|
298
244
|
});
|
|
299
|
-
});
|
|
300
245
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
.
|
|
307
|
-
.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
.
|
|
314
|
-
|
|
315
|
-
|
|
246
|
+
describe('onNext', () => {
|
|
247
|
+
const onNext = jest.fn();
|
|
248
|
+
test('should call', () => {
|
|
249
|
+
render(<Pagination onNextClick={onNext} itemCount={40} />);
|
|
250
|
+
|
|
251
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to next page' }));
|
|
252
|
+
expect(onNext).toHaveBeenCalled();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test('should NOT call', () => {
|
|
256
|
+
render(<Pagination itemCount={40} />);
|
|
257
|
+
|
|
258
|
+
userEvent.click(screen.getByRole('button', { name: 'Go to previous page' }));
|
|
259
|
+
expect(onNext).not.toHaveBeenCalled();
|
|
260
|
+
});
|
|
316
261
|
});
|
|
317
262
|
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
263
|
+
describe('onPerPage', () => {
|
|
264
|
+
const onPerPage = jest.fn();
|
|
265
|
+
test('should call', () => {
|
|
266
|
+
render(<Pagination onPerPageSelect={onPerPage} itemCount={40} />);
|
|
267
|
+
|
|
268
|
+
userEvent.click(screen.getByRole('button', { name: 'Items per page' }));
|
|
269
|
+
userEvent.click(screen.getByText('20 per page'));
|
|
270
|
+
|
|
271
|
+
expect(onPerPage).toHaveBeenCalled();
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
test('should NOT call', () => {
|
|
275
|
+
render(<Pagination itemCount={40} />);
|
|
276
|
+
|
|
277
|
+
userEvent.click(screen.getByRole('button', { name: 'Items per page' }));
|
|
278
|
+
userEvent.click(screen.getByText('20 per page'));
|
|
279
|
+
|
|
280
|
+
expect(onPerPage).not.toHaveBeenCalled();
|
|
281
|
+
});
|
|
330
282
|
});
|
|
331
283
|
});
|
|
332
284
|
});
|