Blame view

frontend/web/js/raty-2.7.0/spec/common_spec.js 685 Bytes
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
  describe('common', function() {
    beforeEach(function() {
      $.fn.raty.defaults.path = '../lib/images';
  
      this.el = Helper.create('#el');
    });
  
    afterEach(function() {
      Helper.clear();
    });
  
    it ('is chainable', function() {
      // given
      // when
      var ref = this.el.raty();
  
      // then
      expect(ref).toBe(this.el);
    });
  
    context('on click without mouseover', function() {
      it ('changes the stars to on', function() {
        // given
        var self  = this.el.raty(),
            stars = self.children('img');
  
        // when
        stars.last().trigger('click');
  
        // then
        expect(stars).toHaveAttr('src', '../lib/images/star-on.png');
      });
    });
  });