@patternfly/react-core 4.202.28 → 4.202.31

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.
Files changed (105) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/components/JumpLinks/JumpLinksItem.d.ts.map +1 -1
  3. package/dist/esm/components/JumpLinks/JumpLinksItem.js +1 -1
  4. package/dist/esm/components/JumpLinks/JumpLinksItem.js.map +1 -1
  5. package/dist/esm/components/ProgressStepper/ProgressStep.d.ts +3 -0
  6. package/dist/esm/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
  7. package/dist/esm/components/ProgressStepper/ProgressStep.js +2 -2
  8. package/dist/esm/components/ProgressStepper/ProgressStep.js.map +1 -1
  9. package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
  10. package/dist/esm/components/Tabs/Tab.js +2 -2
  11. package/dist/esm/components/Tabs/Tab.js.map +1 -1
  12. package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
  13. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  14. package/dist/esm/components/Tabs/Tabs.js +1 -1
  15. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  16. package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
  17. package/dist/esm/helpers/Popper/Popper.js +1 -7
  18. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  19. package/dist/js/components/JumpLinks/JumpLinksItem.d.ts.map +1 -1
  20. package/dist/js/components/JumpLinks/JumpLinksItem.js +1 -1
  21. package/dist/js/components/JumpLinks/JumpLinksItem.js.map +1 -1
  22. package/dist/js/components/ProgressStepper/ProgressStep.d.ts +3 -0
  23. package/dist/js/components/ProgressStepper/ProgressStep.d.ts.map +1 -1
  24. package/dist/js/components/ProgressStepper/ProgressStep.js +2 -2
  25. package/dist/js/components/ProgressStepper/ProgressStep.js.map +1 -1
  26. package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
  27. package/dist/js/components/Tabs/Tab.js +2 -2
  28. package/dist/js/components/Tabs/Tab.js.map +1 -1
  29. package/dist/js/components/Tabs/Tabs.d.ts +1 -1
  30. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  31. package/dist/js/components/Tabs/Tabs.js +1 -1
  32. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  33. package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
  34. package/dist/js/helpers/Popper/Popper.js +1 -7
  35. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  36. package/dist/umd/react-core.js +7 -13
  37. package/dist/umd/react-core.min.js +1 -1
  38. package/package.json +5 -5
  39. package/src/components/Dropdown/__tests__/DropdownToggleCheckbox.test.tsx +1 -1
  40. package/src/components/ExpandableSection/examples/ExpandableSection.md +1 -1
  41. package/src/components/JumpLinks/JumpLinksItem.tsx +5 -1
  42. package/src/components/JumpLinks/__tests__/__snapshots__/JumpLinks.test.tsx.snap +5 -0
  43. package/src/components/Page/__tests__/Page.test.tsx +225 -205
  44. package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +1088 -2059
  45. package/src/components/Pagination/__tests__/Pagination.test.tsx +235 -283
  46. package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +143 -577
  47. package/src/components/ProgressStepper/ProgressStep.tsx +6 -0
  48. package/src/components/ProgressStepper/__tests__/__snapshots__/ProgressStepper.test.tsx.snap +1 -0
  49. package/src/components/ProgressStepper/examples/ProgressStepper.md +9 -9
  50. package/src/components/Radio/__tests__/Radio.test.tsx +38 -44
  51. package/src/components/Radio/__tests__/__snapshots__/Radio.test.tsx.snap +30 -30
  52. package/src/components/SearchInput/__tests__/SearchInput.test.tsx +87 -68
  53. package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +230 -137
  54. package/src/components/Select/__tests__/Select.test.tsx +238 -195
  55. package/src/components/Select/__tests__/SelectToggle.test.tsx +68 -130
  56. package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +978 -2149
  57. package/src/components/Select/__tests__/__snapshots__/SelectToggle.test.tsx.snap +3 -3
  58. package/src/components/SimpleList/__tests__/SimpleList.test.tsx +29 -32
  59. package/src/components/SimpleList/__tests__/__snapshots__/SimpleList.test.tsx.snap +4 -366
  60. package/src/components/Switch/__tests__/Switch.test.tsx +85 -75
  61. package/src/components/Switch/__tests__/__snapshots__/Switch.test.tsx.snap +30 -40
  62. package/src/components/Tabs/Tab.tsx +6 -1
  63. package/src/components/Tabs/Tabs.tsx +2 -2
  64. package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +1 -0
  65. package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +3 -0
  66. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +135 -0
  67. package/src/components/Tabs/examples/Tabs.md +32 -26
  68. package/src/components/TextArea/__tests__/TextArea.test.tsx +98 -103
  69. package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +24 -103
  70. package/src/components/TextInput/__tests__/TextInput.test.tsx +71 -70
  71. package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +15 -103
  72. package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +65 -39
  73. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +53 -14
  74. package/src/components/TimePicker/__tests__/TimePicker.test.tsx +113 -110
  75. package/src/components/Title/__tests__/Title.test.tsx +21 -20
  76. package/src/components/Title/__tests__/__snapshots__/Title.test.tsx.snap +24 -30
  77. package/src/components/ToggleGroup/__tests__/ToggleGroup.test.tsx +43 -39
  78. package/src/components/ToggleGroup/__tests__/__snapshots__/ToggleGroup.test.tsx.snap +20 -19
  79. package/src/components/Wizard/__tests__/Wizard.test.tsx +195 -189
  80. package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +131 -10
  81. package/src/helpers/Popper/Popper.tsx +5 -7
  82. package/src/helpers/__tests__/util.test.ts +113 -0
  83. package/src/layouts/Bullseye/__tests__/Bullseye.test.tsx +25 -25
  84. package/src/layouts/Bullseye/__tests__/__snapshots__/Bullseye.test.tsx.snap +3 -5
  85. package/src/layouts/Flex/__tests__/Flex.test.tsx +159 -96
  86. package/src/layouts/Flex/__tests__/__snapshots__/Flex.test.tsx.snap +9 -17
  87. package/src/components/Page/__tests__/Generated/Page.test.tsx +0 -28
  88. package/src/components/Page/__tests__/Generated/__snapshots__/Page.test.tsx.snap +0 -19
  89. package/src/components/Pagination/__tests__/Generated/Pagination.test.tsx +0 -58
  90. package/src/components/Pagination/__tests__/Generated/__snapshots__/Pagination.test.tsx.snap +0 -205
  91. package/src/components/Radio/__tests__/Generated/Radio.test.tsx +0 -29
  92. package/src/components/Radio/__tests__/Generated/__snapshots__/Radio.test.tsx.snap +0 -36
  93. package/src/components/Select/__tests__/Generated/Select.test.tsx +0 -49
  94. package/src/components/Select/__tests__/Generated/SelectToggle.test.tsx +0 -34
  95. package/src/components/Select/__tests__/Generated/__snapshots__/Select.test.tsx.snap +0 -48
  96. package/src/components/Select/__tests__/Generated/__snapshots__/SelectToggle.test.tsx.snap +0 -36
  97. package/src/components/SimpleList/__tests__/Generated/SimpleList.test.tsx +0 -22
  98. package/src/components/SimpleList/__tests__/Generated/__snapshots__/SimpleList.test.tsx.snap +0 -13
  99. package/src/components/Switch/__tests__/Generated/Switch.test.tsx +0 -24
  100. package/src/components/Switch/__tests__/Generated/__snapshots__/Switch.test.tsx.snap +0 -36
  101. package/src/components/TextArea/__tests__/Generated/TextArea.test.tsx +0 -23
  102. package/src/components/TextArea/__tests__/Generated/__snapshots__/TextArea.test.tsx.snap +0 -13
  103. package/src/components/Title/__tests__/Generated/Title.test.tsx +0 -13
  104. package/src/components/Title/__tests__/Generated/__snapshots__/Title.test.tsx.snap +0 -12
  105. package/src/helpers/__tests__/util.test.js +0 -235
