UNPKG

2.55 kBJavaScriptView Raw
1"use strict";
2
3var Converters = require("tfw.binding.converters");
4
5describe('Module tfw.binding.converters', function() {
6 describe('array', function() {
7
8 });
9 describe('boolean', function() {
10
11 });
12 describe('booleans', function() {
13
14 });
15 describe('color', function() {
16
17 });
18 describe('date', function() {
19 var conv = Converters.get('date');
20 it('should return a Date verbatim', function() {
21 var d = new Date();
22 expect( conv( d ) ).toBe( d );
23 });
24
25 });
26 describe('enum', function() {
27
28 });
29 describe('float', function() {
30
31 });
32 describe('integer', function() {
33
34 });
35 describe('intl', function() {
36
37 });
38 describe('isEmpty', function() {
39
40 });
41 describe('isNotEmpty', function() {
42
43 });
44 describe('keys', function() {
45
46 });
47 describe('length', function() {
48
49 });
50 describe('list', function() {
51
52 });
53 describe('multilang', function() {
54
55 });
56 describe('not', function() {
57
58 });
59 describe('sortedKeys', function() {
60
61 });
62 describe('string', function() {
63
64 });
65 describe('strings', function() {
66
67 });
68 describe('time', function() {
69 var conv = Converters.get('time');
70 it('should return a Date verbatim', function() {
71 var d = new Date();
72 expect( conv( d ) ).toBe( d );
73 });
74
75 [
76 ['(12 05 27)', 12, 5, 27],
77 ['1200', 12, 0, 0],
78 ['12:00', 12, 0, 0],
79 ['1H2M3S', 1, 2, 3],
80 ['12', 12, 0, 0],
81 ['1,200', 1, 20, 0],
82 ['4700', 23, 0, 0],
83 ['', 0, 0, 0]
84 ].forEach(function (testcase) {
85 var input = testcase[0];
86 var expectedHour = testcase[1];
87 var expectedMinute = testcase[2];
88 var expectedSecond = testcase[3];
89 describe(`"${input}"`, function() {
90 debugger;
91 var result = conv( input );
92 it('getHours() should give ' + expectedHour, function() {
93 expect( result.getHours() ).toBe( expectedHour );
94 });
95 it('getMinutes() should give ' + expectedMinute, function() {
96 expect( result.getMinutes() ).toBe( expectedMinute );
97 });
98 it('getSeconds() should give ' + expectedSecond, function() {
99 expect( result.getSeconds() ).toBe( expectedSecond );
100 });
101 });
102 });
103 });
104 describe('unit', function() {
105
106 });
107 describe('units', function() {
108
109 });
110 describe('validator', function() {
111
112 });
113});
114