@@ -4,7 +4,7 @@ import { createShallow, createMount, getClasses } from '../test-utils';
4
4
import Checkbox from '../Checkbox' ;
5
5
import FormControlLabel from './FormControlLabel' ;
6
6
7
- describe ( 'FormControlLabel' , ( ) => {
7
+ describe ( '< FormControlLabel /> ' , ( ) => {
8
8
let shallow ;
9
9
let mount ;
10
10
let classes ;
@@ -28,7 +28,7 @@ describe('FormControlLabel', () => {
28
28
} ) ;
29
29
30
30
describe ( 'prop: disabled' , ( ) => {
31
- it ( 'should disable everything' , ( ) => {
31
+ it ( 'should disable everything 1 ' , ( ) => {
32
32
const wrapper = shallow ( < FormControlLabel label = "Pizza" disabled control = { < div /> } /> ) ;
33
33
const label = wrapper . childAt ( 1 ) ;
34
34
assert . strictEqual (
@@ -41,7 +41,7 @@ describe('FormControlLabel', () => {
41
41
assert . strictEqual ( label . hasClass ( classes . disabled ) , true ) ;
42
42
} ) ;
43
43
44
- it ( 'should disable everything' , ( ) => {
44
+ it ( 'should disable everything 2 ' , ( ) => {
45
45
const wrapper = shallow ( < FormControlLabel label = "Pizza" control = { < div disabled /> } /> ) ;
46
46
const label = wrapper . childAt ( 1 ) ;
47
47
assert . strictEqual (
@@ -105,4 +105,16 @@ describe('FormControlLabel', () => {
105
105
} ) ;
106
106
} ) ;
107
107
} ) ;
108
+
109
+ it ( 'should not inject extra properties' , ( ) => {
110
+ // eslint-disable-next-line react/prop-types
111
+ const Control = ( { inputRef, ...props } ) => < div name = "name" { ...props } /> ;
112
+ const wrapper = mount ( < FormControlLabel label = "Pizza" control = { < Control /> } /> ) ;
113
+ assert . strictEqual ( wrapper . find ( 'div' ) . props ( ) . name , 'name' ) ;
114
+ } ) ;
115
+
116
+ it ( 'should forward some properties' , ( ) => {
117
+ const wrapper = mount ( < FormControlLabel value = "value" label = "Pizza" control = { < div /> } /> ) ;
118
+ assert . strictEqual ( wrapper . find ( 'div' ) . props ( ) . value , 'value' ) ;
119
+ } ) ;
108
120
} ) ;
0 commit comments