@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,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
|
|
4
7
|
import { TextInput, TextInputBase } from '../TextInput';
|
|
5
8
|
import { ValidatedOptions } from '../../../helpers/constants';
|
|
6
9
|
|
|
@@ -9,84 +12,82 @@ const props = {
|
|
|
9
12
|
value: 'test input'
|
|
10
13
|
};
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
currentTarget: { value: newValue }
|
|
16
|
-
};
|
|
17
|
-
const view = shallow(<TextInputBase {...props} aria-label="test input" />);
|
|
18
|
-
view.find('input').simulate('change', event);
|
|
19
|
-
expect(props.onChange).toBeCalledWith(newValue, event);
|
|
20
|
-
});
|
|
15
|
+
describe('TextInput', () => {
|
|
16
|
+
test('input passes value and event to onChange handler', () => {
|
|
17
|
+
render(<TextInputBase {...props} value='' aria-label="test input" />);
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
19
|
+
userEvent.type(screen.getByLabelText('test input'), 'a');
|
|
20
|
+
expect(props.onChange).toHaveBeenCalledWith('a', expect.any(Object));
|
|
21
|
+
});
|
|
26
22
|
|
|
27
|
-
test('
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
23
|
+
test('simple text input', () => {
|
|
24
|
+
const { asFragment } = render(<TextInput {...props} aria-label="simple text input" />);
|
|
25
|
+
expect(asFragment()).toMatchSnapshot();
|
|
26
|
+
});
|
|
31
27
|
|
|
32
|
-
test('
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
28
|
+
test('disabled text input', () => {
|
|
29
|
+
const { asFragment } = render(<TextInput isDisabled aria-label="disabled text input" />);
|
|
30
|
+
expect(asFragment()).toMatchSnapshot();
|
|
31
|
+
});
|
|
36
32
|
|
|
37
|
-
test('
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
33
|
+
test('readonly text input', () => {
|
|
34
|
+
const { asFragment } = render(<TextInput isReadOnly value="read only" aria-label="readonly text input" />);
|
|
35
|
+
expect(asFragment()).toMatchSnapshot();
|
|
36
|
+
});
|
|
41
37
|
|
|
42
|
-
test('
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
);
|
|
46
|
-
expect(view.find('.pf-c-form-control.pf-m-success').length).toBe(1);
|
|
47
|
-
expect(view).toMatchSnapshot();
|
|
48
|
-
});
|
|
38
|
+
test('invalid text input', () => {
|
|
39
|
+
const { asFragment } = render(<TextInput {...props} required validated={'error'} aria-label="invalid text input" />);
|
|
40
|
+
expect(asFragment()).toMatchSnapshot();
|
|
41
|
+
});
|
|
49
42
|
|
|
50
|
-
test('validated text input success', () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
expect(view.find('.pf-c-form-control.pf-m-warning').length).toBe(1);
|
|
55
|
-
expect(view).toMatchSnapshot();
|
|
56
|
-
});
|
|
43
|
+
test('validated text input success', () => {
|
|
44
|
+
render(<TextInput {...props} required validated={ValidatedOptions.success} aria-label="validated text input" />);
|
|
45
|
+
expect(screen.getByLabelText('validated text input')).toHaveClass('pf-m-success');
|
|
46
|
+
});
|
|
57
47
|
|
|
48
|
+
test('validated text input warning', () => {
|
|
49
|
+
render(<TextInput {...props} required validated={ValidatedOptions.warning} aria-label="validated text input" />);
|
|
50
|
+
expect(screen.getByLabelText('validated text input')).toHaveClass('pf-m-warning');
|
|
51
|
+
});
|
|
58
52
|
|
|
59
|
-
test('validated text input', () => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
);
|
|
63
|
-
expect(view.container).toMatchSnapshot();
|
|
64
|
-
});
|
|
53
|
+
test('validated text input error', () => {
|
|
54
|
+
const { asFragment } = render(<TextInput {...props} required validated={ValidatedOptions.error} aria-label="validated text input" />);
|
|
55
|
+
expect(asFragment()).toMatchSnapshot();
|
|
56
|
+
});
|
|
65
57
|
|
|
66
|
-
test('should throw console error when no aria-label, id or aria-labelledby is given', () => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
render(<TextInput {...props} />);
|
|
70
|
-
expect(myMock).toBeCalled();
|
|
71
|
-
});
|
|
58
|
+
test('should throw console error when no aria-label, id or aria-labelledby is given', () => {
|
|
59
|
+
const myMock = jest.fn();
|
|
60
|
+
global.console = { ...global.console, error: myMock };
|
|
72
61
|
|
|
73
|
-
|
|
74
|
-
const myMock = jest.fn();
|
|
75
|
-
global.console = { ...global.console, error: myMock };
|
|
76
|
-
render(<TextInput {...props} id="5" />);
|
|
77
|
-
expect(myMock).not.toBeCalled();
|
|
78
|
-
});
|
|
62
|
+
render(<TextInput {...props} />);
|
|
79
63
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
64
|
+
expect(myMock).toBeCalled();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('should not throw console error when id is given but no aria-label or aria-labelledby', () => {
|
|
68
|
+
const myMock = jest.fn();
|
|
69
|
+
global.console = { ...global.console, error: myMock };
|
|
70
|
+
|
|
71
|
+
render(<TextInput {...props} id="5" />);
|
|
72
|
+
|
|
73
|
+
expect(myMock).not.toBeCalled();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('should not throw console error when aria-label is given but no id or aria-labelledby', () => {
|
|
77
|
+
const myMock = jest.fn();
|
|
78
|
+
global.console = { ...global.console, error: myMock };
|
|
79
|
+
|
|
80
|
+
render(<TextInput {...props} aria-label="test input" />);
|
|
81
|
+
|
|
82
|
+
expect(myMock).not.toBeCalled();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('should not throw console error when aria-labelledby is given but no id or aria-label', () => {
|
|
86
|
+
const myMock = jest.fn();
|
|
87
|
+
global.console = { ...global.console, error: myMock };
|
|
88
|
+
|
|
89
|
+
render(<TextInput {...props} aria-labelledby="test input" />);
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
global.console = { ...global.console, error: myMock };
|
|
90
|
-
render(<TextInput {...props} aria-labelledby="test input" />);
|
|
91
|
-
expect(myMock).not.toBeCalled();
|
|
91
|
+
expect(myMock).not.toBeCalled();
|
|
92
|
+
});
|
|
92
93
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`disabled text input 1`] = `
|
|
4
|
-
<
|
|
3
|
+
exports[`TextInput disabled text input 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
5
|
<input
|
|
6
6
|
aria-invalid="false"
|
|
7
7
|
aria-label="disabled text input"
|
|
@@ -13,11 +13,11 @@ exports[`disabled text input 1`] = `
|
|
|
13
13
|
type="text"
|
|
14
14
|
value=""
|
|
15
15
|
/>
|
|
16
|
-
</
|
|
16
|
+
</DocumentFragment>
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
-
exports[`invalid text input 1`] = `
|
|
20
|
-
<
|
|
19
|
+
exports[`TextInput invalid text input 1`] = `
|
|
20
|
+
<DocumentFragment>
|
|
21
21
|
<input
|
|
22
22
|
aria-invalid="true"
|
|
23
23
|
aria-label="invalid text input"
|
|
@@ -28,11 +28,11 @@ exports[`invalid text input 1`] = `
|
|
|
28
28
|
type="text"
|
|
29
29
|
value="test input"
|
|
30
30
|
/>
|
|
31
|
-
</
|
|
31
|
+
</DocumentFragment>
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
-
exports[`readonly text input 1`] = `
|
|
35
|
-
<
|
|
34
|
+
exports[`TextInput readonly text input 1`] = `
|
|
35
|
+
<DocumentFragment>
|
|
36
36
|
<input
|
|
37
37
|
aria-invalid="false"
|
|
38
38
|
aria-label="readonly text input"
|
|
@@ -44,11 +44,11 @@ exports[`readonly text input 1`] = `
|
|
|
44
44
|
type="text"
|
|
45
45
|
value="read only"
|
|
46
46
|
/>
|
|
47
|
-
</
|
|
47
|
+
</DocumentFragment>
|
|
48
48
|
`;
|
|
49
49
|
|
|
50
|
-
exports[`simple text input 1`] = `
|
|
51
|
-
<
|
|
50
|
+
exports[`TextInput simple text input 1`] = `
|
|
51
|
+
<DocumentFragment>
|
|
52
52
|
<input
|
|
53
53
|
aria-invalid="false"
|
|
54
54
|
aria-label="simple text input"
|
|
@@ -59,11 +59,11 @@ exports[`simple text input 1`] = `
|
|
|
59
59
|
type="text"
|
|
60
60
|
value="test input"
|
|
61
61
|
/>
|
|
62
|
-
</
|
|
62
|
+
</DocumentFragment>
|
|
63
63
|
`;
|
|
64
64
|
|
|
65
|
-
exports[`validated text input 1`] = `
|
|
66
|
-
<
|
|
65
|
+
exports[`TextInput validated text input error 1`] = `
|
|
66
|
+
<DocumentFragment>
|
|
67
67
|
<input
|
|
68
68
|
aria-invalid="true"
|
|
69
69
|
aria-label="validated text input"
|
|
@@ -74,93 +74,5 @@ exports[`validated text input 1`] = `
|
|
|
74
74
|
type="text"
|
|
75
75
|
value="test input"
|
|
76
76
|
/>
|
|
77
|
-
</
|
|
78
|
-
`;
|
|
79
|
-
|
|
80
|
-
exports[`validated text input success 1`] = `
|
|
81
|
-
<TextInput
|
|
82
|
-
aria-label="validated text input"
|
|
83
|
-
onChange={[MockFunction]}
|
|
84
|
-
required={true}
|
|
85
|
-
validated="success"
|
|
86
|
-
value="test input"
|
|
87
|
-
>
|
|
88
|
-
<TextInputBase
|
|
89
|
-
aria-label="validated text input"
|
|
90
|
-
className=""
|
|
91
|
-
innerRef={null}
|
|
92
|
-
isDisabled={false}
|
|
93
|
-
isIconSprite={false}
|
|
94
|
-
isLeftTruncated={false}
|
|
95
|
-
isReadOnly={false}
|
|
96
|
-
isRequired={false}
|
|
97
|
-
onChange={[MockFunction]}
|
|
98
|
-
ouiaSafe={true}
|
|
99
|
-
required={true}
|
|
100
|
-
type="text"
|
|
101
|
-
validated="success"
|
|
102
|
-
value="test input"
|
|
103
|
-
>
|
|
104
|
-
<input
|
|
105
|
-
aria-invalid={false}
|
|
106
|
-
aria-label="validated text input"
|
|
107
|
-
className="pf-c-form-control pf-m-success"
|
|
108
|
-
data-ouia-component-id="OUIA-Generated-TextInputBase-6"
|
|
109
|
-
data-ouia-component-type="PF4/TextInput"
|
|
110
|
-
data-ouia-safe={true}
|
|
111
|
-
disabled={false}
|
|
112
|
-
onBlur={[Function]}
|
|
113
|
-
onChange={[Function]}
|
|
114
|
-
onFocus={[Function]}
|
|
115
|
-
readOnly={false}
|
|
116
|
-
required={false}
|
|
117
|
-
type="text"
|
|
118
|
-
value="test input"
|
|
119
|
-
/>
|
|
120
|
-
</TextInputBase>
|
|
121
|
-
</TextInput>
|
|
122
|
-
`;
|
|
123
|
-
|
|
124
|
-
exports[`validated text input success 2`] = `
|
|
125
|
-
<TextInput
|
|
126
|
-
aria-label="validated text input"
|
|
127
|
-
onChange={[MockFunction]}
|
|
128
|
-
required={true}
|
|
129
|
-
validated="warning"
|
|
130
|
-
value="test input"
|
|
131
|
-
>
|
|
132
|
-
<TextInputBase
|
|
133
|
-
aria-label="validated text input"
|
|
134
|
-
className=""
|
|
135
|
-
innerRef={null}
|
|
136
|
-
isDisabled={false}
|
|
137
|
-
isIconSprite={false}
|
|
138
|
-
isLeftTruncated={false}
|
|
139
|
-
isReadOnly={false}
|
|
140
|
-
isRequired={false}
|
|
141
|
-
onChange={[MockFunction]}
|
|
142
|
-
ouiaSafe={true}
|
|
143
|
-
required={true}
|
|
144
|
-
type="text"
|
|
145
|
-
validated="warning"
|
|
146
|
-
value="test input"
|
|
147
|
-
>
|
|
148
|
-
<input
|
|
149
|
-
aria-invalid={false}
|
|
150
|
-
aria-label="validated text input"
|
|
151
|
-
className="pf-c-form-control pf-m-warning"
|
|
152
|
-
data-ouia-component-id="OUIA-Generated-TextInputBase-7"
|
|
153
|
-
data-ouia-component-type="PF4/TextInput"
|
|
154
|
-
data-ouia-safe={true}
|
|
155
|
-
disabled={false}
|
|
156
|
-
onBlur={[Function]}
|
|
157
|
-
onChange={[Function]}
|
|
158
|
-
onFocus={[Function]}
|
|
159
|
-
readOnly={false}
|
|
160
|
-
required={false}
|
|
161
|
-
type="text"
|
|
162
|
-
value="test input"
|
|
163
|
-
/>
|
|
164
|
-
</TextInputBase>
|
|
165
|
-
</TextInput>
|
|
77
|
+
</DocumentFragment>
|
|
166
78
|
`;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
|
|
4
6
|
import { TextInputGroup, TextInputGroupContext } from '../TextInputGroup';
|
|
5
7
|
import { TextInputGroupMain } from '../TextInputGroupMain';
|
|
6
8
|
import { TextInputGroupUtilities } from '../TextInputGroupUtilities';
|
|
@@ -8,33 +10,33 @@ import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
|
8
10
|
|
|
9
11
|
describe('TextInputGroup', () => {
|
|
10
12
|
test('renders content', () => {
|
|
11
|
-
const
|
|
13
|
+
const { asFragment } = render(
|
|
12
14
|
<TextInputGroup>
|
|
13
15
|
<TextInputGroupMain>Foo</TextInputGroupMain>
|
|
14
16
|
<TextInputGroupUtilities />
|
|
15
17
|
</TextInputGroup>
|
|
16
18
|
);
|
|
17
|
-
expect(
|
|
19
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
test('gets custom class and id', () => {
|
|
21
|
-
const
|
|
23
|
+
const { asFragment } = render(
|
|
22
24
|
<TextInputGroup className="custom-class" id="test-id">
|
|
23
25
|
<TextInputGroupMain>Foo</TextInputGroupMain>
|
|
24
26
|
<TextInputGroupUtilities />
|
|
25
27
|
</TextInputGroup>
|
|
26
28
|
);
|
|
27
|
-
expect(
|
|
29
|
+
expect(asFragment()).toMatchSnapshot();
|
|
28
30
|
});
|
|
29
31
|
|
|
30
32
|
test('renders with the proper stying when disabled', () => {
|
|
31
|
-
const
|
|
33
|
+
const { asFragment } = render(
|
|
32
34
|
<TextInputGroup isDisabled>
|
|
33
35
|
<TextInputGroupMain>Foo</TextInputGroupMain>
|
|
34
36
|
<TextInputGroupUtilities />
|
|
35
37
|
</TextInputGroup>
|
|
36
38
|
);
|
|
37
|
-
expect(
|
|
39
|
+
expect(asFragment()).toMatchSnapshot();
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
test('passes isDisabled=false to children via a context when isDisabled prop is not passed', () => {
|
|
@@ -44,12 +46,13 @@ describe('TextInputGroup', () => {
|
|
|
44
46
|
return <div>{context.isDisabled ? 'is disabled' : 'not disabled'}</div>;
|
|
45
47
|
};
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
render(
|
|
48
50
|
<TextInputGroup>
|
|
49
51
|
<TestComponent />
|
|
50
52
|
</TextInputGroup>
|
|
51
53
|
);
|
|
52
|
-
|
|
54
|
+
|
|
55
|
+
expect(screen.queryByText('is disabled')).toBeNull();
|
|
53
56
|
});
|
|
54
57
|
|
|
55
58
|
test('passes isDisabled=true to children via a context when isDisabled prop is passed', () => {
|
|
@@ -59,108 +62,131 @@ describe('TextInputGroup', () => {
|
|
|
59
62
|
return <div>{context.isDisabled ? 'is disabled' : 'not disabled'}</div>;
|
|
60
63
|
};
|
|
61
64
|
|
|
62
|
-
|
|
65
|
+
render(
|
|
63
66
|
<TextInputGroup isDisabled>
|
|
64
67
|
<TestComponent />
|
|
65
68
|
</TextInputGroup>
|
|
66
69
|
);
|
|
67
|
-
|
|
70
|
+
|
|
71
|
+
expect(screen.queryByText('not disabled')).toBeNull();
|
|
68
72
|
});
|
|
69
73
|
});
|
|
70
74
|
|
|
71
75
|
describe('TextInputGroupMain', () => {
|
|
72
76
|
test('renders content', () => {
|
|
73
|
-
const
|
|
74
|
-
expect(
|
|
77
|
+
const { asFragment } = render(<TextInputGroupMain>Foo</TextInputGroupMain>);
|
|
78
|
+
expect(asFragment()).toMatchSnapshot();
|
|
75
79
|
});
|
|
76
80
|
|
|
77
81
|
test('renders given input icon props', () => {
|
|
78
|
-
const
|
|
79
|
-
expect(
|
|
82
|
+
const { asFragment } = render(<TextInputGroupMain icon={<SearchIcon />}>Foo</TextInputGroupMain>);
|
|
83
|
+
expect(asFragment()).toMatchSnapshot();
|
|
80
84
|
});
|
|
81
85
|
|
|
82
86
|
test('renders the input with custom aria label when given', () => {
|
|
83
|
-
const
|
|
84
|
-
expect(
|
|
87
|
+
const { asFragment } = render(<TextInputGroupMain aria-label="Foo">Foo</TextInputGroupMain>);
|
|
88
|
+
expect(asFragment()).toMatchSnapshot();
|
|
85
89
|
});
|
|
86
90
|
|
|
87
91
|
test('does not call onChange callback when the input does not change', () => {
|
|
88
92
|
const onChangeMock = jest.fn();
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
render(<TextInputGroupMain onChange={onChangeMock}>Foo</TextInputGroupMain>);
|
|
91
95
|
expect(onChangeMock).not.toHaveBeenCalled();
|
|
92
96
|
});
|
|
93
97
|
|
|
94
98
|
test('calls the onChange callback when the input changes', () => {
|
|
95
99
|
const onChangeMock = jest.fn();
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
render(<TextInputGroupMain onChange={onChangeMock}>Foo</TextInputGroupMain>);
|
|
102
|
+
|
|
103
|
+
userEvent.type(screen.getByText('Foo').querySelector('input'), 'Foo');
|
|
104
|
+
expect(onChangeMock).toHaveBeenCalled();
|
|
100
105
|
});
|
|
101
106
|
|
|
102
107
|
test('does not call onFocus callback when the input does not get focus', () => {
|
|
103
108
|
const onFocusMock = jest.fn();
|
|
104
109
|
|
|
105
|
-
|
|
110
|
+
render(<TextInputGroupMain onFocus={onFocusMock}>Foo</TextInputGroupMain>);
|
|
106
111
|
expect(onFocusMock).not.toHaveBeenCalled();
|
|
107
112
|
});
|
|
108
113
|
|
|
109
114
|
test('calls the onFocus callback when the input is focused', () => {
|
|
110
115
|
const onFocusMock = jest.fn();
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
render(<TextInputGroupMain onFocus={onFocusMock}>Foo</TextInputGroupMain>);
|
|
118
|
+
userEvent.click(screen.getByText('Foo').querySelector('input'));
|
|
114
119
|
expect(onFocusMock).toHaveBeenCalledTimes(1);
|
|
115
120
|
});
|
|
116
121
|
|
|
117
122
|
test('does not call onBlur callback when the input does not lose focus', () => {
|
|
118
123
|
const onBlurMock = jest.fn();
|
|
119
124
|
|
|
120
|
-
|
|
125
|
+
render(<TextInputGroupMain onBlur={onBlurMock}>Foo</TextInputGroupMain>);
|
|
126
|
+
|
|
127
|
+
userEvent.type(screen.getByText('Foo').querySelector('input'), 'Foo');
|
|
121
128
|
expect(onBlurMock).not.toHaveBeenCalled();
|
|
122
129
|
});
|
|
123
130
|
|
|
124
131
|
test('calls the onFocus callback when the input loses focus', () => {
|
|
125
132
|
const onBlurMock = jest.fn();
|
|
126
133
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
render(
|
|
135
|
+
<>
|
|
136
|
+
<div>Other element</div>
|
|
137
|
+
<TextInputGroupMain onBlur={onBlurMock}>Foo</TextInputGroupMain>
|
|
138
|
+
</>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
userEvent.type(screen.getByText('Foo').querySelector('input'), 'Foo');
|
|
142
|
+
userEvent.click(screen.getByText('Other element'));
|
|
143
|
+
|
|
144
|
+
expect(onBlurMock).toHaveBeenCalled();
|
|
130
145
|
});
|
|
131
146
|
|
|
132
147
|
test('input type defaults to text', () => {
|
|
133
|
-
|
|
134
|
-
expect(
|
|
148
|
+
render(<TextInputGroupMain>Foo</TextInputGroupMain>);
|
|
149
|
+
expect(
|
|
150
|
+
screen
|
|
151
|
+
.getByText('Foo')
|
|
152
|
+
.querySelector('input')
|
|
153
|
+
.getAttribute('type')
|
|
154
|
+
).toEqual('text');
|
|
135
155
|
});
|
|
136
156
|
|
|
137
157
|
test('input type is updated when a different type is passed', () => {
|
|
138
|
-
|
|
139
|
-
expect(
|
|
158
|
+
render(<TextInputGroupMain type="search">Foo</TextInputGroupMain>);
|
|
159
|
+
expect(
|
|
160
|
+
screen
|
|
161
|
+
.getByText('Foo')
|
|
162
|
+
.querySelector('input')
|
|
163
|
+
.getAttribute('type')
|
|
164
|
+
).toEqual('search');
|
|
140
165
|
});
|
|
141
166
|
|
|
142
167
|
test('input is not disabled when TextInputGroupContext isDisabled is false', () => {
|
|
143
|
-
const
|
|
168
|
+
const { asFragment } = render(
|
|
144
169
|
<TextInputGroupContext.Provider value={{ isDisabled: false }}>
|
|
145
170
|
<TextInputGroupMain />
|
|
146
171
|
</TextInputGroupContext.Provider>
|
|
147
172
|
);
|
|
148
|
-
|
|
173
|
+
|
|
174
|
+
expect(asFragment()).toMatchSnapshot();
|
|
149
175
|
});
|
|
150
176
|
|
|
151
177
|
test('input is disabled when TextInputGroupContext isDisabled is true', () => {
|
|
152
|
-
const
|
|
178
|
+
const { asFragment } = render(
|
|
153
179
|
<TextInputGroupContext.Provider value={{ isDisabled: true }}>
|
|
154
180
|
<TextInputGroupMain />
|
|
155
181
|
</TextInputGroupContext.Provider>
|
|
156
182
|
);
|
|
157
|
-
expect(
|
|
183
|
+
expect(asFragment()).toMatchSnapshot();
|
|
158
184
|
});
|
|
159
185
|
});
|
|
160
186
|
|
|
161
187
|
describe('TextInputGroupUtilities', () => {
|
|
162
188
|
test('renders the content', () => {
|
|
163
|
-
const
|
|
164
|
-
expect(
|
|
189
|
+
const { asFragment } = render(<TextInputGroupUtilities>{<button>Foo</button>}</TextInputGroupUtilities>);
|
|
190
|
+
expect(asFragment()).toMatchSnapshot();
|
|
165
191
|
});
|
|
166
192
|
});
|