@@ -2,7 +2,7 @@
2
2
  id: Tabs
3
3
  section: components
4
4
  cssPrefix: pf-c-tabs
5
- propComponents: ['Tabs', 'TabProps', 'TabContent', 'TabTitleText', 'TabTitleIcon']
5
+ propComponents: ['Tabs', 'Tab', 'TabContent', 'TabTitleText', 'TabTitleIcon']
6
6
  ouia: true
7
7
  ---
8
8
 
@@ -56,7 +56,7 @@ class SimpleTabs extends React.Component {
56
56
 
57
57
  return (
58
58
  <div>
59
- <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox}>
59
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox} aria-label="Tabs in the default example">
60
60
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
61
61
  Users
62
62
  </Tab>
@@ -132,7 +132,7 @@ class SimpleTabs extends React.Component {
132
132
 
133
133
  return (
134
134
  <div>
135
- <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox}>
135
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox} aria-label="Tabs in the example with a tooltip ref">
136
136
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
137
137
  Users
138
138
  </Tab>
@@ -193,7 +193,7 @@ class UncontrolledSimpleTabs extends React.Component {
193
193
 
194
194
  return (
195
195
  <>
196
- <Tabs defaultActiveKey={0}>
196
+ <Tabs defaultActiveKey={0} aria-label="Tabs in the uncontrolled example">
197
197
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
198
198
  Users
199
199
  </Tab>
@@ -264,6 +264,7 @@ class SimpleTabs extends React.Component {
264
264
  onSelect={this.handleTabClick}
265
265
  variant={isTabsLightScheme ? 'light300' : 'default'}
266
266
  isBox
267
+ aria-label="Tabs in the box light variation example"
267
268
  >
268
269
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
269
270
  Users
@@ -337,7 +338,7 @@ class ScrollButtonsPrimaryTabs extends React.Component {
337
338
  const { activeTabKey, isBox } = this.state;
338
339
  return (
339
340
  <div>
340
- <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox}>
341
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox} aria-label="Tabs in the default overflow example">
341
342
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
342
343
  Users
343
344
  </Tab>
@@ -423,7 +424,7 @@ class VerticalTabs extends React.Component {
423
424
 
424
425
  return (
425
426
  <div>
426
- <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isVertical isBox={isBox}>
427
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} isVertical isBox={isBox} aria-label="Tabs in the vertical example">
427
428
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
428
429
  Users
429
430
  </Tab>
@@ -499,6 +500,7 @@ class VerticalExpandableTabs extends React.Component {
499
500
  isExpanded={isExpanded}
500
501
  onToggle={this.onToggle}
501
502
  toggleText="Containers"
503
+ aria-label="Tabs in the vertical expandable example"
502
504
  >
503
505
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
504
506
  Users
@@ -552,6 +554,7 @@ class VerticalExpandableUncontrolledTabs extends React.Component {
552
554
  expandable={{ default: 'expandable', md: 'nonExpandable', lg: 'expandable' }}
553
555
  defaultIsExpanded={false}
554
556
  toggleText="Containers"
557
+ aria-label="Tabs in the vertical expandable uncontrolled example"
555
558
  >
556
559
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
557
560
  Users
@@ -618,6 +621,7 @@ class InsetTabs extends React.Component {
618
621
  '2xl': 'insetLg'
619
622
  }}
620
623
  isBox={isBox}
624
+ aria-label="Tabs in the inset example"
621
625
  >
622
626
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
623
627
  Users
@@ -685,7 +689,7 @@ class PageInsetsTabs extends React.Component {
685
689
  const { activeTabKey, isBox } = this.state;
686
690
  return (
687
691
  <div>
688
- <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} usePageInsets isBox={isBox}>
692
+ <Tabs activeKey={activeTabKey} onSelect={this.handleTabClick} usePageInsets isBox={isBox} aria-label="Tabs in the page insets example">
689
693
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
690
694
  Users
691
695
  </Tab>
@@ -749,7 +753,7 @@ class IconAndTextTabs extends React.Component {
749
753
 
750
754
  render() {
751
755
  return (
752
- <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}>
756
+ <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} aria-label="Tabs in the icons and text example">
753
757
  <Tab
754
758
  eventKey={0}
755
759
  title={
@@ -872,9 +876,9 @@ class SecondaryTabs extends React.Component {
872
876
  const { activeTabKey1, activeTabKey2, isBox } = this.state;
873
877
  return (
874
878
  <div>
875
- <Tabs activeKey={activeTabKey1} onSelect={this.handleTabClickFirst} isBox={isBox}>
879
+ <Tabs activeKey={activeTabKey1} onSelect={this.handleTabClickFirst} isBox={isBox} aria-label="Tabs in the tabs with subtabs example">
876
880
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
877
- <Tabs activeKey={activeTabKey2} isSecondary onSelect={this.handleTabClickSecond}>
881
+ <Tabs aria-label="secondary tabs for users" activeKey={activeTabKey2} isSecondary onSelect={this.handleTabClickSecond}>
878
882
  <Tab eventKey={20} title={<TabTitleText>Secondary tab item 1</TabTitleText>}>
879
883
  Secondary tab item 1 item section
880
884
  </Tab>
@@ -979,7 +983,7 @@ class FilledTabs extends React.Component {
979
983
  const { activeTabKey, isBox } = this.state;
980
984
  return (
981
985
  <div>
982
- <Tabs isFilled activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox}>
986
+ <Tabs isFilled activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox} aria-label="Tabs in the filled example">
983
987
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>}>
984
988
  Users
985
989
  </Tab>
@@ -1040,7 +1044,7 @@ class FilledTabsWithIcons extends React.Component {
1040
1044
  const { activeTabKey, isBox } = this.state;
1041
1045
  return (
1042
1046
  <div>
1043
- <Tabs isFilled activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox}>
1047
+ <Tabs isFilled activeKey={activeTabKey} onSelect={this.handleTabClick} isBox={isBox} aria-label="Tabs in the filled with icons example">
1044
1048
  <Tab
1045
1049
  eventKey={0}
1046
1050
  title={
@@ -1125,6 +1129,7 @@ class TabsNav extends React.Component {
1125
1129
  onSelect={this.handleTabClick}
1126
1130
  aria-label="Local"
1127
1131
  component={TabsComponent.nav}
1132
+ aria-label="Tabs in the nav element example"
1128
1133
  >
1129
1134
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} href="#users">
1130
1135
  Users
@@ -1186,6 +1191,7 @@ class SecondaryTabsNav extends React.Component {
1186
1191
  onSelect={this.handleTabClickFirst}
1187
1192
  aria-label="Local"
1188
1193
  component={TabsComponent.nav}
1194
+ aria-label="Tabs in the sub tabs with nav element example"
1189
1195
  >
1190
1196
  <Tab eventKey={0} title={<TabTitleText>Users</TabTitleText>} href="#">
1191
1197
  <Tabs
@@ -1264,7 +1270,7 @@ class SeparateTabContent extends React.Component {
1264
1270
  render() {
1265
1271
  return (
1266
1272
  <React.Fragment>
1267
- <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}>
1273
+ <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} aria-label="Tabs in the seperate content example">
1268
1274
  <Tab
1269
1275
  eventKey={0}
1270
1276
  title={<TabTitleText>Tab item 1</TabTitleText>}
@@ -1285,13 +1291,13 @@ class SeparateTabContent extends React.Component {
1285
1291
  />
1286
1292
  </Tabs>
1287
1293
  <div>
1288
- <TabContent eventKey={0} id="refTab1Section" ref={this.contentRef1} aria-label="Tab item 1">
1294
+ <TabContent eventKey={0} id="refTab1Section" ref={this.contentRef1} aria-label="This is content for the first tab">
1289
1295
  Tab 1 section
1290
1296
  </TabContent>
1291
- <TabContent eventKey={1} id="refTab2Section" ref={this.contentRef2} aria-label="Tab item 2" hidden>
1297
+ <TabContent eventKey={1} id="refTab2Section" ref={this.contentRef2} aria-label="This is content for the second tab" hidden>
1292
1298
  Tab 2 section
1293
1299
  </TabContent>
1294
- <TabContent eventKey={2} id="refTab3Section" ref={this.contentRef3} aria-label="Tab item 3" hidden>
1300
+ <TabContent eventKey={2} id="refTab3Section" ref={this.contentRef3} aria-label="This is content for the third tab" hidden>
1295
1301
  Tab 3 section
1296
1302
  </TabContent>
1297
1303
  </div>
@@ -1321,7 +1327,7 @@ const TabContentWithBody = () => {
1321
1327
 
1322
1328
  return (
1323
1329
  <React.Fragment>
1324
- <Tabs activeKey={activeTabKey} onSelect={handleTabClick}>
1330
+ <Tabs activeKey={activeTabKey} onSelect={handleTabClick} aria-label="Tabs in the body and padding example">
1325
1331
  <Tab
1326
1332
  eventKey={0}
1327
1333
  title={<TabTitleText>Tab item 1</TabTitleText>}
@@ -1342,13 +1348,13 @@ const TabContentWithBody = () => {
1342
1348
  />
1343
1349
  </Tabs>
1344
1350
  <div>
1345
- <TabContent eventKey={0} id="refTab1Section" ref={contentRef1} aria-label="Tab item 1">
1351
+ <TabContent eventKey={0} id="refTab1Section" ref={contentRef1} aria-label="This is content for the first tab">
1346
1352
  <TabContentBody hasPadding> Tab 1 section </TabContentBody>
1347
1353
  </TabContent>
1348
- <TabContent eventKey={1} id="refTab2Section" ref={contentRef2} aria-label="Tab item 2" hidden>
1354
+ <TabContent eventKey={1} id="refTab2Section" ref={contentRef2} aria-label="This is content for the second tab" hidden>
1349
1355
  <TabContentBody hasPadding> Tab 2 section </TabContentBody>
1350
1356
  </TabContent>
1351
- <TabContent eventKey={2} id="refTab3Section" ref={contentRef3} aria-label="Tab item 3" hidden>
1357
+ <TabContent eventKey={2} id="refTab3Section" ref={contentRef3} aria-label="This is content for the third tab" hidden>
1352
1358
  <TabContentBody hasPadding> Tab 3 section </TabContentBody>
1353
1359
  </TabContent>
1354
1360
  </div>
@@ -1379,7 +1385,7 @@ class MountingSimpleTabs extends React.Component {
1379
1385
 
1380
1386
  render() {
1381
1387
  return (
1382
- <Tabs mountOnEnter activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}>
1388
+ <Tabs mountOnEnter activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} aria-label="Tabs in the children mounting on click example">
1383
1389
  <Tab eventKey={0} title={<TabTitleText>Tab item 1</TabTitleText>}>
1384
1390
  Tab 1 section
1385
1391
  </Tab>
@@ -1417,7 +1423,7 @@ class UnmountingSimpleTabs extends React.Component {
1417
1423
 
1418
1424
  render() {
1419
1425
  return (
1420
- <Tabs unmountOnExit activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}>
1426
+ <Tabs unmountOnExit activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} aria-label="Tabs in the unmounting invisible children example">
1421
1427
  <Tab eventKey={0} title={<TabTitleText>Tab item 1</TabTitleText>}>
1422
1428
  Tab 1 section
1423
1429
  </Tab>
@@ -1467,7 +1473,7 @@ class ToggledSeparateContent extends React.Component {
1467
1473
  {isTab2Hidden ? 'Show' : 'Hide'} tab 2
1468
1474
  </Button>
1469
1475
  <Divider style={{ paddingTop: '1rem', paddingBottom: '1rem' }} />
1470
- <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick}>
1476
+ <Tabs activeKey={this.state.activeTabKey} onSelect={this.handleTabClick} aria-label="Tabs in the toggled separate content example">
1471
1477
  <Tab eventKey={0} title="Tab item 1" tabContentId="refTab1Section" tabContentRef={this.contentRef1} />
1472
1478
  {!isTab2Hidden && (
1473
1479
  <Tab eventKey={1} title="Tab item 2" tabContentId="refTab2Section" tabContentRef={this.contentRef2} />
@@ -1475,15 +1481,15 @@ class ToggledSeparateContent extends React.Component {
1475
1481
  <Tab eventKey={2} title="Tab item 3" tabContentId="refTab3Section" tabContentRef={this.contentRef3} />
1476
1482
  </Tabs>
1477
1483
  <div>
1478
- <TabContent eventKey={0} id="refTab1Section" ref={this.contentRef1} aria-label="Tab item 1">
1484
+ <TabContent eventKey={0} id="refTab1Section" ref={this.contentRef1} aria-label="This is content for the first tab">
1479
1485
  Tab 1 section
1480
1486
  </TabContent>
1481
1487
  {!isTab2Hidden && (
1482
- <TabContent eventKey={1} id="refTab2Section" ref={this.contentRef2} aria-label="Tab item 2" hidden>
1488
+ <TabContent eventKey={1} id="refTab2Section" ref={this.contentRef2} aria-label="This is content for the second tab" hidden>
1483
1489
  Tab 2 section
1484
1490
  </TabContent>
1485
1491
  )}
1486
- <TabContent eventKey={2} id="refTab3Section" ref={this.contentRef3} aria-label="Tab item 3" hidden>
1492
+ <TabContent eventKey={2} id="refTab3Section" ref={this.contentRef3} aria-label="This is content for the third tab" hidden>
1487
1493
  Tab 3 section
1488
1494
  </TabContent>
1489
1495
  </div>
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import { mount, shallow } from 'enzyme';
4
- import { TextArea, TextAreaBase } from '../TextArea';
2
+
3
+ import { render, screen } from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
5
+ import '@testing-library/jest-dom';
6
+
7
+ import { TextArea, TextAreaBase } from '../TextArea';
5
8
  import { ValidatedOptions } from '../../../helpers/constants';
6
9
 
7
10
  const props = {
@@ -9,104 +12,96 @@ const props = {
9
12
  value: 'test textarea'
10
13
  };
11
14
 
12
- test('textarea input passes value and event to onChange handler', () => {
13
- const newValue = 'new test textarea';
14
- const event = {
15
- currentTarget: { value: newValue }
16
- };
17
- const view = shallow(<TextAreaBase {...props} aria-label="test textarea" />);
18
- view.find('textarea').simulate('change', event);
19
- expect(props.onChange).toBeCalledWith(newValue, event);
20
- });
21
-
22
- test('simple text input', () => {
23
- const view = render(<TextArea {...props} aria-label="simple textarea" />);
24
- expect(view.container).toMatchSnapshot();
25
- });
26
-
27
- test('disabled text input using isDisabled', () => {
28
- const view = render(<TextArea {...props} aria-label="is disabled textarea" isDisabled />);
29
- expect(view.container).toMatchSnapshot();
30
- });
31
-
32
- test('disabled text input using disabled', () => {
33
- const view = render(<TextArea {...props} aria-label="disabled textarea" disabled />);
34
- expect(view.container).toMatchSnapshot();
35
- });
36
-
37
- test('read only text input using isReadOnly', () => {
38
- const view = render(<TextArea {...props} aria-label="is read only textarea" isReadOnly />);
39
- expect(view.container).toMatchSnapshot();
40
- });
41
-
42
- test('read only text input using readOnly', () => {
43
- const view = render(<TextArea {...props} aria-label="read only textarea" readOnly />);
44
- expect(view.container).toMatchSnapshot();
45
- });
46
-
47
- test('invalid text area', () => {
48
- const view = render(<TextArea {...props} required validated={'error'} aria-label="invalid textarea" />);
49
- expect(view.container).toMatchSnapshot();
50
- });
51
-
52
- test('validated text area success', () => {
53
- const view = mount(
54
- <TextArea {...props} required validated={ValidatedOptions.success} aria-label="validated textarea" />
55
- );
56
- expect(view.find('.pf-c-form-control.pf-m-success').length).toBe(1);
57
- expect(view).toMatchSnapshot();
58
- });
59
-
60
- test('validated text area warning', () => {
61
- const view = mount(
62
- <TextArea {...props} required validated={ValidatedOptions.warning} aria-label="validated textarea" />
63
- );
64
- expect(view.find('.pf-c-form-control.pf-m-warning').length).toBe(1);
65
- expect(view).toMatchSnapshot();
66
- });
67
-
68
- test('validated text area error', () => {
69
- const view = render(
70
- <TextArea {...props} required validated={ValidatedOptions.error} aria-label="validated textarea" />
71
- );
72
- expect(view.container).toMatchSnapshot();
73
- });
74
-
75
- test('vertically resizable text area', () => {
76
- const view = render(<TextArea resizeOrientation="vertical" {...props} aria-label="vertical resize textarea" />);
77
- expect(view.container).toMatchSnapshot();
78
- });
79
-
80
- test('horizontally resizable text area', () => {
81
- const view = render(
82
- <TextArea
83
- resizeOrientation="horizontal"
84
- {...props}
85
- required
86
- validated={'error'}
87
- aria-label="horizontal resize textarea"
88
- />
89
- );
90
- expect(view.container).toMatchSnapshot();
91
- });
92
-
93
- test('should throw console error when no aria-label or id is given', () => {
94
- const myMock = jest.fn();
95
- global.console = { ...global.console, error: myMock };
96
- mount(<TextArea {...props} />);
97
- expect(myMock).toBeCalled();
98
- });
99
-
100
- test('should not throw console error when id is given but no aria-label', () => {
101
- const myMock = jest.fn();
102
- global.console = { ...global.console, error: myMock };
103
- mount(<TextArea {...props} id="5" />);
104
- expect(myMock).not.toBeCalled();
105
- });
106
-
107
- test('should not throw console error when aria-label is given but no id', () => {
108
- const myMock = jest.fn();
109
- global.console = { ...global.console, error: myMock };
110
- mount(<TextArea {...props} aria-label="test textarea" />);
111
- expect(myMock).not.toBeCalled();
15
+ describe('TextArea', () => {
16
+ test('textarea input passes value and event to onChange handler', () => {
17
+ render(<TextAreaBase {...props} value='' aria-label="test textarea" />);
18
+
19
+ userEvent.type(screen.getByLabelText('test textarea'), 'a');
20
+ expect(props.onChange).toHaveBeenCalledWith('a', expect.any(Object));
21
+ });
22
+
23
+ test('simple text input', () => {
24
+ const { asFragment } = render(<TextArea {...props} aria-label="simple textarea" />);
25
+ expect(asFragment()).toMatchSnapshot();
26
+ });
27
+
28
+ test('disabled text input using isDisabled', () => {
29
+ const { asFragment } = render(<TextArea {...props} aria-label="is disabled textarea" isDisabled />);
30
+ expect(asFragment()).toMatchSnapshot();
31
+ });
32
+
33
+ test('disabled text input using disabled', () => {
34
+ const { asFragment } = render(<TextArea {...props} aria-label="disabled textarea" disabled />);
35
+ expect(asFragment()).toMatchSnapshot();
36
+ });
37
+
38
+ test('read only text input using isReadOnly', () => {
39
+ const { asFragment } = render(<TextArea {...props} aria-label="is read only textarea" isReadOnly />);
40
+ expect(asFragment()).toMatchSnapshot();
41
+ });
42
+
43
+ test('read only text input using readOnly', () => {
44
+ const { asFragment } = render(<TextArea {...props} aria-label="read only textarea" readOnly />);
45
+ expect(asFragment()).toMatchSnapshot();
46
+ });
47
+
48
+ test('validated text area success', () => {
49
+ render(<TextArea {...props} required validated={ValidatedOptions.success} aria-label="validated textarea" />);
50
+ expect(screen.getByLabelText('validated textarea')).toHaveClass('pf-m-success');
51
+ });
52
+
53
+ test('validated text area warning', () => {
54
+ render(<TextArea {...props} required validated={ValidatedOptions.warning} aria-label="validated textarea" />);
55
+ expect(screen.getByLabelText('validated textarea')).toHaveClass('pf-m-warning');
56
+ });
57
+
58
+ test('validated text area error', () => {
59
+ const { asFragment } = render(<TextArea {...props} required validated={ValidatedOptions.error} aria-label="validated textarea" />);
60
+ expect(asFragment()).toMatchSnapshot();
61
+ });
62
+
63
+ test('vertically resizable text area', () => {
64
+ const { asFragment } = render(<TextArea resizeOrientation="vertical" {...props} aria-label="vertical resize textarea" />);
65
+ expect(asFragment()).toMatchSnapshot();
66
+ });
67
+
68
+ test('horizontally resizable text area', () => {
69
+ const { asFragment } = render(
70
+ <TextArea
71
+ resizeOrientation="horizontal"
72
+ {...props}
73
+ required
74
+ validated={'error'}
75
+ aria-label="horizontal resize textarea"
76
+ />
77
+ );
78
+ expect(asFragment()).toMatchSnapshot();
79
+ });
80
+
81
+ test('should throw console error when no aria-label or id is given', () => {
82
+ const myMock = jest.fn();
83
+ global.console = { ...global.console, error: myMock };
84
+
85
+ render(<TextArea {...props} />);
86
+
87
+ expect(myMock).toBeCalled();
88
+ });
89
+
90
+ test('should not throw console error when id is given but no aria-label', () => {
91
+ const myMock = jest.fn();
92
+ global.console = { ...global.console, error: myMock };
93
+
94
+ render(<TextArea {...props} id="5" />);
95
+
96
+ expect(myMock).not.toBeCalled();
97
+ });
98
+
99
+ test('should not throw console error when aria-label is given but no id', () => {
100
+ const myMock = jest.fn();
101
+ global.console = { ...global.console, error: myMock };
102
+
103
+ render(<TextArea {...props} aria-label="test textarea" />);
104
+
105
+ expect(myMock).not.toBeCalled();
106
+ });
112
107
  });
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`disabled text input using disabled 1`] = `
4
- <div>
3
+ exports[`TextArea disabled text input using disabled 1`] = `
4
+ <DocumentFragment>
5
5
  <textarea
6
6
  aria-invalid="false"
7
7
  aria-label="disabled textarea"
@@ -10,11 +10,11 @@ exports[`disabled text input using disabled 1`] = `
10
10
  >
11
11
  test textarea
12
12
  </textarea>
13
- </div>
13
+ </DocumentFragment>
14
14
  `;
15
15
 
16
- exports[`disabled text input using isDisabled 1`] = `
17
- <div>
16
+ exports[`TextArea disabled text input using isDisabled 1`] = `
17
+ <DocumentFragment>
18
18
  <textarea
19
19
  aria-invalid="false"
20
20
  aria-label="is disabled textarea"
@@ -23,11 +23,11 @@ exports[`disabled text input using isDisabled 1`] = `
23
23
  >
24
24
  test textarea
25
25
  </textarea>
26
- </div>
26
+ </DocumentFragment>
27
27
  `;
28
28
 
29
- exports[`horizontally resizable text area 1`] = `
30
- <div>
29
+ exports[`TextArea horizontally resizable text area 1`] = `
30
+ <DocumentFragment>
31
31
  <textarea
32
32
  aria-invalid="true"
33
33
  aria-label="horizontal resize textarea"
@@ -36,24 +36,11 @@ exports[`horizontally resizable text area 1`] = `
36
36
  >
37
37
  test textarea
38
38
  </textarea>
39
- </div>
39
+ </DocumentFragment>
40
40
  `;
41
41
 
42
- exports[`invalid text area 1`] = `
43
- <div>
44
- <textarea
45
- aria-invalid="true"
46
- aria-label="invalid textarea"
47
- class="pf-c-form-control"
48
- required=""
49
- >
50
- test textarea
51
- </textarea>
52
- </div>
53
- `;
54
-
55
- exports[`read only text input using isReadOnly 1`] = `
56
- <div>
42
+ exports[`TextArea read only text input using isReadOnly 1`] = `
43
+ <DocumentFragment>
57
44
  <textarea
58
45
  aria-invalid="false"
59
46
  aria-label="is read only textarea"
@@ -62,11 +49,11 @@ exports[`read only text input using isReadOnly 1`] = `
62
49
  >
63
50
  test textarea
64
51
  </textarea>
65
- </div>
52
+ </DocumentFragment>
66
53
  `;
67
54
 
68
- exports[`read only text input using readOnly 1`] = `
69
- <div>
55
+ exports[`TextArea read only text input using readOnly 1`] = `
56
+ <DocumentFragment>
70
57
  <textarea
71
58
  aria-invalid="false"
72
59
  aria-label="read only textarea"
@@ -75,11 +62,11 @@ exports[`read only text input using readOnly 1`] = `
75
62
  >
76
63
  test textarea
77
64
  </textarea>
78
- </div>
65
+ </DocumentFragment>
79
66
  `;
80
67
 
81
- exports[`simple text input 1`] = `
82
- <div>
68
+ exports[`TextArea simple text input 1`] = `
69
+ <DocumentFragment>
83
70
  <textarea
84
71
  aria-invalid="false"
85
72
  aria-label="simple textarea"
@@ -87,11 +74,11 @@ exports[`simple text input 1`] = `
87
74
  >
88
75
  test textarea
89
76
  </textarea>
90
- </div>
77
+ </DocumentFragment>
91
78
  `;
92
79
 
93
- exports[`validated text area error 1`] = `
94
- <div>
80
+ exports[`TextArea validated text area error 1`] = `
81
+ <DocumentFragment>
95
82
  <textarea
96
83
  aria-invalid="true"
97
84
  aria-label="validated textarea"
@@ -100,77 +87,11 @@ exports[`validated text area error 1`] = `
100
87
  >
101
88
  test textarea
102
89
  </textarea>
103
- </div>
104
- `;
105
-
106
- exports[`validated text area success 1`] = `
107
- <TextArea
108
- aria-label="validated textarea"
109
- onChange={[MockFunction]}
110
- required={true}
111
- validated="success"
112
- value="test textarea"
113
- >
114
- <TextArea
115
- aria-label="validated textarea"
116
- className=""
117
- innerRef={null}
118
- isDisabled={false}
119
- isIconSprite={false}
120
- isRequired={false}
121
- onChange={[MockFunction]}
122
- required={true}
123
- resizeOrientation="both"
124
- validated="success"
125
- value="test textarea"
126
- >
127
- <textarea
128
- aria-invalid={false}
129
- aria-label="validated textarea"
130
- className="pf-c-form-control pf-m-success"
131
- onChange={[Function]}
132
- required={true}
133
- value="test textarea"
134
- />
135
- </TextArea>
136
- </TextArea>
137
- `;
138
-
139
- exports[`validated text area warning 1`] = `
140
- <TextArea
141
- aria-label="validated textarea"
142
- onChange={[MockFunction]}
143
- required={true}
144
- validated="warning"
145
- value="test textarea"
146
- >
147
- <TextArea
148
- aria-label="validated textarea"
149
- className=""
150
- innerRef={null}
151
- isDisabled={false}
152
- isIconSprite={false}
153
- isRequired={false}
154
- onChange={[MockFunction]}
155
- required={true}
156
- resizeOrientation="both"
157
- validated="warning"
158
- value="test textarea"
159
- >
160
- <textarea
161
- aria-invalid={false}
162
- aria-label="validated textarea"
163
- className="pf-c-form-control pf-m-warning"
164
- onChange={[Function]}
165
- required={true}
166
- value="test textarea"
167
- />
168
- </TextArea>
169
- </TextArea>
90
+ </DocumentFragment>
170
91
  `;
171
92
 
172
- exports[`vertically resizable text area 1`] = `
173
- <div>
93
+ exports[`TextArea vertically resizable text area 1`] = `
94
+ <DocumentFragment>
174
95
  <textarea
175
96
  aria-invalid="false"
176
97
  aria-label="vertical resize textarea"
@@ -178,5 +99,5 @@ exports[`vertically resizable text area 1`] = `
178
99
  >
179
100
  test textarea
180
101
  </textarea>
181
- </div>
102
+ </DocumentFragment>
182
103
  `;