File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
packages/common/src/test/select Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { parseInternalValue } from '../../select' ;
2
+
3
+ describe ( 'parseInternalValue' , ( ) => {
4
+ let value ;
5
+ let isMulti ;
6
+
7
+ it ( 'single' , ( ) => {
8
+ value = 'cats' ;
9
+ isMulti = undefined ;
10
+ expect ( parseInternalValue ( value , isMulti ) ) . toEqual ( 'cats' ) ;
11
+ } ) ;
12
+
13
+ it ( 'multi and array' , ( ) => {
14
+ value = [ 'cats' , { value : 'dogs' } ] ;
15
+ isMulti = true ;
16
+ expect ( parseInternalValue ( value , isMulti ) ) . toEqual ( [ 'cats' , 'dogs' ] ) ;
17
+ } ) ;
18
+
19
+ it ( 'single and array' , ( ) => {
20
+ value = [ 'cats' , { value : 'dogs' } ] ;
21
+ isMulti = false ;
22
+ expect ( parseInternalValue ( value , isMulti ) ) . toEqual ( 'cats' ) ;
23
+ } ) ;
24
+
25
+ it ( 'single and array - object' , ( ) => {
26
+ value = [ { value : 'dogs' } ] ;
27
+ isMulti = false ;
28
+ expect ( parseInternalValue ( value , isMulti ) ) . toEqual ( 'dogs' ) ;
29
+ } ) ;
30
+
31
+ it ( 'single and undefined' , ( ) => {
32
+ value = [ ] ;
33
+ isMulti = false ;
34
+ expect ( parseInternalValue ( value , isMulti ) ) . toEqual ( undefined ) ;
35
+ } ) ;
36
+ } ) ;
You can’t perform that action at this time.
0 commit comments