|
127 | 127 | expect(helper.scope.slider.max).to.equal(56); |
128 | 128 | }); |
129 | 129 |
|
| 130 | + it('should not be modified by keyboard if new range is above maxRange', function() { |
| 131 | + var sliderConf = { |
| 132 | + min: 45, |
| 133 | + max: 55, |
| 134 | + options: { |
| 135 | + floor: 0, |
| 136 | + ceil: 100, |
| 137 | + step: 1, |
| 138 | + maxRange: 10 |
| 139 | + } |
| 140 | + }; |
| 141 | + helper.createRangeSlider(sliderConf); |
| 142 | + //try to move minH left |
| 143 | + helper.slider.minH.triggerHandler('focus'); |
| 144 | + helper.pressKeydown(helper.slider.minH, 'LEFT'); |
| 145 | + expect(helper.scope.slider.min).to.equal(45); |
| 146 | + |
| 147 | + //try to move maxH right |
| 148 | + helper.slider.maxH.triggerHandler('focus'); |
| 149 | + helper.pressKeydown(helper.slider.maxH, 'RIGHT'); |
| 150 | + expect(helper.scope.slider.max).to.equal(55); |
| 151 | + }); |
| 152 | + |
| 153 | + it('should be modified by keyboard if new range is below maxRange', function() { |
| 154 | + var sliderConf = { |
| 155 | + min: 45, |
| 156 | + max: 55, |
| 157 | + options: { |
| 158 | + floor: 0, |
| 159 | + ceil: 100, |
| 160 | + step: 1, |
| 161 | + maxRange: 10 |
| 162 | + } |
| 163 | + }; |
| 164 | + helper.createRangeSlider(sliderConf); |
| 165 | + |
| 166 | + //try to move minH right |
| 167 | + helper.slider.minH.triggerHandler('focus'); |
| 168 | + helper.pressKeydown(helper.slider.minH, 'RIGHT'); |
| 169 | + expect(helper.scope.slider.min).to.equal(46); |
| 170 | + |
| 171 | + //try to move maxH left |
| 172 | + helper.slider.maxH.triggerHandler('focus'); |
| 173 | + helper.pressKeydown(helper.slider.maxH, 'LEFT'); |
| 174 | + expect(helper.scope.slider.max).to.equal(54); |
| 175 | + }); |
| 176 | + |
130 | 177 | it('should be modified by keyboard if new value is above minLimit', function() { |
131 | 178 | var sliderConf = { |
132 | 179 | value: 10, |
|
327 | 374 | helper.pressKeydown(helper.slider.maxH, 'LEFT'); |
328 | 375 | expect(helper.scope.slider.max).to.equal(56); |
329 | 376 | }); |
| 377 | + |
| 378 | + it('should not be modified by keyboard if new range is above maxRange', function() { |
| 379 | + var sliderConf = { |
| 380 | + min: 45, |
| 381 | + max: 55, |
| 382 | + options: { |
| 383 | + floor: 0, |
| 384 | + ceil: 100, |
| 385 | + step: 1, |
| 386 | + maxRange: 10, |
| 387 | + rightToLeft: true |
| 388 | + } |
| 389 | + }; |
| 390 | + helper.createRangeSlider(sliderConf); |
| 391 | + //try to move minH right ( increase in rtl ) |
| 392 | + helper.slider.minH.triggerHandler('focus'); |
| 393 | + helper.pressKeydown(helper.slider.minH, 'RIGHT'); |
| 394 | + expect(helper.scope.slider.min).to.equal(45); |
| 395 | + |
| 396 | + //try to move maxH left (decrease in rtl ) |
| 397 | + helper.slider.maxH.triggerHandler('focus'); |
| 398 | + helper.pressKeydown(helper.slider.maxH, 'LEFT'); |
| 399 | + expect(helper.scope.slider.max).to.equal(55); |
| 400 | + }); |
| 401 | + |
| 402 | + it('should be modified by keyboard if new range is below maxRange', function() { |
| 403 | + var sliderConf = { |
| 404 | + min: 45, |
| 405 | + max: 55, |
| 406 | + options: { |
| 407 | + floor: 0, |
| 408 | + ceil: 100, |
| 409 | + step: 1, |
| 410 | + maxRange: 10, |
| 411 | + rightToLeft: true |
| 412 | + } |
| 413 | + }; |
| 414 | + helper.createRangeSlider(sliderConf); |
| 415 | + |
| 416 | + //try to move minH LEFT |
| 417 | + helper.slider.minH.triggerHandler('focus'); |
| 418 | + helper.pressKeydown(helper.slider.minH, 'LEFT'); |
| 419 | + expect(helper.scope.slider.min).to.equal(46); |
| 420 | + |
| 421 | + //try to move maxH RIGHT |
| 422 | + helper.slider.maxH.triggerHandler('focus'); |
| 423 | + helper.pressKeydown(helper.slider.maxH, 'RIGHT'); |
| 424 | + expect(helper.scope.slider.max).to.equal(54); |
| 425 | + }); |
330 | 426 | }); |
331 | 427 | }()); |
332 | 428 |
|
0 commit comments