@@ -33,6 +33,7 @@ import {
33
33
#FobController
34
34
[axisDirection]="axisDirection"
35
35
[timeSelection]="timeSelection"
36
+ [rangeSelectionEnabled]="rangeSelectionEnabled"
36
37
[startStepAxisPosition]="getAxisPositionFromStartStep()"
37
38
[endStepAxisPosition]="getAxisPositionFromEndStep()"
38
39
[prospectiveStepAxisPosition]="getAxisPositionFromProspectiveStep()"
@@ -54,6 +55,7 @@ class TestableComponent {
54
55
55
56
@Input ( ) axisDirection ! : AxisDirection ;
56
57
@Input ( ) timeSelection ! : TimeSelection ;
58
+ @Input ( ) rangeSelectionEnabled : boolean = false ;
57
59
@Input ( ) cardFobHelper ! : CardFobGetStepFromPositionHelper ;
58
60
@Input ( ) showExtendedLine ?: Boolean ;
59
61
@Input ( ) highestStep ! : number ;
@@ -94,6 +96,7 @@ describe('card_fob_controller', () => {
94
96
function createComponent ( input : {
95
97
axisDirection ?: AxisDirection ;
96
98
timeSelection : TimeSelection ;
99
+ enableRangeSelection ?: boolean ;
97
100
showExtendedLine ?: Boolean ;
98
101
steps ?: number [ ] ;
99
102
isProspectiveFobFeatureEnabled ?: Boolean ;
@@ -150,6 +153,9 @@ describe('card_fob_controller', () => {
150
153
input . axisDirection ?? AxisDirection . VERTICAL ;
151
154
152
155
fixture . componentInstance . timeSelection = input . timeSelection ;
156
+ fixture . componentInstance . rangeSelectionEnabled = Boolean (
157
+ input . enableRangeSelection
158
+ ) ;
153
159
154
160
fixture . componentInstance . showExtendedLine =
155
161
input . showExtendedLine ?? false ;
@@ -183,6 +189,7 @@ describe('card_fob_controller', () => {
183
189
it ( 'sets fob position based on time selection' , ( ) => {
184
190
const fixture = createComponent ( {
185
191
timeSelection : { start : { step : 2 } , end : { step : 5 } } ,
192
+ enableRangeSelection : true ,
186
193
axisDirection : AxisDirection . HORIZONTAL ,
187
194
} ) ;
188
195
fixture . detectChanges ( ) ;
@@ -253,6 +260,7 @@ describe('card_fob_controller', () => {
253
260
it ( 'swaps fobs being dragged when start > end' , ( ) => {
254
261
const fixture = createComponent ( {
255
262
timeSelection : { start : { step : 1 } , end : { step : 2 } } ,
263
+ enableRangeSelection : true ,
256
264
} ) ;
257
265
fixture . detectChanges ( ) ;
258
266
const fobController = fixture . componentInstance . fobController ;
@@ -286,6 +294,7 @@ describe('card_fob_controller', () => {
286
294
it ( 'swaps fobs being dragged when end < start' , ( ) => {
287
295
const fixture = createComponent ( {
288
296
timeSelection : { start : { step : 2 } , end : { step : 3 } } ,
297
+ enableRangeSelection : true ,
289
298
} ) ;
290
299
fixture . detectChanges ( ) ;
291
300
const fobController = fixture . componentInstance . fobController ;
@@ -319,6 +328,7 @@ describe('card_fob_controller', () => {
319
328
it ( 'does not swaps fobs when start === end' , ( ) => {
320
329
const fixture = createComponent ( {
321
330
timeSelection : { start : { step : 2 } , end : { step : 3 } } ,
331
+ enableRangeSelection : true ,
322
332
} ) ;
323
333
fixture . detectChanges ( ) ;
324
334
const fobController = fixture . componentInstance . fobController ;
@@ -353,6 +363,7 @@ describe('card_fob_controller', () => {
353
363
it ( 'does not fire event when time selection does not change' , ( ) => {
354
364
const fixture = createComponent ( {
355
365
timeSelection : { start : { step : 2 } , end : { step : 3 } } ,
366
+ enableRangeSelection : true ,
356
367
} ) ;
357
368
fixture . detectChanges ( ) ;
358
369
const fobController = fixture . componentInstance . fobController ;
@@ -544,6 +555,7 @@ describe('card_fob_controller', () => {
544
555
it ( 'end fob moves to the mouse when mouse is dragging up and mouse is above the fob' , ( ) => {
545
556
const fixture = createComponent ( {
546
557
timeSelection : { start : { step : 1 } , end : { step : 1 } } ,
558
+ enableRangeSelection : true ,
547
559
} ) ;
548
560
fixture . detectChanges ( ) ;
549
561
const fobController = fixture . componentInstance . fobController ;
@@ -582,6 +594,7 @@ describe('card_fob_controller', () => {
582
594
it ( 'end fob moves to the mouse when mouse is dragging down and mouse is below the fob' , ( ) => {
583
595
const fixture = createComponent ( {
584
596
timeSelection : { start : { step : 1 } , end : { step : 4 } } ,
597
+ enableRangeSelection : true ,
585
598
} ) ;
586
599
fixture . detectChanges ( ) ;
587
600
const fobController = fixture . componentInstance . fobController ;
@@ -619,6 +632,7 @@ describe('card_fob_controller', () => {
619
632
it ( 'end fob does not move when mouse is dragging down but, mouse is above the fob' , ( ) => {
620
633
const fixture = createComponent ( {
621
634
timeSelection : { start : { step : 1 } , end : { step : 2 } } ,
635
+ enableRangeSelection : true ,
622
636
} ) ;
623
637
fixture . detectChanges ( ) ;
624
638
const fobController = fixture . componentInstance . fobController ;
@@ -649,6 +663,7 @@ describe('card_fob_controller', () => {
649
663
it ( 'end fob does not move when mouse is dragging up but, mouse is below the fob' , ( ) => {
650
664
const fixture = createComponent ( {
651
665
timeSelection : { start : { step : 1 } , end : { step : 3 } } ,
666
+ enableRangeSelection : true ,
652
667
} ) ;
653
668
fixture . detectChanges ( ) ;
654
669
const fobController = fixture . componentInstance . fobController ;
@@ -855,6 +870,7 @@ describe('card_fob_controller', () => {
855
870
it ( 'end fob moves to the mouse when mouse is dragging left and mouse is left of the fob' , ( ) => {
856
871
const fixture = createComponent ( {
857
872
timeSelection : { start : { step : 1 } , end : { step : 1 } } ,
873
+ enableRangeSelection : true ,
858
874
axisDirection : AxisDirection . HORIZONTAL ,
859
875
} ) ;
860
876
fixture . detectChanges ( ) ;
@@ -894,6 +910,7 @@ describe('card_fob_controller', () => {
894
910
it ( 'end fob moves to the mouse when mouse is dragging right and mouse is right of the fob' , ( ) => {
895
911
const fixture = createComponent ( {
896
912
timeSelection : { start : { step : 1 } , end : { step : 4 } } ,
913
+ enableRangeSelection : true ,
897
914
axisDirection : AxisDirection . HORIZONTAL ,
898
915
} ) ;
899
916
fixture . detectChanges ( ) ;
@@ -932,6 +949,7 @@ describe('card_fob_controller', () => {
932
949
it ( 'end fob does not move when mouse is dragging right but, mouse is left of the fob' , ( ) => {
933
950
const fixture = createComponent ( {
934
951
timeSelection : { start : { step : 1 } , end : { step : 2 } } ,
952
+ enableRangeSelection : true ,
935
953
axisDirection : AxisDirection . HORIZONTAL ,
936
954
} ) ;
937
955
fixture . detectChanges ( ) ;
@@ -963,6 +981,7 @@ describe('card_fob_controller', () => {
963
981
it ( 'end fob does not move when mouse is dragging left but, mouse is right of the fob' , ( ) => {
964
982
const fixture = createComponent ( {
965
983
timeSelection : { start : { step : 1 } , end : { step : 3 } } ,
984
+ enableRangeSelection : true ,
966
985
axisDirection : AxisDirection . HORIZONTAL ,
967
986
} ) ;
968
987
fixture . detectChanges ( ) ;
@@ -1008,6 +1027,7 @@ describe('card_fob_controller', () => {
1008
1027
it ( 'renders two lines on range selection' , ( ) => {
1009
1028
const fixture = createComponent ( {
1010
1029
timeSelection : { start : { step : 1 } , end : { step : 4 } } ,
1030
+ enableRangeSelection : true ,
1011
1031
showExtendedLine : true ,
1012
1032
} ) ;
1013
1033
fixture . detectChanges ( ) ;
@@ -1021,6 +1041,7 @@ describe('card_fob_controller', () => {
1021
1041
it ( 'clicks and drags the line to change selected step in horizontal axis' , ( ) => {
1022
1042
const fixture = createComponent ( {
1023
1043
timeSelection : { start : { step : 1 } , end : { step : 3 } } ,
1044
+ enableRangeSelection : true ,
1024
1045
axisDirection : AxisDirection . HORIZONTAL ,
1025
1046
showExtendedLine : true ,
1026
1047
} ) ;
@@ -1111,6 +1132,7 @@ describe('card_fob_controller', () => {
1111
1132
it ( 'range selection start fob step typed which is less than end fob step' , ( ) => {
1112
1133
const fixture = createComponent ( {
1113
1134
timeSelection : { start : { step : 1 } , end : { step : 4 } } ,
1135
+ enableRangeSelection : true ,
1114
1136
} ) ;
1115
1137
fixture . detectChanges ( ) ;
1116
1138
const fobController = fixture . componentInstance . fobController ;
@@ -1128,6 +1150,7 @@ describe('card_fob_controller', () => {
1128
1150
it ( 'range selection end fob step typed which is greater than start fob step' , ( ) => {
1129
1151
const fixture = createComponent ( {
1130
1152
timeSelection : { start : { step : 1 } , end : { step : 4 } } ,
1153
+ enableRangeSelection : true ,
1131
1154
} ) ;
1132
1155
fixture . detectChanges ( ) ;
1133
1156
const fobController = fixture . componentInstance . fobController ;
@@ -1145,6 +1168,7 @@ describe('card_fob_controller', () => {
1145
1168
it ( 'range selection swaps when start step is typed in which is greater than end step' , ( ) => {
1146
1169
const fixture = createComponent ( {
1147
1170
timeSelection : { start : { step : 1 } , end : { step : 2 } } ,
1171
+ enableRangeSelection : true ,
1148
1172
} ) ;
1149
1173
fixture . detectChanges ( ) ;
1150
1174
const fobController = fixture . componentInstance . fobController ;
@@ -1162,6 +1186,7 @@ describe('card_fob_controller', () => {
1162
1186
it ( 'range selection swaps when end step is typed in which is less than start step' , ( ) => {
1163
1187
const fixture = createComponent ( {
1164
1188
timeSelection : { start : { step : 3 } , end : { step : 4 } } ,
1189
+ enableRangeSelection : true ,
1165
1190
} ) ;
1166
1191
fixture . detectChanges ( ) ;
1167
1192
const fobController = fixture . componentInstance . fobController ;
@@ -1179,6 +1204,7 @@ describe('card_fob_controller', () => {
1179
1204
it ( 'properly handles a 0 step' , ( ) => {
1180
1205
const fixture = createComponent ( {
1181
1206
timeSelection : { start : { step : 3 } , end : { step : 4 } } ,
1207
+ enableRangeSelection : true ,
1182
1208
} ) ;
1183
1209
fixture . detectChanges ( ) ;
1184
1210
const fobController = fixture . componentInstance . fobController ;
@@ -1220,6 +1246,7 @@ describe('card_fob_controller', () => {
1220
1246
it ( 'changing end fob input modifies end step' , ( ) => {
1221
1247
const fixture = createComponent ( {
1222
1248
timeSelection : { start : { step : 1 } , end : { step : 3 } } ,
1249
+ enableRangeSelection : true ,
1223
1250
} ) ;
1224
1251
fixture . detectChanges ( ) ;
1225
1252
@@ -1263,6 +1290,7 @@ describe('card_fob_controller', () => {
1263
1290
it ( 'fires onTimeSelectionChanged to remove end fob when end fob is deselected' , ( ) => {
1264
1291
const fixture = createComponent ( {
1265
1292
timeSelection : { start : { step : 1 } , end : { step : 3 } } ,
1293
+ enableRangeSelection : true ,
1266
1294
} ) ;
1267
1295
fixture . detectChanges ( ) ;
1268
1296
@@ -1284,6 +1312,7 @@ describe('card_fob_controller', () => {
1284
1312
it ( 'fires onTimeSelectionChanged to change the start fob step to the current end fob step and the end fob step to null when start fob is deselected in a range selection' , ( ) => {
1285
1313
const fixture = createComponent ( {
1286
1314
timeSelection : { start : { step : 1 } , end : { step : 3 } } ,
1315
+ enableRangeSelection : true ,
1287
1316
} ) ;
1288
1317
fixture . detectChanges ( ) ;
1289
1318
0 commit comments