@@ -38,6 +38,7 @@ import {
3838 AssetSelector ,
3939 AddressInput ,
4040 AccountSelector ,
41+ DateTimePicker ,
4142} from './components' ;
4243import {
4344 AddressStruct ,
@@ -80,6 +81,7 @@ import {
8081 AssetSelectorStruct ,
8182 AddressInputStruct ,
8283 AccountSelectorStruct ,
84+ DateTimePickerStruct ,
8385} from './validation' ;
8486
8587describe ( 'KeyStruct' , ( ) => {
@@ -381,6 +383,9 @@ describe('FieldStruct', () => {
381383 < Field label = "foo" >
382384 < AccountSelector name = "account" />
383385 </ Field > ,
386+ < Field label = "foo" >
387+ < DateTimePicker name = "foo" />
388+ </ Field > ,
384389 ] ) ( 'validates a field element' , ( value ) => {
385390 expect ( is ( value , FieldStruct ) ) . toBe ( true ) ;
386391 } ) ;
@@ -1008,6 +1013,54 @@ describe('CopyableStruct', () => {
10081013 } ) ;
10091014} ) ;
10101015
1016+ describe ( 'DateTimePickerStruct' , ( ) => {
1017+ it . each ( [
1018+ < DateTimePicker name = "foo" /> ,
1019+ < DateTimePicker name = "foo" type = "datetime" /> ,
1020+ < DateTimePicker name = "foo" type = "date" /> ,
1021+ < DateTimePicker name = "foo" type = "time" /> ,
1022+ < DateTimePicker name = "foo" value = { new Date ( ) . toISOString ( ) } /> ,
1023+ < DateTimePicker name = "foo" disabled = { true } /> ,
1024+ < DateTimePicker
1025+ name = "foo"
1026+ value = { new Date ( ) . toISOString ( ) }
1027+ placeholder = "foobar"
1028+ type = "datetime"
1029+ disabled = { true }
1030+ /> ,
1031+ ] ) ( 'validates a date time picker element' , ( value ) => {
1032+ expect ( is ( value , DateTimePickerStruct ) ) . toBe ( true ) ;
1033+ } ) ;
1034+
1035+ it . each ( [
1036+ 'foo' ,
1037+ 42 ,
1038+ null ,
1039+ undefined ,
1040+ { } ,
1041+ [ ] ,
1042+ // @ts -expect-error - Invalid props.
1043+ < DateTimePicker /> ,
1044+ // @ts -expect-error - Invalid props.
1045+ < DateTimePicker name = { 42 } /> ,
1046+ // @ts -expect-error - Invalid props.
1047+ < DateTimePicker name = "foo" type = "foo" /> ,
1048+ // @ts -expect-error - Invalid props.
1049+ < DateTimePicker name = "foo" value = { 42 } /> ,
1050+ // @ts -expect-error - Invalid props.
1051+ < DateTimePicker name = "foo" placeholder = { 32 } /> ,
1052+ < Text > foo</ Text > ,
1053+ < Box >
1054+ < Text > foo</ Text >
1055+ </ Box > ,
1056+ < Row label = "label" >
1057+ < Image src = "src" alt = "alt" />
1058+ </ Row > ,
1059+ ] ) ( 'does not validate "%p"' , ( value ) => {
1060+ expect ( is ( value , DateTimePickerStruct ) ) . toBe ( false ) ;
1061+ } ) ;
1062+ } ) ;
1063+
10111064describe ( 'DividerStruct' , ( ) => {
10121065 it . each ( [ < Divider /> ] ) ( 'validates a divider element' , ( value ) => {
10131066 expect ( is ( value , DividerStruct ) ) . toBe ( true ) ;
0 commit comments