@@ -30,13 +30,13 @@ describe('Tabs', function() {
30
30
expect ( Tabs ) . toBeDefined ( ) ;
31
31
} ) ;
32
32
33
- it ( 'should throw if no children pannels passed to Tabs' , function ( ) {
33
+ it ( 'should throw if no children panels passed to Tabs' , function ( ) {
34
34
expect ( function ( ) {
35
35
TU . renderIntoDocument ( < Tabs > </ Tabs > ) ;
36
36
} ) . throws ;
37
37
} ) ;
38
38
39
- it ( 'be renderable if pannels passed to tabs' , function ( ) {
39
+ it ( 'be renderable if panels passed to tabs' , function ( ) {
40
40
var instance = TU . renderIntoDocument (
41
41
< Tabs > < Tabs . Panel > </ Tabs . Panel > </ Tabs >
42
42
) ;
@@ -52,8 +52,45 @@ describe('Tabs', function() {
52
52
expect ( ! ! usedPropsAreInPropTypes ( instance ) ) . toBe ( true ) ;
53
53
} ) ;
54
54
55
+ describe ( 'when passed className as props' , function ( ) {
56
+ it ( 'should render extra className correctly' , function ( ) {
57
+ var instance = TU . renderIntoDocument (
58
+ < Tabs className = "extra-class" > < Tabs . Panel > </ Tabs . Panel > </ Tabs >
59
+ ) ;
60
+
61
+ expect ( function ( ) {
62
+ TU . findRenderedDOMComponentWithClass ( instance , 'tabs extra-class' ) ;
63
+ } ) . not . toThrow ( ) ;
64
+ } ) ;
65
+
66
+ it ( 'should render className as object correctly' , function ( ) {
67
+ var instance = TU . renderIntoDocument (
68
+ < Tabs className = { { tabs2 : true } } > < Tabs . Panel > </ Tabs . Panel > </ Tabs >
69
+ ) ;
70
+
71
+ expect ( function ( ) {
72
+ TU . findRenderedDOMComponentWithClass ( instance , 'tabs3' ) ;
73
+ } ) . toThrow ( ) ;
74
+
75
+ expect ( function ( ) {
76
+ TU . findRenderedDOMComponentWithClass ( instance , 'tabs tabs2' ) ;
77
+ } ) . not . toThrow ( ) ;
78
+ } ) ;
79
+
80
+ it ( 'should render className as array correctly' , function ( ) {
81
+ var instance = TU . renderIntoDocument (
82
+ < Tabs className = { [ 'extra-class' ] } > < Tabs . Panel > </ Tabs . Panel > </ Tabs >
83
+ ) ;
84
+
85
+ expect ( function ( ) {
86
+ TU . findRenderedDOMComponentWithClass ( instance , 'tabs extra-class' ) ;
87
+ } ) . not . toThrow ( ) ;
88
+
89
+ } ) ;
90
+ } ) ;
91
+
55
92
describe ( 'regarding its functionality,' , function ( ) {
56
- it ( 'show only one pannel at a time, multiple tabs' , function ( ) {
93
+ it ( 'show only one panel at a time, multiple tabs' , function ( ) {
57
94
var instance = TU . renderIntoDocument (
58
95
< Tabs >
59
96
< Tabs . Panel > < h1 > 1</ h1 > </ Tabs . Panel >
@@ -64,10 +101,10 @@ describe('Tabs', function() {
64
101
expect ( TU . scryRenderedDOMComponentsWithTag ( instance , 'li' ) . length ) . toEqual ( 2 ) ;
65
102
expect ( function ( ) {
66
103
TU . findRenderedDOMComponentWithClass ( instance , 'is-active' ) ;
67
- } ) . not . toThrow ;
104
+ } ) . not . toThrow ( ) ;
68
105
} ) ;
69
106
70
- it ( 'show the first pannel if no active passed' , function ( ) {
107
+ it ( 'show the first panel if no active passed' , function ( ) {
71
108
var instance = TU . renderIntoDocument (
72
109
< Tabs >
73
110
< Tabs . Panel title = 'item1' > content1</ Tabs . Panel >
@@ -76,13 +113,13 @@ describe('Tabs', function() {
76
113
) ;
77
114
78
115
var menuItem = TU . findRenderedDOMComponentWithClass ( instance , 'tabs-menu-item is-active' ) ;
79
- var pannel = TU . findRenderedDOMComponentWithClass ( instance , 'tab-panel' ) ;
116
+ var panel = TU . findRenderedDOMComponentWithClass ( instance , 'tab-panel' ) ;
80
117
81
- expect ( pannel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content1' ) ;
118
+ expect ( panel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content1' ) ;
82
119
expect ( menuItem . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'item1' ) ;
83
120
} ) ;
84
121
85
- it ( 'show the second pannel if tabActive == 2' , function ( ) {
122
+ it ( 'show the second panel if tabActive == 2' , function ( ) {
86
123
var instance = TU . renderIntoDocument (
87
124
< Tabs tabActive = { 2 } >
88
125
< Tabs . Panel title = 'item1' > content1</ Tabs . Panel >
@@ -91,9 +128,9 @@ describe('Tabs', function() {
91
128
) ;
92
129
93
130
var menuItem = TU . findRenderedDOMComponentWithClass ( instance , 'tabs-menu-item is-active' ) ;
94
- var pannel = TU . findRenderedDOMComponentWithClass ( instance , 'tab-panel' ) ;
131
+ var panel = TU . findRenderedDOMComponentWithClass ( instance , 'tab-panel' ) ;
95
132
96
- expect ( pannel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content2' ) ;
133
+ expect ( panel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content2' ) ;
97
134
expect ( menuItem . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'item2' ) ;
98
135
} ) ;
99
136
@@ -106,8 +143,8 @@ describe('Tabs', function() {
106
143
</ Tabs > , document . body
107
144
) ;
108
145
var menuItem = find ( instance , 'tabs-menu-item is-active' ) ;
109
- var pannel = find ( instance , 'tab-panel' ) ;
110
- expect ( pannel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content2' ) ;
146
+ var panel = find ( instance , 'tab-panel' ) ;
147
+ expect ( panel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content2' ) ;
111
148
expect ( menuItem . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'item2' ) ;
112
149
instance = React . render (
113
150
< Tabs tabActive = { 1 } >
@@ -116,8 +153,8 @@ describe('Tabs', function() {
116
153
</ Tabs > , document . body
117
154
) ;
118
155
menuItem = find ( instance , 'tabs-menu-item is-active' ) ;
119
- pannel = find ( instance , 'tab-panel' ) ;
120
- expect ( pannel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content1' ) ;
156
+ panel = find ( instance , 'tab-panel' ) ;
157
+ expect ( panel . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'content1' ) ;
121
158
expect ( menuItem . getDOMNode ( ) . children [ 0 ] . innerHTML ) . toEqual ( 'item1' ) ;
122
159
} ) ;
123
160
} ) ;
0 commit comments