Blame view

frontend/web/js/raty-2.7.0/spec/options_spec.js 2.03 KB
c7f222e2   Artem   first
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  describe('options', function() {
    beforeEach(function() {
      this.el = Helper.create('#el');
    });
  
    afterEach(function() {
      Helper.clear();
    });
  
    it ('has the right default values', function() {
      // given
      var raty = $.fn.raty;
  
      // when
      var opt = raty.defaults;
  
      // then
      expect(opt.cancel).toBeFalsy();
      expect(opt.cancelClass).toEqual('raty-cancel');
      expect(opt.cancelHint).toEqual('Cancel this rating!');
      expect(opt.cancelOff).toEqual('cancel-off.png');
      expect(opt.cancelOn).toEqual('cancel-on.png');
      expect(opt.cancelPlace).toEqual('left');
      expect(opt.click).toBeUndefined();
      expect(opt.half).toBeFalsy();
      expect(opt.halfShow).toBeTruthy();
      expect(opt.hints).toContain('bad', 'poor', 'regular', 'good', 'gorgeous');
      expect(opt.iconRange).toBeUndefined();
      expect(opt.mouseover).toBeUndefined();
      expect(opt.noRatedMsg).toEqual('Not rated yet!');
      expect(opt.number).toBe(5);
      expect(opt.path).toBeUndefined();
      expect(opt.precision).toBeFalsy();
      expect(opt.readOnly).toBeFalsy();
      expect(opt.round.down).toEqual(0.25);
      expect(opt.round.full).toEqual(0.6);
      expect(opt.round.up).toEqual(0.76);
      expect(opt.score).toBeUndefined();
      expect(opt.scoreName).toEqual('score');
      expect(opt.single).toBeFalsy();
      expect(opt.space).toBeTruthy();
      expect(opt.starHalf).toEqual('star-half.png');
      expect(opt.starOff).toEqual('star-off.png');
      expect(opt.starOn).toEqual('star-on.png');
      expect(opt.target).toBeUndefined();
      expect(opt.targetFormat).toEqual('{score}');
      expect(opt.targetKeep).toBeFalsy();
      expect(opt.targetText).toEqual('');
      expect(opt.targetType).toEqual('hint');
      expect(opt.width).toBeUndefined();
    });
  
    describe('#starType', function() {
      context('when actived', function() {
        it('disable the width property', function() {
          // given
          var self = this.el;
  
          // when
          self.raty({ starType: 'i' });
  
          // then
          expect(self[0].style.width).toEqual('');
        });
      });
    });
  });