File tree Expand file tree Collapse file tree 3 files changed +80
-4
lines changed Expand file tree Collapse file tree 3 files changed +80
-4
lines changed Original file line number Diff line number Diff line change @@ -485,7 +485,7 @@ describe('<Tabs />', () => {
485
485
assertTabSelected ( wrapper , 2 ) ;
486
486
} ) ;
487
487
488
- it ( 'should allow for higher order components' , ( ) => {
488
+ test ( 'should allow for higher order components' , ( ) => {
489
489
expectToMatchSnapshot (
490
490
< Tabs >
491
491
< TabListWrapper >
@@ -497,4 +497,22 @@ describe('<Tabs />', () => {
497
497
</ Tabs > ,
498
498
) ;
499
499
} ) ;
500
+
501
+ test ( 'should allow string children' , ( ) => {
502
+ expectToMatchSnapshot (
503
+ < Tabs >
504
+ Foo
505
+ < TabList >
506
+ Foo
507
+ < Tab > Foo</ Tab >
508
+ Foo
509
+ < Tab > Bar</ Tab >
510
+ Foo
511
+ </ TabList >
512
+ < TabPanel > Bar</ TabPanel >
513
+ < TabPanel > Foo</ TabPanel >
514
+ Foo
515
+ </ Tabs > ,
516
+ ) ;
517
+ } ) ;
500
518
} ) ;
Original file line number Diff line number Diff line change @@ -694,6 +694,64 @@ exports[`<Tabs /> should allow for higher order components 1`] = `
694
694
</div >
695
695
` ;
696
696
697
+ exports [` <Tabs /> should allow string children 1` ] = `
698
+ <div
699
+ className = " react-tabs"
700
+ data-tabs = { true }
701
+ onClick = { [Function ]}
702
+ onKeyDown = { [Function ]}
703
+ >
704
+ Foo
705
+ <ul
706
+ className = " react-tabs__tab-list"
707
+ role = " tablist"
708
+ >
709
+ Foo
710
+ <li
711
+ aria-controls = " react-tabs-1"
712
+ aria-disabled = " false"
713
+ aria-selected = " true"
714
+ className = " react-tabs__tab react-tabs__tab--selected"
715
+ id = " react-tabs-0"
716
+ role = " tab"
717
+ tabIndex = " 0"
718
+ >
719
+ Foo
720
+ </li >
721
+ Foo
722
+ <li
723
+ aria-controls = " react-tabs-3"
724
+ aria-disabled = " false"
725
+ aria-selected = " false"
726
+ className = " react-tabs__tab"
727
+ id = " react-tabs-2"
728
+ role = " tab"
729
+ tabIndex = { null }
730
+ >
731
+ Bar
732
+ </li >
733
+ Foo
734
+ </ul >
735
+ <div
736
+ aria-labelledby = " react-tabs-0"
737
+ className = " react-tabs__tab-panel react-tabs__tab-panel--selected"
738
+ id = " react-tabs-1"
739
+ role = " tabpanel"
740
+ style = { Object {}}
741
+ >
742
+ Bar
743
+ </div >
744
+ <div
745
+ aria-labelledby = " react-tabs-2"
746
+ className = " react-tabs__tab-panel"
747
+ id = " react-tabs-3"
748
+ role = " tabpanel"
749
+ style = { Object {}}
750
+ />
751
+ Foo
752
+ </div >
753
+ ` ;
754
+
697
755
exports [` <Tabs /> should not add known props to dom 1` ] = `
698
756
<div
699
757
className = " react-tabs"
Original file line number Diff line number Diff line change 1
1
export function isTab ( el ) {
2
- return el . type . tabsRole === 'Tab' ;
2
+ return el . type && el . type . tabsRole === 'Tab' ;
3
3
}
4
4
5
5
export function isTabPanel ( el ) {
6
- return el . type . tabsRole === 'TabPanel' ;
6
+ return el . type && el . type . tabsRole === 'TabPanel' ;
7
7
}
8
8
9
9
export function isTabList ( el ) {
10
- return el . type . tabsRole === 'TabList' ;
10
+ return el . type && el . type . tabsRole === 'TabList' ;
11
11
}
You can’t perform that action at this time.
0 commit comments