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
|
Index: web_example/static/src/tests/timer.js
===================================================================
--- web_example.orig/static/src/tests/timer.js
+++ web_example/static/src/tests/timer.js
@@ -1,8 +1,45 @@
openerp.testing.section('timer', function (test) {
- test('successful test', function () {
- ok(true, "should work");
- });
- test('unsuccessful test', function () {
- ok(false, "shoud fail");
+ test('format_time', function (instance) {
+ var w = new instance.web_example.Action();
+
+ strictEqual(
+ w.format_time(0),
+ '00:00:00');
+ strictEqual(
+ w.format_time(543),
+ '00:00:00',
+ "should round sub-second times down to zero");
+ strictEqual(
+ w.format_time(5340),
+ '00:00:05',
+ "should floor sub-second extents to the previous second");
+ strictEqual(
+ w.format_time(60000),
+ '00:01:00');
+ strictEqual(
+ w.format_time(3600000),
+ '01:00:00');
+ strictEqual(
+ w.format_time(86400000),
+ '24:00:00');
+ strictEqual(
+ w.format_time(604800000),
+ '168:00:00');
+
+ strictEqual(
+ w.format_time(22733958),
+ '06:18:53');
+ strictEqual(
+ w.format_time(41676639),
+ '11:34:36');
+ strictEqual(
+ w.format_time(57802094),
+ '16:03:22');
+ strictEqual(
+ w.format_time(73451828),
+ '20:24:11');
+ strictEqual(
+ w.format_time(84092336),
+ '23:21:32');
});
});
|