Example #1
0
    it('up arrow increases by 1', function () {
      compile([1]);

      return simulateKeys(
        function () { return $el.find('input').first(); },
        ['up', 'up', 'up']
      )
        .then(function () {
          expect(onlyValidValues()).to.eql([4]);
        });
    });
Example #2
0
    it('down arrow decreases by 1', function () {
      compile([5]);

      return simulateKeys(
        function () { return $el.find('input').first(); },
        ['down', 'down', 'down']
      )
        .then(function () {
          expect(onlyValidValues()).to.eql([2]);
        });
    });
Example #3
0
    it('maintains valid number', function () {
      compile([9, 11, 13]);

      const seq = [
        'down', // 10 (11 - 1)
        'down'  // 10 (limited by 9)
      ];

      const getEl = function () { return $el.find('input').eq(1); };

      return simulateKeys(getEl, seq)
        .then(function () {
          expect(onlyValidValues()).to.eql([9, 10, 13]);
        });
    });
Example #4
0
    it('shift-up increases by 0.1', function () {
      compile([4.8]);

      const seq = [
        {
          type: 'press',
          key: 'shift',
          events: [
            'up',
            'up',
            'up'
          ]
        }
      ];

      return simulateKeys(
        function () { return $el.find('input').first(); },
        seq
      )
        .then(function () {
          expect(onlyValidValues()).to.eql([5.1]);
        });
    });