it('should use deg as default unit', function() {
      transform(el, {
        skew: '30 -10'
      });
      assert.equal(transform.get(el), 'skew(30deg, -10deg)');

      transform(el, {
        skew: '30'
      });
      assert.equal(transform.get(el), 'skew(30deg)');
    });
    it('should apply the values', function() {
      transform(el, {
        skew: '30deg, -10deg'
      });
      assert.equal(transform.get(el), 'skew(30deg, -10deg)');

      transform(el, {
        skew: '30deg'
      });
      assert.equal(transform.get(el), 'skew(30deg)');
    });
    it('should use px as default unit', function() {
      transform(el, {
        translate3d: '1 1 1'
      });
      assert.equal(transform.get(el), 'translate3d(1px, 1px, 1px)');

      transform(el, {
        translate3d: '1, 1, 1'
      });
      assert.equal(transform.get(el), 'translate3d(1px, 1px, 1px)');
    });
Ejemplo n.º 4
0
SimpleColorPicker.prototype._moveHueTo = function(y) {
  this.huePosition = clamp(y, 0, this.maxHue);

  transform(this.$hSelector, {
    y: this.huePosition
  });
};
    it('should apply the values', function() {
      var opts = {};
      opts[prop] = 2;

      transform(el, opts);
      assert.equal(transform.get(el), prop + '(2)');
    });
 it('should clear', function() {
   transform(el, {
     x: 10
   });
   assert.equal(transform.get(el), 'translateX(10px)');
   transform.none(el);
   assert.equal(transform.get(el), '');
 });
Ejemplo n.º 7
0
SimpleColorPicker.prototype._moveSelectorTo = function(x, y) {
  this.position.x = clamp(x, 0, this.saturationWidth);
  this.position.y = clamp(y, 0, this.hueHeight);

  transform(this.$sbSelector, {
    x: this.position.x,
    y: this.position.y
  });
};
 it('should append comma', function() {
   transform(el, {
     matrix: '1 2 3 4 5 6'
   });
   assert.equal(transform.get(el), 'matrix(1, 2, 3, 4, 5, 6)');
 });
 it('should apply the values', function() {
   transform(el, {
     translate3d: '12px, 50%, 3em'
   });
   assert.equal(transform.get(el), 'translate3d(12px, 50%, 3em)');
 });
 it('should append comma', function() {
   transform(el, {
     translate3d: '12px 50% 3em'
   });
   assert.equal(transform.get(el), 'translate3d(12px, 50%, 3em)');
 });
 it('should use custom unit', function() {
   opts[prop] = '1.07rad';
   transform(el, opts);
   assert.equal(transform.get(el), prop + '(1.07rad)');
 });
 it('should append comma', function() {
   transform(el, {
     scale3d: '2 0.5 0.3'
   });
   assert.equal(transform.get(el), 'scale3d(2, 0.5, 0.3)');
 });
 it('should works with the shortcut ' + dir.toLowerCase(), function() {
   opts[dir.toLowerCase()] = 10;
   transform(el, opts);
   assert.equal(transform.get(el), prop + '(10px)');
 });
 it('should use deg as default unit', function() {
   opts[prop] = 10;
   transform(el, opts);
   assert.equal(transform.get(el), prop + '(10deg)');
 });
 it('should apply the values', function() {
   transform(el, {
     rotate: '0.5turn'
   });
   assert.equal(transform.get(el), 'rotate(0.5turn)');
 });
 it('should append comma', function() {
   transform(el, {
     translate: '12px 50%'
   });
   assert.equal(transform.get(el), 'translate(12px, 50%)');
 });
 it('should use deg as default unit', function() {
   transform(el, {
     rotate: '0.5'
   });
   assert.equal(transform.get(el), 'rotate(0.5deg)');
 });
 it('should append comma', function() {
   transform(el, {
     matrix3d: '1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
   });
   assert.equal(transform.get(el), 'matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)');
 });
 it('should append comma', function() {
   transform(el, {
     scale: '2 0.5'
   });
   assert.equal(transform.get(el), 'scale(2, 0.5)');
 });
 it('should apply the values', function() {
   transform(el, {
     matrix: '1, 2, 3, 4, 5, 6'
   });
   assert.equal(transform.get(el), 'matrix(1, 2, 3, 4, 5, 6)');
 });
 it('should use custom unit', function() {
   transform(el, {
     perspective: '10px'
   });
   assert.equal(transform.get(el), 'perspective(10px)');
 });
 it('should use px as default unit', function() {
   transform(el, {
     perspective: 10
   });
   assert.equal(transform.get(el), 'perspective(10px)');
 });
 it('should append comma', function() {
   transform(el, {
     rotate3d: '1.1 2 3 10deg'
   });
   assert.equal(transform.get(el), 'rotate3d(1.1, 2, 3, 10deg)');
 });
 it('should apply the values', function() {
   transform(el, {
     scale3d: '2, 0.5, 0.3'
   });
   assert.equal(transform.get(el), 'scale3d(2, 0.5, 0.3)');
 });
 it('should apply the values', function() {
   transform(el, {
     matrix3d: '1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16'
   });
   assert.equal(transform.get(el), 'matrix3d(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)');
 });