@@ -593,4 +593,37 @@ describe('Text cell', () => {
593
593
expect ( input . maxLength ) . toBe ( defaultMaxLength ) ;
594
594
expect ( input . size ) . toBe ( defaultSize ) ;
595
595
} ) ;
596
+
597
+ test ( 'default type is text' , ( ) => {
598
+ const uischema : ControlElement = {
599
+ type : 'Control' ,
600
+ scope : '#/properties/name' ,
601
+ } ;
602
+ const core = initCore ( fixture . schema , uischema , fixture . data ) ;
603
+ wrapper = mount (
604
+ < JsonFormsStateProvider initState = { { core } } >
605
+ < TextCell schema = { fixture . schema } uischema = { uischema } path = 'name' />
606
+ </ JsonFormsStateProvider >
607
+ ) ;
608
+ const input = wrapper . find ( 'input' ) . getDOMNode ( ) as HTMLInputElement ;
609
+ expect ( input . type ) . toBe ( 'text' ) ;
610
+ } ) ;
611
+
612
+ test ( 'change type to password' , ( ) => {
613
+ const uischema : ControlElement = {
614
+ type : 'Control' ,
615
+ scope : '#/properties/name' ,
616
+ options : {
617
+ format : 'password' ,
618
+ } ,
619
+ } ;
620
+ const core = initCore ( fixture . schema , uischema , fixture . data ) ;
621
+ wrapper = mount (
622
+ < JsonFormsStateProvider initState = { { core } } >
623
+ < TextCell schema = { fixture . schema } uischema = { uischema } path = 'name' />
624
+ </ JsonFormsStateProvider >
625
+ ) ;
626
+ const input = wrapper . find ( 'input' ) . getDOMNode ( ) as HTMLInputElement ;
627
+ expect ( input . type ) . toBe ( 'password' ) ;
628
+ } ) ;
596
629
} ) ;
0 commit comments