File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ const Item = ({
2828 >
2929 { ! group && (
3030 < Checkbox
31+ id = { item . id ? `checkbox-${ item . id } ` : null }
3132 type = "checkbox"
3233 color = "primary"
3334 checked = { checked }
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ exports[`Item default snapshot 1`] = `
1414 checked={ false }
1515 color="primary"
1616 disabled={ false }
17+ id={ null }
1718 indeterminate={ false }
1819 type="checkbox"
1920 />
@@ -37,6 +38,7 @@ exports[`Item snapshot with border 1`] = `
3738 checked={ false }
3839 color="primary"
3940 disabled={ false }
41+ id={ null }
4042 indeterminate={ false }
4143 type="checkbox"
4244 />
@@ -60,6 +62,7 @@ exports[`Item snapshot with checked status 1`] = `
6062 checked={ true }
6163 color="primary"
6264 disabled={ false }
65+ id={ null }
6366 indeterminate={ false }
6467 type="checkbox"
6568 />
@@ -83,6 +86,7 @@ exports[`Item snapshot with disabled 1`] = `
8386 checked={ false }
8487 color="primary"
8588 disabled={ true }
89+ id={ null }
8690 indeterminate={ false }
8791 type="checkbox"
8892 />
@@ -122,6 +126,7 @@ exports[`Item snapshot with height 1`] = `
122126 checked={ false }
123127 color="primary"
124128 disabled={ false }
129+ id={ null }
125130 indeterminate={ false }
126131 type="checkbox"
127132 />
@@ -145,6 +150,7 @@ exports[`Item snapshot with indeterminate and checked status 1`] = `
145150 checked={ true }
146151 color="primary"
147152 disabled={ false }
153+ id={ null }
148154 indeterminate={ true }
149155 type="checkbox"
150156 />
@@ -168,6 +174,7 @@ exports[`Item snapshot with indeterminate status 1`] = `
168174 checked={ false }
169175 color="primary"
170176 disabled={ false }
177+ id={ null }
171178 indeterminate={ true }
172179 type="checkbox"
173180 />
@@ -177,6 +184,30 @@ exports[`Item snapshot with indeterminate status 1`] = `
177184</div >
178185` ;
179186
187+ exports [` Item snapshot with item without id 1` ] = `
188+ <div
189+ className = " item"
190+ onClick = { undefined }
191+ style = {
192+ Object {
193+ " height" : 40 ,
194+ }
195+ }
196+ >
197+ <WithStyles(Checkbox)
198+ checked={ false }
199+ color="primary"
200+ disabled={ false }
201+ id={ null }
202+ indeterminate={ false }
203+ type="checkbox"
204+ />
205+ <ItemLabel
206+ label = " Hi"
207+ />
208+ </div >
209+ ` ;
210+
180211exports [` Item snapshot with valid item 1` ] = `
181212<div
182213 className = " item"
@@ -191,6 +222,7 @@ exports[`Item snapshot with valid item 1`] = `
191222 checked={ false }
192223 color="primary"
193224 disabled={ false }
225+ id="checkbox-1"
194226 indeterminate={ false }
195227 type="checkbox"
196228 />
Original file line number Diff line number Diff line change @@ -19,6 +19,14 @@ describe("Item", () => {
1919 expect ( tree ) . toMatchSnapshot ( ) ;
2020 } ) ;
2121
22+ test ( "snapshot with item without id" , ( ) => {
23+ const itemWithoutId = { label : "Hi" } ;
24+
25+ const renderer = new ShallowRenderer ( ) ;
26+ const tree = renderer . render ( < Item item = { itemWithoutId } /> ) ;
27+ expect ( tree ) . toMatchSnapshot ( ) ;
28+ } ) ;
29+
2230 test ( "snapshot with checked status" , ( ) => {
2331 const renderer = new ShallowRenderer ( ) ;
2432 const tree = renderer . render ( < Item checked = { true } /> ) ;
You can’t perform that action at this time.
0 commit comments