File tree Expand file tree Collapse file tree 2 files changed +58
-1
lines changed Expand file tree Collapse file tree 2 files changed +58
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,54 @@ describe('Test .applyFilter()', () => {
5353 dialog . applyFilter ( ) ;
5454 expect ( mock ) . toBeCalledWith ( transform ) ;
5555 } ) ;
56+ test ( 'condition transform is added' , ( ) => {
57+ const dialog = Private . createSimpleDialog ( ) ;
58+ const colIndex = 0 ;
59+
60+ const transform : Transform . TransformSpec = {
61+ type : 'filter' ,
62+ columnIndex : colIndex + 1 ,
63+ operator : '=' ,
64+ value : 6
65+ } ;
66+
67+ Private . setDialogState ( {
68+ dialog : dialog ,
69+ columnIndex : colIndex ,
70+ mode : 'condition' ,
71+ operator : transform . operator ,
72+ region : 'body' ,
73+ value : transform . value
74+ } )
75+
76+ dialog . applyFilter ( ) ;
77+ const addedTransform = dialog . model . transformMetadata ( colIndex + 1 ) ! [ 'filter' ] ;
78+ expect ( addedTransform ) . toEqual ( transform ) ;
79+ } ) ;
80+ test ( 'value transform is added' , ( ) => {
81+ const dialog = Private . createSimpleDialog ( ) ;
82+ const colIndex = 0 ;
83+
84+ const transform : Transform . TransformSpec = {
85+ type : 'filter' ,
86+ columnIndex : colIndex + 1 ,
87+ operator : 'in' ,
88+ value : [ ]
89+ } ;
90+
91+ Private . setDialogState ( {
92+ dialog : dialog ,
93+ columnIndex : colIndex ,
94+ mode : 'value' ,
95+ operator : transform . operator ,
96+ region : 'body' ,
97+ value : transform . value
98+ } )
99+ dialog . userInteractedWithDialog = true ;
100+ dialog . applyFilter ( ) ;
101+ const addedTransform = dialog . model . transformMetadata ( colIndex + 1 ) ! [ 'filter' ] ;
102+ expect ( addedTransform ) . toEqual ( transform ) ;
103+ } ) ;
56104} ) ;
57105
58106describe ( 'Test .updateDialog()' , ( ) => {
Original file line number Diff line number Diff line change 11// jsdom does not support HTML5 canvas, so we need to mock out this function
22HTMLCanvasElement . prototype . getContext = ( ) => {
3- return { }
3+ return {
4+ scale : ( ) => { } ,
5+ fillRect : ( ) => { } ,
6+ strokeRect : ( ) => { } ,
7+ fillText : ( ) => { } ,
8+ beginPath : ( ) => { } ,
9+ moveTo : ( ) => { } ,
10+ lineTo : ( ) => { } ,
11+ stroke : ( ) => { }
12+ }
413} ;
You can’t perform that action at this time.
0 commit comments