number_spec.js
759 Bytes
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
describe('#number', function() {
beforeEach(function() {
$.fn.raty.defaults.path = '../lib/images';
this.el = Helper.create('#el');
});
afterEach(function() {
Helper.clear();
});
it ('changes the number of stars', function() {
// given
// when
this.el.raty({ number: 1 });
// then
expect(this.el.children('img').length).toEqual(1);
});
it ('accepts number as string', function() {
// given
// when
this.el.raty({ number: '1' });
// then
expect(this.el.children('img').length).toEqual(1);
});
it ('accepts callback', function() {
// given
// when
this.el.raty({ number: function() { return 1; } });
// then
expect(this.el[0].opt.number).toEqual(1);
});
});