@dxc-technology/halstack-react 0.0.0-e33af28 → 0.0.0-e360842
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/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1243 -0
- package/HalstackContext.js +310 -0
- package/README.md +47 -0
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +101 -159
- package/accordion/Accordion.stories.tsx +83 -149
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +24 -40
- package/accordion/types.d.ts +6 -17
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +82 -0
- package/accordion-group/AccordionGroup.d.ts +2 -2
- package/accordion-group/AccordionGroup.js +31 -98
- package/accordion-group/AccordionGroup.stories.tsx +94 -67
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +49 -106
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +12 -17
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +40 -127
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +142 -40
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -2
- package/bleed/Bleed.js +14 -55
- package/bleed/Bleed.stories.tsx +95 -95
- package/bleed/types.d.ts +2 -2
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +30 -81
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -14
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +169 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +16 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +92 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +63 -113
- package/button/Button.stories.tsx +151 -100
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +12 -8
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.d.ts +1 -1
- package/card/Card.js +59 -102
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +137 -172
- package/checkbox/Checkbox.stories.tsx +166 -136
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +159 -38
- package/checkbox/types.d.ts +14 -6
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +69 -0
- package/chip/Chip.js +43 -89
- package/chip/Chip.stories.tsx +140 -28
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +17 -32
- package/chip/types.d.ts +38 -15
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1389 -0
- package/common/variables.js +1073 -1184
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +98 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +88 -0
- package/contextual-menu/ContextualMenu.stories.tsx +232 -0
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +205 -0
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +51 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +58 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +230 -0
- package/date-input/DateInput.js +152 -299
- package/date-input/DateInput.stories.tsx +210 -56
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +700 -370
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +121 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +72 -15
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +61 -106
- package/dialog/Dialog.stories.tsx +325 -167
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +350 -19
- package/dialog/types.d.ts +18 -25
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.d.ts +1 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +184 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +232 -307
- package/dropdown/Dropdown.stories.tsx +235 -57
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +604 -164
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +71 -0
- package/dropdown/types.d.ts +35 -19
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +167 -0
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +245 -395
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +314 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +61 -120
- package/file-input/types.d.ts +25 -8
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/flex/types.js +5 -0
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +75 -118
- package/footer/Footer.stories.tsx +99 -21
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +32 -56
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +54 -23
- package/footer/types.d.ts +26 -27
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +94 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +95 -185
- package/header/Header.stories.tsx +133 -38
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +5 -15
- package/header/types.d.ts +7 -21
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +64 -94
- package/heading/types.d.ts +7 -7
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +14 -55
- package/inset/Inset.stories.tsx +37 -36
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +86 -167
- package/layout/ApplicationLayout.stories.tsx +85 -94
- package/layout/Icons.d.ts +7 -0
- package/layout/Icons.js +41 -48
- package/layout/types.d.ts +19 -35
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +65 -101
- package/link/Link.stories.tsx +157 -55
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +24 -52
- package/link/types.d.ts +15 -31
- package/main.d.ts +16 -13
- package/main.js +83 -106
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +7 -0
- package/nav-tabs/NavTabs.js +108 -0
- package/nav-tabs/NavTabs.stories.tsx +294 -0
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +77 -0
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +117 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.js +46 -36
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +859 -376
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +18 -6
- package/package.json +52 -54
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +46 -100
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +279 -210
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.js +58 -124
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +159 -142
- package/password-input/types.d.ts +9 -8
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +68 -92
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +71 -43
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +71 -43
- package/quick-nav/QuickNav.stories.tsx +146 -27
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -79
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +74 -121
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +518 -459
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +171 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +168 -30
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +380 -0
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +151 -0
- package/select/Option.js +35 -56
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.js +210 -342
- package/select/Select.stories.tsx +524 -187
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +1955 -1744
- package/select/types.d.ts +33 -18
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +136 -71
- package/sidenav/Sidenav.stories.tsx +246 -151
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +25 -44
- package/sidenav/SidenavContext.d.ts +5 -0
- package/sidenav/SidenavContext.js +13 -0
- package/sidenav/types.d.ts +52 -26
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +146 -181
- package/slider/Slider.stories.tsx +64 -61
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +195 -88
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +34 -74
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +143 -124
- package/switch/Switch.stories.tsx +53 -64
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +137 -55
- package/switch/types.d.ts +9 -5
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +93 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +78 -35
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +93 -7
- package/table/types.d.ts +34 -6
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +117 -0
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +303 -141
- package/tabs/Tabs.stories.tsx +124 -12
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +212 -76
- package/tabs/types.d.ts +30 -20
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +38 -73
- package/tag/Tag.stories.tsx +18 -8
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +17 -36
- package/tag/types.d.ts +9 -9
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +67 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +94 -0
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +326 -553
- package/text-input/TextInput.stories.tsx +276 -276
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +1419 -1375
- package/text-input/types.d.ts +53 -14
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +79 -133
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +151 -182
- package/textarea/types.d.ts +10 -6
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -108
- package/toggle-group/ToggleGroup.stories.tsx +52 -7
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +28 -19
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +23 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1141 -1
- package/useTheme.js +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +66 -113
- package/wizard/Wizard.stories.tsx +59 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +9 -9
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- package/card/ice-cream.jpg +0 -0
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -32
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/paginator/Icons.js +0 -66
- package/progress-bar/ProgressBar.stories.jsx +0 -58
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/resultsetTable/ResultsetTable.test.js +0 -306
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -93
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/table/Table.stories.jsx +0 -277
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{list → action-icon}/types.js +0 -0
- /package/{radio → breadcrumbs}/types.js +0 -0
- /package/{resultsetTable → bulleted-list}/types.js +0 -0
- /package/{row → container}/types.js +0 -0
- /package/{stack → contextual-menu}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → divider/types.js} +0 -0
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
5
6
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _RadioGroup = _interopRequireDefault(require("./RadioGroup"));
|
|
8
|
-
|
|
9
7
|
var _react2 = require("@testing-library/react");
|
|
10
|
-
|
|
11
8
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
12
|
-
|
|
9
|
+
var _RadioGroup = _interopRequireDefault(require("./RadioGroup"));
|
|
13
10
|
var options = [{
|
|
14
11
|
label: "Option 01",
|
|
15
12
|
value: "1"
|
|
@@ -38,7 +35,7 @@ var options = [{
|
|
|
38
35
|
label: "Option 09",
|
|
39
36
|
value: "9"
|
|
40
37
|
}];
|
|
41
|
-
var
|
|
38
|
+
var singleDisabledOptions = [{
|
|
42
39
|
label: "Option 01",
|
|
43
40
|
value: "1"
|
|
44
41
|
}, {
|
|
@@ -52,19 +49,16 @@ var single_disabled_options = [{
|
|
|
52
49
|
describe("Radio Group component tests", function () {
|
|
53
50
|
test("Initial render has correct aria attributes and tabIndex", function () {
|
|
54
51
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
container = _render.container;
|
|
63
|
-
|
|
52
|
+
label: "test-radioGroup-label",
|
|
53
|
+
options: options,
|
|
54
|
+
error: ""
|
|
55
|
+
})),
|
|
56
|
+
getByRole = _render.getByRole,
|
|
57
|
+
getAllByRole = _render.getAllByRole,
|
|
58
|
+
getByText = _render.getByText;
|
|
64
59
|
var radioGroup = getByRole("radiogroup");
|
|
65
60
|
var radios = getAllByRole("radio");
|
|
66
|
-
var
|
|
67
|
-
var error = container.querySelector("#".concat(errorId));
|
|
61
|
+
var error = getByRole("alert");
|
|
68
62
|
expect(radioGroup.getAttribute("aria-disabled")).toBe("false");
|
|
69
63
|
expect(radioGroup.getAttribute("aria-labelledby")).toBe(getByText("test-radioGroup-label").id);
|
|
70
64
|
expect(radioGroup.getAttribute("aria-invalid")).toBe("false");
|
|
@@ -73,7 +67,7 @@ describe("Radio Group component tests", function () {
|
|
|
73
67
|
expect(error.getAttribute("aria-live")).toBe("off");
|
|
74
68
|
radios.forEach(function (radio, index) {
|
|
75
69
|
// if no option was previously selected, first option is the focusable one
|
|
76
|
-
index === 0
|
|
70
|
+
if (index === 0) expect(radio.tabIndex).toBe(0);else expect(radio.tabIndex).toBe(-1);
|
|
77
71
|
expect(radio.getAttribute("aria-checked")).toBe("false");
|
|
78
72
|
expect(radio.getAttribute("aria-disabled")).toBe("false");
|
|
79
73
|
expect(radio.getAttribute("aria-labelledby")).toBe(getByText("Option 0".concat(index + 1)).id);
|
|
@@ -81,383 +75,429 @@ describe("Radio Group component tests", function () {
|
|
|
81
75
|
});
|
|
82
76
|
test("aria-orientation attribute changes depending on stacking prop value", function () {
|
|
83
77
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
label: "test-radioGroup-label",
|
|
79
|
+
options: options,
|
|
80
|
+
stacking: "row"
|
|
81
|
+
})),
|
|
82
|
+
getByRole = _render2.getByRole;
|
|
90
83
|
var radioGroup = getByRole("radiogroup");
|
|
91
84
|
expect(radioGroup.getAttribute("aria-orientation")).toBe("horizontal");
|
|
92
85
|
});
|
|
86
|
+
test("Sends its value when submitted", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
87
|
+
var handlerOnSubmit, _render3, getByText, getByRole, getAllByRole, radioGroup, submit;
|
|
88
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
89
|
+
while (1) switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
handlerOnSubmit = jest.fn(function (e) {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
var formData = new FormData(e.target);
|
|
94
|
+
var formProps = Object.fromEntries(formData);
|
|
95
|
+
expect(formProps).toStrictEqual({
|
|
96
|
+
radiogroup: "5"
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
|
|
100
|
+
onSubmit: handlerOnSubmit
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
102
|
+
name: "radiogroup",
|
|
103
|
+
label: "test-radio-group-label",
|
|
104
|
+
options: options
|
|
105
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
106
|
+
type: "submit"
|
|
107
|
+
}, "Submit"))), getByText = _render3.getByText, getByRole = _render3.getByRole, getAllByRole = _render3.getAllByRole;
|
|
108
|
+
radioGroup = getByRole("radiogroup");
|
|
109
|
+
submit = getByText("Submit");
|
|
110
|
+
_context.next = 6;
|
|
111
|
+
return _userEvent["default"].click(radioGroup);
|
|
112
|
+
case 6:
|
|
113
|
+
_context.next = 8;
|
|
114
|
+
return _userEvent["default"].click(getAllByRole("radio")[4]);
|
|
115
|
+
case 8:
|
|
116
|
+
_context.next = 10;
|
|
117
|
+
return _userEvent["default"].click(submit);
|
|
118
|
+
case 10:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
})));
|
|
93
124
|
test("Disabled state renders with correct aria attribute, correct tabIndex values and it is not focusable by keyboard", function () {
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
125
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
126
|
+
label: "test-radioGroup-label",
|
|
127
|
+
options: options,
|
|
128
|
+
disabled: true
|
|
129
|
+
})),
|
|
130
|
+
getByRole = _render4.getByRole,
|
|
131
|
+
getAllByRole = _render4.getAllByRole;
|
|
102
132
|
var radioGroup = getByRole("radiogroup");
|
|
103
133
|
var radios = getAllByRole("radio");
|
|
104
134
|
expect(radioGroup.getAttribute("aria-disabled")).toBe("true");
|
|
105
135
|
radios.forEach(function (radio) {
|
|
106
136
|
expect(radio.tabIndex).toBe(-1);
|
|
107
137
|
});
|
|
108
|
-
|
|
109
138
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
110
|
-
key: "
|
|
111
|
-
code: "
|
|
139
|
+
key: " ",
|
|
140
|
+
code: "Space",
|
|
112
141
|
keyCode: 13,
|
|
113
142
|
charCode: 13
|
|
114
143
|
});
|
|
115
|
-
|
|
116
144
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
117
145
|
key: "ArrowLeft",
|
|
118
146
|
code: "ArrowLeft",
|
|
119
147
|
keyCode: 37,
|
|
120
148
|
charCode: 37
|
|
121
149
|
});
|
|
122
|
-
|
|
123
150
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
124
151
|
key: "ArrowDown",
|
|
125
152
|
code: "ArrowDown",
|
|
126
153
|
keyCode: 40,
|
|
127
154
|
charCode: 40
|
|
128
155
|
});
|
|
129
|
-
|
|
130
156
|
radios.forEach(function (radio) {
|
|
131
157
|
expect(radio.tabIndex).toBe(-1);
|
|
132
158
|
});
|
|
133
159
|
});
|
|
134
160
|
test("Disabled option renders with correct aria attribute, correct tabIndex value and it is not focusable by keyboard (focus 'jumps' the disabled option)", function () {
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
161
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
162
|
+
name: "test",
|
|
163
|
+
label: "test-radioGroup-label",
|
|
164
|
+
options: singleDisabledOptions
|
|
165
|
+
})),
|
|
166
|
+
getByRole = _render5.getByRole,
|
|
167
|
+
getAllByRole = _render5.getAllByRole;
|
|
143
168
|
var radioGroup = getByRole("radiogroup");
|
|
144
169
|
var radios = getAllByRole("radio");
|
|
145
170
|
expect(radios[2].getAttribute("aria-disabled")).toBe("true");
|
|
146
171
|
expect(radios[0].tabIndex).toBe(0);
|
|
147
172
|
expect(radios[1].tabIndex).toBe(-1);
|
|
148
173
|
expect(radios[2].tabIndex).toBe(-1);
|
|
149
|
-
|
|
150
174
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
151
175
|
key: "ArrowDown",
|
|
152
176
|
code: "ArrowDown",
|
|
153
177
|
keyCode: 40,
|
|
154
178
|
charCode: 40
|
|
155
179
|
});
|
|
156
|
-
|
|
157
180
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
158
181
|
key: "ArrowDown",
|
|
159
182
|
code: "ArrowDown",
|
|
160
183
|
keyCode: 40,
|
|
161
184
|
charCode: 40
|
|
162
185
|
});
|
|
163
|
-
|
|
164
186
|
expect(radios[0].tabIndex).toBe(0);
|
|
165
187
|
expect(radios[1].tabIndex).toBe(-1);
|
|
166
188
|
expect(radios[2].tabIndex).toBe(-1);
|
|
167
189
|
});
|
|
190
|
+
test("Disabled radio group doesn't send its value when submitted", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
191
|
+
var handlerOnSubmit, _render6, getByText, submit;
|
|
192
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
193
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
194
|
+
case 0:
|
|
195
|
+
handlerOnSubmit = jest.fn(function (e) {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
var formData = new FormData(e.target);
|
|
198
|
+
var formProps = Object.fromEntries(formData);
|
|
199
|
+
expect(formProps).toStrictEqual({});
|
|
200
|
+
});
|
|
201
|
+
_render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
|
|
202
|
+
onSubmit: handlerOnSubmit
|
|
203
|
+
}, /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
204
|
+
name: "radiogroup",
|
|
205
|
+
defaultValue: "1",
|
|
206
|
+
disabled: true,
|
|
207
|
+
label: "test-radio-group-label",
|
|
208
|
+
options: options
|
|
209
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
210
|
+
type: "submit"
|
|
211
|
+
}, "Submit"))), getByText = _render6.getByText;
|
|
212
|
+
submit = getByText("Submit");
|
|
213
|
+
_context2.next = 5;
|
|
214
|
+
return _userEvent["default"].click(submit);
|
|
215
|
+
case 5:
|
|
216
|
+
case "end":
|
|
217
|
+
return _context2.stop();
|
|
218
|
+
}
|
|
219
|
+
}, _callee2);
|
|
220
|
+
})));
|
|
168
221
|
test("Error state renders with correct aria attributes", function () {
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
222
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
223
|
+
label: "test-radioGroup-label",
|
|
224
|
+
options: options,
|
|
225
|
+
error: "Error message"
|
|
226
|
+
})),
|
|
227
|
+
getByRole = _render7.getByRole,
|
|
228
|
+
getByText = _render7.getByText;
|
|
177
229
|
var radioGroup = getByRole("radiogroup");
|
|
178
230
|
var errorMessage = getByText("Error message");
|
|
179
231
|
expect(radioGroup.getAttribute("aria-errormessage")).toBe(errorMessage.id);
|
|
180
232
|
expect(radioGroup.getAttribute("aria-invalid")).toBe("true");
|
|
181
233
|
expect(errorMessage.getAttribute("aria-live")).toBe("assertive");
|
|
182
234
|
});
|
|
183
|
-
test("Radio group with required constraint and 'undefined' as value, sends an error", function () {
|
|
184
|
-
var onChange
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
test("Radio group with required constraint and 'undefined' as value, sends an error", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
236
|
+
var onChange, onBlur, _render8, getByRole, getAllByRole, radioGroup;
|
|
237
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
238
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
onChange = jest.fn();
|
|
241
|
+
onBlur = jest.fn();
|
|
242
|
+
_render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
243
|
+
label: "test-radioGroup-label",
|
|
244
|
+
options: options,
|
|
245
|
+
onChange: onChange,
|
|
246
|
+
onBlur: onBlur
|
|
247
|
+
})), getByRole = _render8.getByRole, getAllByRole = _render8.getAllByRole;
|
|
248
|
+
radioGroup = getByRole("radiogroup");
|
|
249
|
+
expect(radioGroup.getAttribute("aria-required")).toBe("true");
|
|
250
|
+
_react2.fireEvent.blur(radioGroup);
|
|
251
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
252
|
+
error: "This field is required. Please, choose an option."
|
|
253
|
+
});
|
|
254
|
+
_context3.next = 9;
|
|
255
|
+
return _userEvent["default"].click(radioGroup);
|
|
256
|
+
case 9:
|
|
257
|
+
_context3.next = 11;
|
|
258
|
+
return _userEvent["default"].click(getAllByRole("radio")[0]);
|
|
259
|
+
case 11:
|
|
260
|
+
expect(onChange).toHaveBeenCalledWith("1");
|
|
261
|
+
_react2.fireEvent.blur(radioGroup);
|
|
262
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
263
|
+
value: "1"
|
|
264
|
+
});
|
|
265
|
+
case 14:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context3.stop();
|
|
268
|
+
}
|
|
269
|
+
}, _callee3);
|
|
270
|
+
})));
|
|
271
|
+
test("Radio group with required constraint and empty string as value, sends an error", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
272
|
+
var onChange, onBlur, _render9, getByRole, getAllByRole, radioGroup;
|
|
273
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
274
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
275
|
+
case 0:
|
|
276
|
+
onChange = jest.fn();
|
|
277
|
+
onBlur = jest.fn();
|
|
278
|
+
_render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
279
|
+
label: "test-radioGroup-label",
|
|
280
|
+
value: "",
|
|
281
|
+
options: options,
|
|
282
|
+
onChange: onChange,
|
|
283
|
+
onBlur: onBlur
|
|
284
|
+
})), getByRole = _render9.getByRole, getAllByRole = _render9.getAllByRole;
|
|
285
|
+
radioGroup = getByRole("radiogroup");
|
|
286
|
+
expect(radioGroup.getAttribute("aria-required")).toBe("true");
|
|
287
|
+
_react2.fireEvent.blur(radioGroup);
|
|
288
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
289
|
+
value: "",
|
|
290
|
+
error: "This field is required. Please, choose an option."
|
|
291
|
+
});
|
|
292
|
+
_context4.next = 9;
|
|
293
|
+
return _userEvent["default"].click(getAllByRole("radio")[0]);
|
|
294
|
+
case 9:
|
|
295
|
+
expect(onChange).toHaveBeenCalledWith("1");
|
|
296
|
+
case 10:
|
|
297
|
+
case "end":
|
|
298
|
+
return _context4.stop();
|
|
299
|
+
}
|
|
300
|
+
}, _callee4);
|
|
301
|
+
})));
|
|
245
302
|
test("The 'defaultValue' gives the radio group an initial value when it is uncontrolled", function () {
|
|
246
303
|
var onChange = jest.fn();
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
container = _render8.container;
|
|
258
|
-
|
|
304
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
305
|
+
defaultValue: "2",
|
|
306
|
+
name: "test",
|
|
307
|
+
label: "test-radio-group-label",
|
|
308
|
+
helperText: "test-radio-group-helper-text",
|
|
309
|
+
options: options,
|
|
310
|
+
onChange: onChange
|
|
311
|
+
})),
|
|
312
|
+
getAllByRole = _render10.getAllByRole,
|
|
313
|
+
container = _render10.container;
|
|
259
314
|
var radio = getAllByRole("radio")[1];
|
|
260
315
|
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
261
316
|
expect(radio.tabIndex).toBe(0);
|
|
262
317
|
expect(radio.getAttribute("aria-checked")).toBe("true");
|
|
263
318
|
expect(submitInput.value).toBe("2");
|
|
264
319
|
});
|
|
265
|
-
test("Optional radio group conditions: onBlur event doesn't send an error when no radio was checked, has correct aria attributes, custom label and its value is the empty string", function () {
|
|
266
|
-
var onChange
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
key: "Enter",
|
|
426
|
-
code: "Enter",
|
|
427
|
-
keyCode: 13,
|
|
428
|
-
charCode: 13
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
expect(onChange).toHaveBeenCalledWith("1");
|
|
432
|
-
expect(checkedRadio.getAttribute("aria-checked")).toBe("true");
|
|
433
|
-
expect(checkedRadio.tabIndex).toBe(0);
|
|
434
|
-
expect(submitInput.value).toBe("1");
|
|
435
|
-
});
|
|
320
|
+
test("Optional radio group conditions: onBlur event doesn't send an error when no radio was checked, has correct aria attributes, custom label and its value is the empty string", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
321
|
+
var onChange, onBlur, _render11, getByRole, getByText, container, radioGroup, optionalLabel, submitInput;
|
|
322
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
323
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
324
|
+
case 0:
|
|
325
|
+
onChange = jest.fn();
|
|
326
|
+
onBlur = jest.fn();
|
|
327
|
+
_render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
328
|
+
name: "test",
|
|
329
|
+
label: "test-radio-group-label",
|
|
330
|
+
helperText: "test-radio-group-helper-text",
|
|
331
|
+
options: options,
|
|
332
|
+
onChange: onChange,
|
|
333
|
+
onBlur: onBlur,
|
|
334
|
+
optional: true,
|
|
335
|
+
optionalItemLabel: "No selection"
|
|
336
|
+
})), getByRole = _render11.getByRole, getByText = _render11.getByText, container = _render11.container;
|
|
337
|
+
radioGroup = getByRole("radiogroup");
|
|
338
|
+
expect(radioGroup.getAttribute("aria-required")).toBe("false");
|
|
339
|
+
_react2.fireEvent.blur(radioGroup);
|
|
340
|
+
expect(onBlur).toHaveBeenCalledWith({});
|
|
341
|
+
expect(radioGroup.getAttribute("aria-invalid")).toBe("false");
|
|
342
|
+
optionalLabel = getByText("No selection");
|
|
343
|
+
submitInput = container.querySelector("input[name=\"test\"]");
|
|
344
|
+
_context5.next = 12;
|
|
345
|
+
return _userEvent["default"].click(optionalLabel);
|
|
346
|
+
case 12:
|
|
347
|
+
expect(onChange).toHaveBeenCalledWith("");
|
|
348
|
+
expect(submitInput.value).toBe("");
|
|
349
|
+
case 14:
|
|
350
|
+
case "end":
|
|
351
|
+
return _context5.stop();
|
|
352
|
+
}
|
|
353
|
+
}, _callee5);
|
|
354
|
+
})));
|
|
355
|
+
test("Controlled radio group", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
356
|
+
var onChange, onBlur, _render12, getByRole, getAllByRole, container, radioGroup, radios, submitInput;
|
|
357
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
358
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
359
|
+
case 0:
|
|
360
|
+
onChange = jest.fn();
|
|
361
|
+
onBlur = jest.fn();
|
|
362
|
+
_render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
363
|
+
name: "test",
|
|
364
|
+
value: "2",
|
|
365
|
+
label: "test-radio-group-label",
|
|
366
|
+
helperText: "test-radio-group-helper-text",
|
|
367
|
+
options: options,
|
|
368
|
+
onChange: onChange,
|
|
369
|
+
onBlur: onBlur
|
|
370
|
+
})), getByRole = _render12.getByRole, getAllByRole = _render12.getAllByRole, container = _render12.container;
|
|
371
|
+
radioGroup = getByRole("radiogroup");
|
|
372
|
+
radios = getAllByRole("radio");
|
|
373
|
+
submitInput = container.querySelector("input[name=\"test\"]");
|
|
374
|
+
expect(submitInput.value).toBe("2");
|
|
375
|
+
expect(radios[1].tabIndex).toBe(0);
|
|
376
|
+
expect(radios[1].getAttribute("aria-checked")).toBe("true");
|
|
377
|
+
_context6.next = 11;
|
|
378
|
+
return _userEvent["default"].click(radios[6]);
|
|
379
|
+
case 11:
|
|
380
|
+
expect(onChange).toHaveBeenCalledWith("7");
|
|
381
|
+
_react2.fireEvent.blur(radioGroup);
|
|
382
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
383
|
+
value: "2"
|
|
384
|
+
});
|
|
385
|
+
case 14:
|
|
386
|
+
case "end":
|
|
387
|
+
return _context6.stop();
|
|
388
|
+
}
|
|
389
|
+
}, _callee6);
|
|
390
|
+
})));
|
|
391
|
+
test("Select an option by clicking on its label", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
392
|
+
var onChange, _render13, getByText, getAllByRole, container, radioLabel, checkedRadio, submitInput;
|
|
393
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
394
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
onChange = jest.fn();
|
|
397
|
+
_render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
398
|
+
name: "test",
|
|
399
|
+
label: "test-radio-group-label",
|
|
400
|
+
helperText: "test-radio-group-helper-text",
|
|
401
|
+
options: options,
|
|
402
|
+
onChange: onChange
|
|
403
|
+
})), getByText = _render13.getByText, getAllByRole = _render13.getAllByRole, container = _render13.container;
|
|
404
|
+
radioLabel = getByText("Option 09");
|
|
405
|
+
checkedRadio = getAllByRole("radio")[8];
|
|
406
|
+
submitInput = container.querySelector("input[name=\"test\"]");
|
|
407
|
+
expect(checkedRadio.tabIndex).toBe(-1);
|
|
408
|
+
_context7.next = 8;
|
|
409
|
+
return _userEvent["default"].click(radioLabel);
|
|
410
|
+
case 8:
|
|
411
|
+
expect(onChange).toHaveBeenCalledWith("9");
|
|
412
|
+
expect(checkedRadio.getAttribute("aria-checked")).toBe("true");
|
|
413
|
+
expect(checkedRadio.tabIndex).toBe(0);
|
|
414
|
+
expect(document.activeElement).toEqual(checkedRadio);
|
|
415
|
+
expect(submitInput.value).toBe("9");
|
|
416
|
+
case 13:
|
|
417
|
+
case "end":
|
|
418
|
+
return _context7.stop();
|
|
419
|
+
}
|
|
420
|
+
}, _callee7);
|
|
421
|
+
})));
|
|
422
|
+
test("Select an option by clicking on its radio input", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
423
|
+
var onChange, _render14, getAllByRole, container, checkedRadio, submitInput;
|
|
424
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
425
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
426
|
+
case 0:
|
|
427
|
+
onChange = jest.fn();
|
|
428
|
+
_render14 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
429
|
+
name: "test",
|
|
430
|
+
label: "test-radio-group-label",
|
|
431
|
+
helperText: "test-radio-group-helper-text",
|
|
432
|
+
options: options,
|
|
433
|
+
onChange: onChange
|
|
434
|
+
})), getAllByRole = _render14.getAllByRole, container = _render14.container;
|
|
435
|
+
checkedRadio = getAllByRole("radio")[6];
|
|
436
|
+
submitInput = container.querySelector("input[name=\"test\"]");
|
|
437
|
+
expect(checkedRadio.tabIndex).toBe(-1);
|
|
438
|
+
_context8.next = 7;
|
|
439
|
+
return _userEvent["default"].click(checkedRadio);
|
|
440
|
+
case 7:
|
|
441
|
+
expect(onChange).toHaveBeenCalledWith("7");
|
|
442
|
+
expect(checkedRadio.getAttribute("aria-checked")).toBe("true");
|
|
443
|
+
expect(checkedRadio.tabIndex).toBe(0);
|
|
444
|
+
expect(document.activeElement).toEqual(checkedRadio);
|
|
445
|
+
expect(submitInput.value).toBe("7");
|
|
446
|
+
case 12:
|
|
447
|
+
case "end":
|
|
448
|
+
return _context8.stop();
|
|
449
|
+
}
|
|
450
|
+
}, _callee8);
|
|
451
|
+
})));
|
|
452
|
+
test("Select an option that is already checked does not call onChange event but gives the focus", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
453
|
+
var onChange, _render15, getAllByRole, checkedRadio;
|
|
454
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
455
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
456
|
+
case 0:
|
|
457
|
+
onChange = jest.fn();
|
|
458
|
+
_render15 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
459
|
+
defaultValue: "2",
|
|
460
|
+
name: "test",
|
|
461
|
+
label: "test-radio-group-label",
|
|
462
|
+
helperText: "test-radio-group-helper-text",
|
|
463
|
+
options: options,
|
|
464
|
+
onChange: onChange
|
|
465
|
+
})), getAllByRole = _render15.getAllByRole;
|
|
466
|
+
checkedRadio = getAllByRole("radio")[1];
|
|
467
|
+
expect(checkedRadio.tabIndex).toBe(0);
|
|
468
|
+
expect(checkedRadio.getAttribute("aria-checked")).toBe("true");
|
|
469
|
+
_context9.next = 7;
|
|
470
|
+
return _userEvent["default"].click(checkedRadio);
|
|
471
|
+
case 7:
|
|
472
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
473
|
+
expect(document.activeElement).toEqual(checkedRadio);
|
|
474
|
+
case 9:
|
|
475
|
+
case "end":
|
|
476
|
+
return _context9.stop();
|
|
477
|
+
}
|
|
478
|
+
}, _callee9);
|
|
479
|
+
})));
|
|
436
480
|
test("The 'space' key checks the current focused option if anyone is checked", function () {
|
|
437
481
|
var onChange = jest.fn();
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
container = _render15.container;
|
|
449
|
-
|
|
482
|
+
var _render16 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
483
|
+
name: "test",
|
|
484
|
+
label: "test-radio-group-label",
|
|
485
|
+
helperText: "test-radio-group-helper-text",
|
|
486
|
+
options: options,
|
|
487
|
+
onChange: onChange
|
|
488
|
+
})),
|
|
489
|
+
getByRole = _render16.getByRole,
|
|
490
|
+
getAllByRole = _render16.getAllByRole,
|
|
491
|
+
container = _render16.container;
|
|
450
492
|
var radioGroup = getByRole("radiogroup");
|
|
451
493
|
var checkedRadio = getAllByRole("radio")[0];
|
|
452
494
|
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
453
|
-
|
|
454
495
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
455
|
-
key: "
|
|
496
|
+
key: " ",
|
|
456
497
|
code: "Space",
|
|
457
498
|
keyCode: 32,
|
|
458
499
|
charCode: 32
|
|
459
500
|
});
|
|
460
|
-
|
|
461
501
|
expect(onChange).toHaveBeenCalledWith("1");
|
|
462
502
|
expect(checkedRadio.getAttribute("aria-checked")).toBe("true");
|
|
463
503
|
expect(checkedRadio.tabIndex).toBe(0);
|
|
@@ -466,39 +506,33 @@ describe("Radio Group component tests", function () {
|
|
|
466
506
|
test("When the radio group gains the focus by keyboard ('tab' key), it goes to the first option (if no one was previously selected), without selecting it", function () {
|
|
467
507
|
var onChange = jest.fn();
|
|
468
508
|
var onBlur = jest.fn();
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
container = _render16.container;
|
|
481
|
-
|
|
509
|
+
var _render17 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
510
|
+
name: "test",
|
|
511
|
+
label: "test-radio-group-label",
|
|
512
|
+
helperText: "test-radio-group-helper-text",
|
|
513
|
+
options: options,
|
|
514
|
+
onChange: onChange,
|
|
515
|
+
onBlur: onBlur
|
|
516
|
+
})),
|
|
517
|
+
getByRole = _render17.getByRole,
|
|
518
|
+
getAllByRole = _render17.getAllByRole,
|
|
519
|
+
container = _render17.container;
|
|
482
520
|
var radioGroup = getByRole("radiogroup");
|
|
483
521
|
var radios = getAllByRole("radio");
|
|
484
522
|
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
485
523
|
var checkedRadio = getAllByRole("radio")[0];
|
|
486
|
-
|
|
487
524
|
_userEvent["default"].tab();
|
|
488
|
-
|
|
489
525
|
expect(onChange).not.toHaveBeenCalled();
|
|
490
526
|
expect(submitInput.value).toBe("");
|
|
491
527
|
expect(checkedRadio.tabIndex).toBe(0);
|
|
492
528
|
expect(checkedRadio.getAttribute("aria-checked")).toBe("false");
|
|
493
529
|
expect(document.activeElement).toEqual(checkedRadio);
|
|
494
|
-
|
|
495
530
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
496
531
|
key: "ArrowRight",
|
|
497
532
|
code: "ArrowRight",
|
|
498
533
|
keyCode: 39,
|
|
499
534
|
charCode: 39
|
|
500
535
|
});
|
|
501
|
-
|
|
502
536
|
expect(onBlur).not.toHaveBeenCalled();
|
|
503
537
|
expect(onChange).toHaveBeenCalledTimes(1);
|
|
504
538
|
expect(radios[1].getAttribute("aria-checked")).toBe("true");
|
|
@@ -509,45 +543,39 @@ describe("Radio Group component tests", function () {
|
|
|
509
543
|
test("The 'arrowDown' and 'arrowRight' keys move the selection to the next radio. When the last radio is reached, moves the selection to the first one", function () {
|
|
510
544
|
var onChange = jest.fn();
|
|
511
545
|
var onBlur = jest.fn();
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
container = _render17.container;
|
|
525
|
-
|
|
546
|
+
var _render18 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
547
|
+
defaultValue: "8",
|
|
548
|
+
name: "test",
|
|
549
|
+
label: "test-radio-group-label",
|
|
550
|
+
helperText: "test-radio-group-helper-text",
|
|
551
|
+
options: options,
|
|
552
|
+
onChange: onChange,
|
|
553
|
+
onBlur: onBlur
|
|
554
|
+
})),
|
|
555
|
+
getByRole = _render18.getByRole,
|
|
556
|
+
getAllByRole = _render18.getAllByRole,
|
|
557
|
+
container = _render18.container;
|
|
526
558
|
var radioGroup = getByRole("radiogroup");
|
|
527
559
|
var radios = getAllByRole("radio");
|
|
528
560
|
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
529
|
-
|
|
530
561
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
531
562
|
key: "ArrowDown",
|
|
532
563
|
code: "ArrowDown",
|
|
533
564
|
keyCode: 40,
|
|
534
565
|
charCode: 40
|
|
535
566
|
});
|
|
536
|
-
|
|
537
567
|
expect(onBlur).not.toHaveBeenCalled();
|
|
538
568
|
expect(onChange).toHaveBeenCalledTimes(1);
|
|
539
569
|
expect(radios[8].getAttribute("aria-checked")).toBe("true");
|
|
540
570
|
expect(document.activeElement).toEqual(radios[8]);
|
|
541
571
|
expect(radios[8].tabIndex).toBe(0);
|
|
542
572
|
expect(submitInput.value).toBe("9");
|
|
543
|
-
|
|
544
573
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
545
574
|
key: "ArrowRight",
|
|
546
575
|
code: "ArrowRight",
|
|
547
576
|
keyCode: 39,
|
|
548
577
|
charCode: 39
|
|
549
578
|
});
|
|
550
|
-
|
|
551
579
|
expect(onBlur).not.toHaveBeenCalled();
|
|
552
580
|
expect(onChange).toHaveBeenCalledTimes(2);
|
|
553
581
|
expect(radios[0].getAttribute("aria-checked")).toBe("true");
|
|
@@ -558,45 +586,39 @@ describe("Radio Group component tests", function () {
|
|
|
558
586
|
test("The 'arrowUp' and 'arrowLeft' keys move the selection to the previous radio. When the first radio is reached, moves the selection to the last one", function () {
|
|
559
587
|
var onChange = jest.fn();
|
|
560
588
|
var onBlur = jest.fn();
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
container = _render18.container;
|
|
574
|
-
|
|
589
|
+
var _render19 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
590
|
+
defaultValue: "2",
|
|
591
|
+
name: "test",
|
|
592
|
+
label: "test-radio-group-label",
|
|
593
|
+
helperText: "test-radio-group-helper-text",
|
|
594
|
+
options: options,
|
|
595
|
+
onChange: onChange,
|
|
596
|
+
onBlur: onBlur
|
|
597
|
+
})),
|
|
598
|
+
getByRole = _render19.getByRole,
|
|
599
|
+
getAllByRole = _render19.getAllByRole,
|
|
600
|
+
container = _render19.container;
|
|
575
601
|
var radioGroup = getByRole("radiogroup");
|
|
576
602
|
var radios = getAllByRole("radio");
|
|
577
603
|
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
578
|
-
|
|
579
604
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
580
605
|
key: "ArrowUp",
|
|
581
606
|
code: "ArrowUp",
|
|
582
607
|
keyCode: 38,
|
|
583
608
|
charCode: 38
|
|
584
609
|
});
|
|
585
|
-
|
|
586
610
|
expect(onBlur).not.toHaveBeenCalled();
|
|
587
611
|
expect(onChange).toHaveBeenCalledTimes(1);
|
|
588
612
|
expect(radios[0].getAttribute("aria-checked")).toBe("true");
|
|
589
613
|
expect(document.activeElement).toEqual(radios[0]);
|
|
590
614
|
expect(radios[0].tabIndex).toBe(0);
|
|
591
615
|
expect(submitInput.value).toBe("1");
|
|
592
|
-
|
|
593
616
|
_react2.fireEvent.keyDown(radioGroup, {
|
|
594
617
|
key: "ArrowLeft",
|
|
595
618
|
code: "ArrowLeft",
|
|
596
619
|
keyCode: 37,
|
|
597
620
|
charCode: 37
|
|
598
621
|
});
|
|
599
|
-
|
|
600
622
|
expect(onBlur).not.toHaveBeenCalled();
|
|
601
623
|
expect(onChange).toHaveBeenCalledTimes(2);
|
|
602
624
|
expect(radios[8].getAttribute("aria-checked")).toBe("true");
|
|
@@ -604,92 +626,129 @@ describe("Radio Group component tests", function () {
|
|
|
604
626
|
expect(radios[8].tabIndex).toBe(0);
|
|
605
627
|
expect(submitInput.value).toBe("9");
|
|
606
628
|
});
|
|
607
|
-
test("Keyboard focus movement continues from the last radio input clicked", function () {
|
|
608
|
-
var onChange
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
var
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
629
|
+
test("Keyboard focus movement continues from the last radio input clicked", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
630
|
+
var onChange, _render20, getByRole, getAllByRole, container, radioGroup, radios, submitInput;
|
|
631
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
632
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
633
|
+
case 0:
|
|
634
|
+
onChange = jest.fn();
|
|
635
|
+
_render20 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
636
|
+
name: "test",
|
|
637
|
+
label: "test-radio-group-label",
|
|
638
|
+
helperText: "test-radio-group-helper-text",
|
|
639
|
+
options: options,
|
|
640
|
+
onChange: onChange
|
|
641
|
+
})), getByRole = _render20.getByRole, getAllByRole = _render20.getAllByRole, container = _render20.container;
|
|
642
|
+
radioGroup = getByRole("radiogroup");
|
|
643
|
+
radios = getAllByRole("radio");
|
|
644
|
+
submitInput = container.querySelector("input[name=\"test\"]");
|
|
645
|
+
_context10.next = 7;
|
|
646
|
+
return _userEvent["default"].click(radios[3]);
|
|
647
|
+
case 7:
|
|
648
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
649
|
+
key: "ArrowDown",
|
|
650
|
+
code: "ArrowDown",
|
|
651
|
+
keyCode: 40,
|
|
652
|
+
charCode: 40
|
|
653
|
+
});
|
|
654
|
+
expect(onChange).toHaveBeenCalledWith("5");
|
|
655
|
+
expect(radios[4].getAttribute("aria-checked")).toBe("true");
|
|
656
|
+
expect(document.activeElement).toEqual(radios[4]);
|
|
657
|
+
expect(radios[4].tabIndex).toBe(0);
|
|
658
|
+
expect(submitInput.value).toBe("5");
|
|
659
|
+
_context10.next = 15;
|
|
660
|
+
return _userEvent["default"].click(radios[8]);
|
|
661
|
+
case 15:
|
|
662
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
663
|
+
key: "ArrowLeft",
|
|
664
|
+
code: "ArrowLeft",
|
|
665
|
+
keyCode: 37,
|
|
666
|
+
charCode: 37
|
|
667
|
+
});
|
|
668
|
+
expect(onChange).toHaveBeenCalledWith("8");
|
|
669
|
+
expect(radios[7].getAttribute("aria-checked")).toBe("true");
|
|
670
|
+
expect(document.activeElement).toEqual(radios[7]);
|
|
671
|
+
expect(radios[7].tabIndex).toBe(0);
|
|
672
|
+
expect(submitInput.value).toBe("8");
|
|
673
|
+
case 21:
|
|
674
|
+
case "end":
|
|
675
|
+
return _context10.stop();
|
|
676
|
+
}
|
|
677
|
+
}, _callee10);
|
|
678
|
+
})));
|
|
679
|
+
test("Read-only radio group lets the user move the focus, but neither click nor keyboard press changes the value", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
680
|
+
var onChange, _render21, getByRole, getAllByRole, container, radioGroup, radios, submitInput;
|
|
681
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
682
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
683
|
+
case 0:
|
|
684
|
+
onChange = jest.fn();
|
|
685
|
+
_render21 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
686
|
+
name: "test",
|
|
687
|
+
label: "test-radio-group-label",
|
|
688
|
+
helperText: "test-radio-group-helper-text",
|
|
689
|
+
options: options,
|
|
690
|
+
onChange: onChange,
|
|
691
|
+
readOnly: true
|
|
692
|
+
})), getByRole = _render21.getByRole, getAllByRole = _render21.getAllByRole, container = _render21.container;
|
|
693
|
+
radioGroup = getByRole("radiogroup");
|
|
694
|
+
radios = getAllByRole("radio");
|
|
695
|
+
submitInput = container.querySelector("input[name=\"test\"]");
|
|
696
|
+
_context11.next = 7;
|
|
697
|
+
return _userEvent["default"].click(radios[5]);
|
|
698
|
+
case 7:
|
|
699
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
700
|
+
expect(radios[5].getAttribute("aria-checked")).toBe("false");
|
|
701
|
+
expect(document.activeElement).toEqual(radios[5]);
|
|
702
|
+
expect(radios[5].tabIndex).toBe(0);
|
|
703
|
+
expect(submitInput.value).toBe("");
|
|
704
|
+
_react2.fireEvent.keyDown(radioGroup, {
|
|
705
|
+
key: "ArrowUp",
|
|
706
|
+
code: "ArrowUp",
|
|
707
|
+
keyCode: 38,
|
|
708
|
+
charCode: 38
|
|
709
|
+
});
|
|
710
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
711
|
+
expect(radios[4].getAttribute("aria-checked")).toBe("false");
|
|
712
|
+
expect(document.activeElement).toEqual(radios[4]);
|
|
713
|
+
expect(radios[4].tabIndex).toBe(0);
|
|
714
|
+
expect(submitInput.value).toBe("");
|
|
715
|
+
case 18:
|
|
716
|
+
case "end":
|
|
717
|
+
return _context11.stop();
|
|
718
|
+
}
|
|
719
|
+
}, _callee11);
|
|
720
|
+
})));
|
|
721
|
+
test("Read-only radio group sends its value on submit", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
722
|
+
var handlerOnSubmit, _render22, getByText, submit;
|
|
723
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
724
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
725
|
+
case 0:
|
|
726
|
+
handlerOnSubmit = jest.fn(function (e) {
|
|
727
|
+
e.preventDefault();
|
|
728
|
+
var formData = new FormData(e.target);
|
|
729
|
+
var formProps = Object.fromEntries(formData);
|
|
730
|
+
expect(formProps).toStrictEqual({
|
|
731
|
+
radiogroup: "data"
|
|
732
|
+
});
|
|
733
|
+
});
|
|
734
|
+
_render22 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
|
|
735
|
+
onSubmit: handlerOnSubmit
|
|
736
|
+
}, /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
737
|
+
name: "radiogroup",
|
|
738
|
+
label: "test-radio-group-label",
|
|
739
|
+
value: "data",
|
|
740
|
+
options: options,
|
|
741
|
+
readOnly: true
|
|
742
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
743
|
+
type: "submit"
|
|
744
|
+
}, "Submit"))), getByText = _render22.getByText;
|
|
745
|
+
submit = getByText("Submit");
|
|
746
|
+
_context12.next = 5;
|
|
747
|
+
return _userEvent["default"].click(submit);
|
|
748
|
+
case 5:
|
|
749
|
+
case "end":
|
|
750
|
+
return _context12.stop();
|
|
751
|
+
}
|
|
752
|
+
}, _callee12);
|
|
753
|
+
})));
|
|
695
754
|
});
|