@@ -70,4 +70,35 @@ describe('Toggle', () => {
70
70
expect ( '.toggle-switch' ) . toBeChecked ( ) ;
71
71
} ) ;
72
72
} ) ;
73
+
74
+ describe ( 'size attribute' , function ( ) {
75
+ beforeEach ( function ( ) {
76
+ ReactDOM . unmountComponentAtNode ( root ) ;
77
+ } ) ;
78
+
79
+ it ( 'renders with size=medium by default' , function ( ) {
80
+ ReactDOM . render ( < Toggle id = 'boggle' /> , root ) ;
81
+ expect ( $ ( 'label' ) . attr ( 'class' ) ) . toContain ( 'medium' ) ;
82
+ } ) ;
83
+
84
+ it ( 'uses size=small class on label' , function ( ) {
85
+ ReactDOM . render ( < Toggle id = 'boggle' size = 'small' /> , root ) ;
86
+ expect ( $ ( 'label' ) . attr ( 'class' ) ) . toContain ( 'small' ) ;
87
+ } ) ;
88
+
89
+ it ( 'uses size=medium class on label' , function ( ) {
90
+ ReactDOM . render ( < Toggle id = 'boggle' size = 'medium' /> , root ) ;
91
+ expect ( $ ( 'label' ) . attr ( 'class' ) ) . toContain ( 'medium' ) ;
92
+ } ) ;
93
+
94
+ it ( 'uses size=large class on label' , function ( ) {
95
+ ReactDOM . render ( < Toggle id = 'boggle' size = 'large' /> , root ) ;
96
+ expect ( $ ( 'label' ) . attr ( 'class' ) ) . toContain ( 'large' ) ;
97
+ } ) ;
98
+
99
+ it ( 'defaults to medium when size=some-random-string' , function ( ) {
100
+ ReactDOM . render ( < Toggle id = 'boggle' size = 'some-random-string' /> , root ) ;
101
+ expect ( $ ( 'label' ) . attr ( 'class' ) ) . toContain ( 'medium' ) ;
102
+ } ) ;
103
+ } ) ;
73
104
} ) ;
0 commit comments