Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.

Commit f0d95e5

Browse files
author
Joel Mukuthu
committed
Added initial tests for wheel service [ci skip]
1 parent 5d94871 commit f0d95e5

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/spec/services/wheel.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
3+
describe('Service: wheel', function () {
4+
var element;
5+
6+
beforeEach(module('snapscroll'));
7+
8+
beforeEach(function () {
9+
var html = [
10+
'<div style="height: 100px; overflow: auto">',
11+
'<div style="height: 1000px"></div>',
12+
'</div>'
13+
].join('');
14+
element = angular.element(html);
15+
angular.element(document).find('body').append(element);
16+
});
17+
18+
afterEach(function () {
19+
angular.element(document).find('body').empty();
20+
});
21+
22+
it('provides a \'bind\' function and an \'unbind\' function', inject(function (wheel) {
23+
expect(angular.isFunction(wheel.bind)).toBe(true);
24+
expect(angular.isFunction(wheel.unbind)).toBe(true);
25+
}));
26+
27+
describe('.bind', function () {
28+
var wheel;
29+
30+
beforeEach(inject(function (_wheel_) {
31+
wheel = _wheel_;
32+
}));
33+
34+
it('throws an error if up() and down() callbacks are not provided', function () {
35+
expect(function () {
36+
wheel.bind(element, {});
37+
}).toThrowError('No callbacks provided');
38+
});
39+
40+
it('prevents the default wheel event in one direction if a callback for the same direction is provided', function () {
41+
});
42+
43+
it('does not prevents the default wheel event in one direction if a callback for that direction is not provided', function () {
44+
});
45+
});
46+
});

0 commit comments

Comments
 (0)