forked from siddii/angular-timer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimerSetTimeTest.js
More file actions
39 lines (30 loc) · 1.21 KB
/
timerSetTimeTest.js
File metadata and controls
39 lines (30 loc) · 1.21 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
'use strict';
describe('timer-set-countdown-seconds event handling tests', function () {
beforeEach(module('timer'));
it('should call the event and set single digit seconds correctly', function () {
inject(function ($compile, $rootScope, $timeout) {
var scope = $rootScope.$new();
var element = $compile('<timer countdown="10" interval="1000" autostart="false">{{sseconds}}</timer>')(scope);
scope.$digest();
scope.$broadcast('timer-set-countdown-seconds', 5);
$timeout(function () {
scope.$digest();
expect(element.html().indexOf('05')).toBeGreaterThan(-1);
}, 500);
$timeout.flush();
});
});
it('should call the event and set larger second values correctly', function () {
inject(function ($compile, $rootScope, $timeout) {
var scope = $rootScope.$new();
var element = $compile('<timer countdown="10" interval="1000" autostart="false">{{mminutes}}:{{sseconds}}</timer>')(scope);
scope.$digest();
scope.$broadcast('timer-set-countdown-seconds', 135);
$timeout(function () {
scope.$digest();
expect(element.html().indexOf('02:15')).toBeGreaterThan(-1);
}, 500);
$timeout.flush();
});
});
});