File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
4
4
export default function withContext ( Checkbox ) {
5
5
return class WrappedComp extends React . Component {
6
+ static displayName = 'Checkbox' ;
6
7
static contextTypes = {
7
8
onChange : PropTypes . func ,
8
9
__group__ : PropTypes . bool ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
4
4
export default function withContext ( Radio ) {
5
5
return class WrappedComp extends React . Component {
6
+ static displayName = 'Radio' ;
6
7
static contextTypes = {
7
8
onChange : PropTypes . func ,
8
9
__group__ : PropTypes . bool ,
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import assert from 'power-assert';
6
6
import Input from '../../src/input' ;
7
7
import Field from '../../src/field' ;
8
8
import Select from '../../src/select' ;
9
+ import Radio from '../../src/radio' ;
10
+ import Checkbox from '../../src/checkbox' ;
9
11
import Form from '../../src/form/index' ;
10
12
11
13
const FormItem = Form . Item ;
@@ -312,6 +314,26 @@ describe('form', () => {
312
314
) ;
313
315
assert ( saveRef . calledOnce ) ;
314
316
} ) ;
317
+
318
+ it ( 'should supoort defaultvalue' , ( ) => {
319
+ const value = {
320
+ 'checkbox-1' :true ,
321
+ 'radio-1' : true ,
322
+ } ;
323
+ const wrapper = mount (
324
+ < Form value = { value } >
325
+ < FormItem label = "不支持购物车下单:" >
326
+ < Checkbox name = "checkbox-1" > (商品标签[6658])</ Checkbox >
327
+ </ FormItem >
328
+ < FormItem label = "不支持购物车下单:" >
329
+ < Radio name = "radio-1" > (商品标签[6658])</ Radio >
330
+ </ FormItem >
331
+ </ Form >
332
+ ) ;
333
+ assert ( wrapper . find ( 'input#checkbox-1' ) . props ( ) . checked ) ;
334
+ assert ( wrapper . find ( 'input#radio-1' ) . props ( ) . checked ) ;
335
+ } ) ;
336
+
315
337
it ( 'should supoort function children' , ( ) => {
316
338
const wrapper = mount (
317
339
< Form >
You can’t perform that action at this time.
0 commit comments