forked from thomd/jquery-scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscroll.test.js
More file actions
89 lines (71 loc) · 2.61 KB
/
scroll.test.js
File metadata and controls
89 lines (71 loc) · 2.61 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
TestCase("PluginTest", {
testExistenceOfPlugin: function(){
assertTrue("scroll plugin", !!$.fn.scrollbar);
}
});
TestCase("ScrollbarGeneratorTest", {
setUp: function(){
this.fixture = jstestdriver.Fixture();
},
tearDown: function(){
delete this.fixture;
},
testGenerationOfScrollbarHandle: function(){
assertEquals(0, this.fixture.scrollbar.find('.scrollbar-handle').length);
this.fixture.scrollbar.scrollbar();
assertEquals(1, this.fixture.scrollbar.find('.scrollbar-handle').length);
},
testGenerationOfNoScrollbar: function(){
this.fixture.noScrollbar.scrollbar();
assertEquals(0, this.fixture.noScrollbar.find('.scrollbar-handle').length);
}
});
//
// test for plugin options and class-based options
//
TestCase("OptionsTest", {
setUp: function(){
this.fixture = jstestdriver.Fixture();
},
tearDown: function(){
delete this.fixture;
},
testFixedHandleHeight: function(){
this.fixture.scrollbar.scrollbar({handleHeight:20});
assertEquals(20, this.fixture.scrollbar.find('.scrollbar-handle').height());
},
testMinimumHandleHeight: function(){
this.fixture.scrollbar.scrollbar({
handleMinHeight: 50
});
assertEquals("Minimum height of scrollbar handle", 50, this.fixture.scrollbar.find('.scrollbar-handle').height());
},
testAutoHandleHeight: function(){
this.fixture.scrollbar.scrollbar({
handleMinHeight: 0
});
assertEquals("Actual height of scrollbar handle", 32, this.fixture.scrollbar.find('.scrollbar-handle').height());
},
testScrollbarWithArrows: function(){
this.fixture.scrollbar.scrollbar({
arrows: true
});
assertEquals(1, this.fixture.scrollbar.find('.scrollbar-handle-container').length);
assertEquals(1, this.fixture.scrollbar.find('.scrollbar-handle-up').length);
assertEquals(1, this.fixture.scrollbar.find('.scrollbar-handle-down').length);
},
testScrollbarWithoutArrows: function(){
this.fixture.scrollbar.scrollbar({
arrows: false
});
assertEquals(1, this.fixture.scrollbar.find('.scrollbar-handle-container').length);
assertEquals(0, this.fixture.scrollbar.find('.scrollbar-handle-up').length);
assertEquals(0, this.fixture.scrollbar.find('.scrollbar-handle-down').length);
},
testScrollbarWithoutArrowsByClassAttribute: function(){
this.fixture.noArrows.scrollbar();
assertEquals(1, this.fixture.noArrows.find('.scrollbar-handle-container').length);
assertEquals(0, this.fixture.noArrows.find('.scrollbar-handle-up').length);
assertEquals(0, this.fixture.noArrows.find('.scrollbar-handle-down').length);
}
});