mol_time_all 1.1.80 → 1.1.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.d.ts +0 -156
- package/node.deps.json +1 -1
- package/node.esm.js +26 -26
- package/node.esm.js.map +1 -1
- package/node.js +26 -26
- package/node.js.map +1 -1
- package/node.test.js +287 -281
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/test.html +2 -2
- package/web.d.ts +0 -156
- package/web.deps.json +1 -1
- package/web.esm.js +26 -26
- package/web.esm.js.map +1 -1
- package/web.js +26 -26
- package/web.js.map +1 -1
- package/web.test.js +185 -179
- package/web.test.js.map +1 -1
package/web.test.js
CHANGED
|
@@ -8,7 +8,7 @@ var $;
|
|
|
8
8
|
}
|
|
9
9
|
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
10
10
|
})($ || ($ = {}));
|
|
11
|
-
//hidden.
|
|
11
|
+
//mol/fail/hidden/hidden.ts
|
|
12
12
|
;
|
|
13
13
|
"use strict";
|
|
14
14
|
var $;
|
|
@@ -26,12 +26,18 @@ var $;
|
|
|
26
26
|
$_1.$mol_test_all = [];
|
|
27
27
|
async function $mol_test_run() {
|
|
28
28
|
for (var test of $_1.$mol_test_all) {
|
|
29
|
-
let context = Object.create(
|
|
29
|
+
let context = Object.create($$);
|
|
30
30
|
for (let mock of $_1.$mol_test_mocks)
|
|
31
31
|
await mock(context);
|
|
32
|
-
|
|
32
|
+
const res = test(context);
|
|
33
|
+
if (res instanceof Promise) {
|
|
34
|
+
await new Promise((done, fail) => {
|
|
35
|
+
res.then(done, fail);
|
|
36
|
+
setTimeout(() => fail(new Error('Test timeout: ' + test.name)), 1000);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
|
-
|
|
40
|
+
$$.$mol_log3_done({
|
|
35
41
|
place: '$mol_test',
|
|
36
42
|
message: 'All tests passed',
|
|
37
43
|
count: $_1.$mol_test_all.length,
|
|
@@ -49,7 +55,7 @@ var $;
|
|
|
49
55
|
await $mol_test_run();
|
|
50
56
|
}
|
|
51
57
|
finally {
|
|
52
|
-
|
|
58
|
+
$$.$mol_test_complete();
|
|
53
59
|
}
|
|
54
60
|
}, 0);
|
|
55
61
|
}
|
|
@@ -62,10 +68,10 @@ var $;
|
|
|
62
68
|
for (let api of forbidden) {
|
|
63
69
|
context[api] = new Proxy(function () { }, {
|
|
64
70
|
get() {
|
|
65
|
-
$
|
|
71
|
+
$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
|
|
66
72
|
},
|
|
67
73
|
apply() {
|
|
68
|
-
$
|
|
74
|
+
$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
|
|
69
75
|
},
|
|
70
76
|
});
|
|
71
77
|
}
|
|
@@ -93,7 +99,7 @@ var $;
|
|
|
93
99
|
},
|
|
94
100
|
});
|
|
95
101
|
})($ || ($ = {}));
|
|
96
|
-
//test.test.
|
|
102
|
+
//mol/test/test.test.ts
|
|
97
103
|
;
|
|
98
104
|
"use strict";
|
|
99
105
|
var $;
|
|
@@ -102,20 +108,20 @@ var $;
|
|
|
102
108
|
}
|
|
103
109
|
$.$mol_test_complete = $mol_test_complete;
|
|
104
110
|
})($ || ($ = {}));
|
|
105
|
-
//test.web.test.
|
|
111
|
+
//mol/test/test.web.test.ts
|
|
106
112
|
;
|
|
107
113
|
"use strict";
|
|
108
114
|
var $;
|
|
109
115
|
(function ($) {
|
|
110
116
|
})($ || ($ = {}));
|
|
111
|
-
//context.
|
|
117
|
+
//mol/dom/context/context.ts
|
|
112
118
|
;
|
|
113
119
|
"use strict";
|
|
114
120
|
var $;
|
|
115
121
|
(function ($) {
|
|
116
122
|
$.$mol_dom_context = self;
|
|
117
123
|
})($ || ($ = {}));
|
|
118
|
-
//context.web.
|
|
124
|
+
//mol/dom/context/context.web.ts
|
|
119
125
|
;
|
|
120
126
|
"use strict";
|
|
121
127
|
var $;
|
|
@@ -126,7 +132,7 @@ var $;
|
|
|
126
132
|
for (let view of childNodes) {
|
|
127
133
|
if (view == null)
|
|
128
134
|
continue;
|
|
129
|
-
if (view instanceof
|
|
135
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
130
136
|
while (true) {
|
|
131
137
|
if (!nextNode) {
|
|
132
138
|
el.appendChild(view);
|
|
@@ -157,7 +163,7 @@ var $;
|
|
|
157
163
|
nextNode = nextNode.nextSibling;
|
|
158
164
|
}
|
|
159
165
|
else {
|
|
160
|
-
const textNode =
|
|
166
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
161
167
|
el.insertBefore(textNode, nextNode);
|
|
162
168
|
}
|
|
163
169
|
}
|
|
@@ -170,88 +176,88 @@ var $;
|
|
|
170
176
|
}
|
|
171
177
|
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
172
178
|
})($ || ($ = {}));
|
|
173
|
-
//children.
|
|
179
|
+
//mol/dom/render/children/children.ts
|
|
174
180
|
;
|
|
175
181
|
"use strict";
|
|
176
|
-
//error.
|
|
182
|
+
//mol/type/error/error.ts
|
|
177
183
|
;
|
|
178
184
|
"use strict";
|
|
179
|
-
//assert.test.
|
|
185
|
+
//mol/type/assert/assert.test.ts
|
|
180
186
|
;
|
|
181
187
|
"use strict";
|
|
182
|
-
//assert.
|
|
188
|
+
//mol/type/assert/assert.ts
|
|
183
189
|
;
|
|
184
190
|
"use strict";
|
|
185
|
-
//deep.test.
|
|
191
|
+
//mol/type/partial/deep/deep.test.ts
|
|
186
192
|
;
|
|
187
193
|
"use strict";
|
|
188
|
-
//deep.
|
|
194
|
+
//mol/type/partial/deep/deep.ts
|
|
189
195
|
;
|
|
190
196
|
"use strict";
|
|
191
197
|
var $;
|
|
192
198
|
(function ($) {
|
|
193
|
-
|
|
199
|
+
$mol_test({
|
|
194
200
|
'Make empty div'() {
|
|
195
|
-
|
|
201
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
196
202
|
},
|
|
197
203
|
'Define native field'() {
|
|
198
|
-
const dom =
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
205
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
206
|
+
$mol_assert_equal(dom.value, '123');
|
|
201
207
|
},
|
|
202
208
|
'Define classes'() {
|
|
203
|
-
const dom =
|
|
204
|
-
|
|
209
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
210
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
205
211
|
},
|
|
206
212
|
'Define styles'() {
|
|
207
|
-
const dom =
|
|
208
|
-
|
|
213
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
214
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
209
215
|
},
|
|
210
216
|
'Define dataset'() {
|
|
211
|
-
const dom =
|
|
212
|
-
|
|
217
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
218
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
213
219
|
},
|
|
214
220
|
'Define attributes'() {
|
|
215
|
-
const dom =
|
|
216
|
-
|
|
221
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
222
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
217
223
|
},
|
|
218
224
|
'Define child nodes'() {
|
|
219
|
-
const dom =
|
|
225
|
+
const dom = $mol_jsx("div", null,
|
|
220
226
|
"hello",
|
|
221
|
-
|
|
227
|
+
$mol_jsx("strong", null, "world"),
|
|
222
228
|
"!");
|
|
223
|
-
|
|
229
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
224
230
|
},
|
|
225
231
|
'Function as component'() {
|
|
226
232
|
const Button = ({ hint }, target) => {
|
|
227
|
-
return
|
|
233
|
+
return $mol_jsx("button", { title: hint }, target());
|
|
228
234
|
};
|
|
229
|
-
const dom =
|
|
230
|
-
|
|
235
|
+
const dom = $mol_jsx(Button, { id: "/foo", hint: "click me" }, () => 'hey!');
|
|
236
|
+
$mol_assert_equal(dom.outerHTML, '<button title="click me" id="/foo">hey!</button>');
|
|
231
237
|
},
|
|
232
238
|
'Nested guid generation'() {
|
|
233
239
|
const Foo = () => {
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
240
|
+
return $mol_jsx("div", null,
|
|
241
|
+
$mol_jsx(Bar, { id: "/bar" },
|
|
242
|
+
$mol_jsx("img", { id: "/icon" })));
|
|
237
243
|
};
|
|
238
244
|
const Bar = (props, icon) => {
|
|
239
|
-
return
|
|
245
|
+
return $mol_jsx("span", null, icon);
|
|
240
246
|
};
|
|
241
|
-
const dom =
|
|
242
|
-
|
|
247
|
+
const dom = $mol_jsx(Foo, { id: "/foo" });
|
|
248
|
+
$mol_assert_equal(dom.outerHTML, '<div id="/foo"><span id="/foo/bar"><img id="/foo/icon"></span></div>');
|
|
243
249
|
},
|
|
244
250
|
'Fail on non unique ids'() {
|
|
245
251
|
const App = () => {
|
|
246
|
-
return
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
return $mol_jsx("div", null,
|
|
253
|
+
$mol_jsx("span", { id: "/bar" }),
|
|
254
|
+
$mol_jsx("span", { id: "/bar" }));
|
|
249
255
|
};
|
|
250
|
-
|
|
256
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "/foo" }), 'JSX already has tag with id "/bar"');
|
|
251
257
|
},
|
|
252
258
|
});
|
|
253
259
|
})($ || ($ = {}));
|
|
254
|
-
//jsx.test.
|
|
260
|
+
//mol/jsx/jsx.test.tsx
|
|
255
261
|
;
|
|
256
262
|
"use strict";
|
|
257
263
|
var $;
|
|
@@ -260,15 +266,15 @@ var $;
|
|
|
260
266
|
$.$mol_jsx_booked = null;
|
|
261
267
|
$.$mol_jsx_document = {
|
|
262
268
|
getElementById: () => null,
|
|
263
|
-
createElementNS: (space, name) =>
|
|
264
|
-
createDocumentFragment: () =>
|
|
269
|
+
createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
|
|
270
|
+
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
265
271
|
};
|
|
266
272
|
$.$mol_jsx_frag = '';
|
|
267
273
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
268
274
|
const id = props && props.id || '';
|
|
269
275
|
if (Elem && $.$mol_jsx_booked) {
|
|
270
276
|
if ($.$mol_jsx_booked.has(id)) {
|
|
271
|
-
|
|
277
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(id)}`));
|
|
272
278
|
}
|
|
273
279
|
else {
|
|
274
280
|
$.$mol_jsx_booked.add(id);
|
|
@@ -307,7 +313,7 @@ var $;
|
|
|
307
313
|
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
308
314
|
: $.$mol_jsx_document.createDocumentFragment();
|
|
309
315
|
}
|
|
310
|
-
|
|
316
|
+
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
311
317
|
if (!Elem)
|
|
312
318
|
return node;
|
|
313
319
|
for (const key in props) {
|
|
@@ -333,77 +339,77 @@ var $;
|
|
|
333
339
|
}
|
|
334
340
|
$.$mol_jsx = $mol_jsx;
|
|
335
341
|
})($ || ($ = {}));
|
|
336
|
-
//jsx.
|
|
342
|
+
//mol/jsx/jsx.ts
|
|
337
343
|
;
|
|
338
344
|
"use strict";
|
|
339
345
|
var $;
|
|
340
346
|
(function ($) {
|
|
341
|
-
|
|
347
|
+
$mol_test({
|
|
342
348
|
'nulls & undefineds'() {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
349
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
350
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
351
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
352
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
347
353
|
},
|
|
348
354
|
'number'() {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
355
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
356
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
357
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
358
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
359
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
354
360
|
},
|
|
355
361
|
'POJO'() {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
363
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
364
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
365
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
366
|
+
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
367
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
362
368
|
},
|
|
363
369
|
'Array'() {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
370
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
371
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
372
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
373
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
368
374
|
},
|
|
369
375
|
'Non POJO are different'() {
|
|
370
376
|
class Thing extends Object {
|
|
371
377
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
378
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
379
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
380
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
375
381
|
},
|
|
376
382
|
'same POJOs with cyclic reference'() {
|
|
377
383
|
const a = { foo: {} };
|
|
378
384
|
a['self'] = a;
|
|
379
385
|
const b = { foo: {} };
|
|
380
386
|
b['self'] = b;
|
|
381
|
-
|
|
387
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
382
388
|
},
|
|
383
389
|
'Date'() {
|
|
384
|
-
|
|
385
|
-
|
|
390
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
391
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
386
392
|
},
|
|
387
393
|
'RegExp'() {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
394
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
395
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
396
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
391
397
|
},
|
|
392
398
|
'Map'() {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
399
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
400
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
401
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
402
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
397
403
|
},
|
|
398
404
|
'Set'() {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
405
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
406
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
407
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
402
408
|
},
|
|
403
409
|
'Uint8Array'() {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
410
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
411
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
412
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
407
413
|
},
|
|
408
414
|
'Custom comparator'() {
|
|
409
415
|
class User {
|
|
@@ -417,17 +423,17 @@ var $;
|
|
|
417
423
|
return this.name;
|
|
418
424
|
}
|
|
419
425
|
}
|
|
420
|
-
|
|
421
|
-
|
|
426
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
427
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
422
428
|
},
|
|
423
429
|
});
|
|
424
430
|
})($ || ($ = {}));
|
|
425
|
-
//deep.test.
|
|
431
|
+
//mol/compare/deep/deep.test.tsx
|
|
426
432
|
;
|
|
427
433
|
"use strict";
|
|
428
434
|
var $;
|
|
429
435
|
(function ($) {
|
|
430
|
-
|
|
436
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
431
437
|
function $mol_compare_deep(left, right) {
|
|
432
438
|
if (Object.is(left, right))
|
|
433
439
|
return true;
|
|
@@ -453,7 +459,7 @@ var $;
|
|
|
453
459
|
return Object.is(left.valueOf(), right['valueOf']());
|
|
454
460
|
if (left instanceof RegExp)
|
|
455
461
|
return left.source === right['source'] && left.flags === right['flags'];
|
|
456
|
-
let left_cache =
|
|
462
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
457
463
|
if (left_cache) {
|
|
458
464
|
const right_cache = left_cache.get(right);
|
|
459
465
|
if (typeof right_cache === 'boolean')
|
|
@@ -461,7 +467,7 @@ var $;
|
|
|
461
467
|
}
|
|
462
468
|
else {
|
|
463
469
|
left_cache = new WeakMap([[right, true]]);
|
|
464
|
-
|
|
470
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
465
471
|
}
|
|
466
472
|
let result;
|
|
467
473
|
try {
|
|
@@ -545,50 +551,50 @@ var $;
|
|
|
545
551
|
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
546
552
|
}
|
|
547
553
|
})($ || ($ = {}));
|
|
548
|
-
//deep.
|
|
554
|
+
//mol/compare/deep/deep.ts
|
|
549
555
|
;
|
|
550
556
|
"use strict";
|
|
551
557
|
var $;
|
|
552
558
|
(function ($) {
|
|
553
559
|
function $mol_dom_serialize(node) {
|
|
554
|
-
const serializer = new
|
|
560
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
555
561
|
return serializer.serializeToString(node);
|
|
556
562
|
}
|
|
557
563
|
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
558
564
|
})($ || ($ = {}));
|
|
559
|
-
//serialize.
|
|
565
|
+
//mol/dom/serialize/serialize.ts
|
|
560
566
|
;
|
|
561
567
|
"use strict";
|
|
562
568
|
var $;
|
|
563
569
|
(function ($) {
|
|
564
|
-
|
|
570
|
+
$mol_test({
|
|
565
571
|
'must be false'() {
|
|
566
|
-
|
|
572
|
+
$mol_assert_not(0);
|
|
567
573
|
},
|
|
568
574
|
'must be true'() {
|
|
569
|
-
|
|
575
|
+
$mol_assert_ok(1);
|
|
570
576
|
},
|
|
571
577
|
'two must be equal'() {
|
|
572
|
-
|
|
578
|
+
$mol_assert_equal(2, 2);
|
|
573
579
|
},
|
|
574
580
|
'three must be equal'() {
|
|
575
|
-
|
|
581
|
+
$mol_assert_equal(2, 2, 2);
|
|
576
582
|
},
|
|
577
583
|
'two must be unique'() {
|
|
578
|
-
|
|
584
|
+
$mol_assert_unique([3], [3]);
|
|
579
585
|
},
|
|
580
586
|
'three must be unique'() {
|
|
581
|
-
|
|
587
|
+
$mol_assert_unique([3], [3], [3]);
|
|
582
588
|
},
|
|
583
589
|
'two must be alike'() {
|
|
584
|
-
|
|
590
|
+
$mol_assert_like([3], [3]);
|
|
585
591
|
},
|
|
586
592
|
'three must be alike'() {
|
|
587
|
-
|
|
593
|
+
$mol_assert_like([3], [3], [3]);
|
|
588
594
|
},
|
|
589
595
|
});
|
|
590
596
|
})($ || ($ = {}));
|
|
591
|
-
//assert.test.
|
|
597
|
+
//mol/assert/assert.test.ts
|
|
592
598
|
;
|
|
593
599
|
"use strict";
|
|
594
600
|
var $;
|
|
@@ -596,13 +602,13 @@ var $;
|
|
|
596
602
|
function $mol_assert_ok(value) {
|
|
597
603
|
if (value)
|
|
598
604
|
return;
|
|
599
|
-
|
|
605
|
+
$mol_fail(new Error(`${value} ≠ true`));
|
|
600
606
|
}
|
|
601
607
|
$.$mol_assert_ok = $mol_assert_ok;
|
|
602
608
|
function $mol_assert_not(value) {
|
|
603
609
|
if (!value)
|
|
604
610
|
return;
|
|
605
|
-
|
|
611
|
+
$mol_fail(new Error(`${value} ≠ false`));
|
|
606
612
|
}
|
|
607
613
|
$.$mol_assert_not = $mol_assert_not;
|
|
608
614
|
function $mol_assert_fail(handler, ErrorRight) {
|
|
@@ -626,7 +632,7 @@ var $;
|
|
|
626
632
|
finally {
|
|
627
633
|
$.$mol_fail = fail;
|
|
628
634
|
}
|
|
629
|
-
|
|
635
|
+
$mol_fail(new Error('Not failed'));
|
|
630
636
|
}
|
|
631
637
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
632
638
|
function $mol_assert_equal(...args) {
|
|
@@ -637,7 +643,7 @@ var $;
|
|
|
637
643
|
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
638
644
|
continue;
|
|
639
645
|
if (args[i] !== args[j])
|
|
640
|
-
|
|
646
|
+
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
641
647
|
}
|
|
642
648
|
}
|
|
643
649
|
}
|
|
@@ -648,7 +654,7 @@ var $;
|
|
|
648
654
|
if (i === j)
|
|
649
655
|
continue;
|
|
650
656
|
if (args[i] === args[j] || (Number.isNaN(args[i]) && Number.isNaN(args[j]))) {
|
|
651
|
-
|
|
657
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
652
658
|
}
|
|
653
659
|
}
|
|
654
660
|
}
|
|
@@ -656,7 +662,7 @@ var $;
|
|
|
656
662
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
657
663
|
function $mol_assert_like(head, ...tail) {
|
|
658
664
|
for (let [index, value] of Object.entries(tail)) {
|
|
659
|
-
if (
|
|
665
|
+
if (!$mol_compare_deep(value, head)) {
|
|
660
666
|
const print = (val) => {
|
|
661
667
|
if (!val)
|
|
662
668
|
return val;
|
|
@@ -672,118 +678,118 @@ var $;
|
|
|
672
678
|
return val;
|
|
673
679
|
}
|
|
674
680
|
};
|
|
675
|
-
return
|
|
681
|
+
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
676
682
|
}
|
|
677
683
|
}
|
|
678
684
|
}
|
|
679
685
|
$.$mol_assert_like = $mol_assert_like;
|
|
680
686
|
function $mol_assert_dom(left, right) {
|
|
681
|
-
$mol_assert_equal(
|
|
687
|
+
$mol_assert_equal($mol_dom_serialize(left), $mol_dom_serialize(right));
|
|
682
688
|
}
|
|
683
689
|
$.$mol_assert_dom = $mol_assert_dom;
|
|
684
690
|
})($ || ($ = {}));
|
|
685
|
-
//assert.
|
|
691
|
+
//mol/assert/assert.ts
|
|
686
692
|
;
|
|
687
693
|
"use strict";
|
|
688
694
|
var $;
|
|
689
695
|
(function ($) {
|
|
690
|
-
|
|
696
|
+
$mol_test({
|
|
691
697
|
'parse and serial'() {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
698
|
+
$mol_assert_equal(new $mol_time_duration('P42.1Y').toString(), 'P42.1YT');
|
|
699
|
+
$mol_assert_equal(new $mol_time_duration('P42.1M').toString(), 'P42.1MT');
|
|
700
|
+
$mol_assert_equal(new $mol_time_duration('P42.1D').toString(), 'P42.1DT');
|
|
701
|
+
$mol_assert_equal(new $mol_time_duration('PT42.1h').toString(), 'PT42.1H');
|
|
702
|
+
$mol_assert_equal(new $mol_time_duration('PT42.1m').toString(), 'PT42.1M');
|
|
703
|
+
$mol_assert_equal(new $mol_time_duration('PT42.1s').toString(), 'PT42.1S');
|
|
704
|
+
$mol_assert_equal(new $mol_time_duration('P1Y2M3DT4h5m6.7s').toString(), 'P1Y2M3DT4H5M6.7S');
|
|
699
705
|
},
|
|
700
706
|
'format typed'() {
|
|
701
|
-
|
|
707
|
+
$mol_assert_equal(new $mol_time_duration('P1Y2M3DT4h5m6s').toString('P#Y#M#DT#h#m#s'), 'P1Y2M3DT4H5M6S');
|
|
702
708
|
},
|
|
703
709
|
'comparison'() {
|
|
704
710
|
const iso = 'P1Y1M1DT1h1m1s';
|
|
705
|
-
|
|
711
|
+
$mol_assert_like(new $mol_time_duration(iso), new $mol_time_duration(iso));
|
|
706
712
|
},
|
|
707
713
|
});
|
|
708
714
|
})($ || ($ = {}));
|
|
709
|
-
//duration.test.
|
|
715
|
+
//mol/time/duration/duration.test.ts
|
|
710
716
|
;
|
|
711
717
|
"use strict";
|
|
712
718
|
var $;
|
|
713
719
|
(function ($) {
|
|
714
|
-
|
|
720
|
+
$mol_test({
|
|
715
721
|
'parse and serial'() {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
722
|
+
$mol_assert_equal(new $mol_time_moment('2014').toString(), '2014');
|
|
723
|
+
$mol_assert_equal(new $mol_time_moment('2014-01').toString(), '2014-01');
|
|
724
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02').toString(), '2014-01-02');
|
|
725
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03').toString(), '2014-01-02T03');
|
|
726
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04').toString(), '2014-01-02T03:04');
|
|
727
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04:05').toString(), '2014-01-02T03:04:05');
|
|
728
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04:05.006').toString(), '2014-01-02T03:04:05.006');
|
|
729
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04:05.006Z').toString(), '2014-01-02T03:04:05.006+00:00');
|
|
730
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04:05.006+07:00').toString(), '2014-01-02T03:04:05.006+07:00');
|
|
731
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04:05+07:08').toString(), '2014-01-02T03:04:05+07:08');
|
|
732
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T03:04+07:08').toString(), '2014-01-02T03:04+07:08');
|
|
733
|
+
$mol_assert_equal(new $mol_time_moment('T03:04+07:08').toString(), 'T03:04+07:08');
|
|
734
|
+
$mol_assert_equal(new $mol_time_moment('T03:04:05').toString(), 'T03:04:05');
|
|
735
|
+
$mol_assert_equal(new $mol_time_moment('T03:04').toString(), 'T03:04');
|
|
736
|
+
$mol_assert_equal(new $mol_time_moment('T03').toString(), 'T03');
|
|
731
737
|
},
|
|
732
738
|
'format simple'() {
|
|
733
|
-
|
|
739
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T01:02:03.000000').toString('AD YY-M-D h:m:s'), '21 14-1-2 1:2:3');
|
|
734
740
|
},
|
|
735
741
|
'format padded'() {
|
|
736
|
-
|
|
742
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T01:02:03.000').toString('YYYY-MM-DD hh:mm:ss'), '2014-01-02 01:02:03');
|
|
737
743
|
},
|
|
738
744
|
'format time zone'() {
|
|
739
|
-
|
|
745
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02T01:02:03+05:00').toString('Z'), '+05:00');
|
|
740
746
|
},
|
|
741
747
|
'format names'() {
|
|
742
|
-
|
|
748
|
+
$mol_assert_ok(new $mol_time_moment('2014-01-02T01:02:03.000').toString('Month Mon | WeekDay WD'));
|
|
743
749
|
},
|
|
744
750
|
'shifting'() {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
751
|
+
$mol_assert_equal(new $mol_time_moment('T15:54:58.243+03:00').shift({}).toString(), 'T15:54:58.243+03:00');
|
|
752
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02').shift('P1Y').toString(), '2015-01-02');
|
|
753
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02').shift('P12M').toString(), '2015-01-02');
|
|
754
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02').shift('P365D').toString(), '2015-01-02');
|
|
755
|
+
$mol_assert_equal(new $mol_time_moment('2014-01-02').shift('PT8760h').toString(), '2015-01-02');
|
|
756
|
+
$mol_assert_equal(new $mol_time_moment('2014-01').shift('PT8760h').toString(), '2015-01');
|
|
757
|
+
$mol_assert_equal(new $mol_time_moment('2014-01').shift('PT-8760h').toString(), '2013-01');
|
|
752
758
|
},
|
|
753
759
|
'normalization'() {
|
|
754
|
-
|
|
760
|
+
$mol_assert_equal(new $mol_time_moment({ year: 2015, month: 6, day: 34 }).normal.toString(), '2015-08-04');
|
|
755
761
|
},
|
|
756
762
|
'iso week day'() {
|
|
757
|
-
|
|
758
|
-
|
|
763
|
+
$mol_assert_equal(new $mol_time_moment('2017-09-17').weekday, $mol_time_moment_weekdays.sunday);
|
|
764
|
+
$mol_assert_equal(new $mol_time_moment('2017-09-18').weekday, $mol_time_moment_weekdays.monday);
|
|
759
765
|
},
|
|
760
766
|
'change offset'() {
|
|
761
|
-
|
|
767
|
+
$mol_assert_equal(new $mol_time_moment('2021-04-10 +03:00').toOffset('Z').toString(), '2021-04-09T21:00:00+00:00');
|
|
762
768
|
},
|
|
763
769
|
'comparison'() {
|
|
764
770
|
const iso = '2021-01-02T03:04:05.678+09:10';
|
|
765
|
-
|
|
771
|
+
$mol_assert_like(new $mol_time_moment(iso), new $mol_time_moment(iso));
|
|
766
772
|
},
|
|
767
773
|
});
|
|
768
774
|
})($ || ($ = {}));
|
|
769
|
-
//moment.test.
|
|
775
|
+
//mol/time/moment/moment.test.ts
|
|
770
776
|
;
|
|
771
777
|
"use strict";
|
|
772
778
|
var $;
|
|
773
779
|
(function ($) {
|
|
774
|
-
|
|
780
|
+
$mol_test({
|
|
775
781
|
'triplets'() {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
782
|
+
$mol_assert_equal(new $mol_time_interval('2015-01-01/P1M').end.toString(), '2015-02-01');
|
|
783
|
+
$mol_assert_equal(new $mol_time_interval('P1M/2015-02-01').start.toString(), '2015-01-01');
|
|
784
|
+
$mol_assert_equal(new $mol_time_interval('2015-01-01/2015-02-01').duration.toString(), 'PT2678400S');
|
|
779
785
|
},
|
|
780
786
|
'comparison'() {
|
|
781
787
|
const iso = '2021-01-02/2022-03-04';
|
|
782
|
-
|
|
788
|
+
$mol_assert_like(new $mol_time_interval(iso), new $mol_time_interval(iso));
|
|
783
789
|
},
|
|
784
790
|
});
|
|
785
791
|
})($ || ($ = {}));
|
|
786
|
-
//interval.test.
|
|
792
|
+
//mol/time/interval/interval.test.ts
|
|
787
793
|
;
|
|
788
794
|
"use strict";
|
|
789
795
|
var $;
|
|
@@ -807,18 +813,18 @@ var $;
|
|
|
807
813
|
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
808
814
|
$.$mol_log3_stack = [];
|
|
809
815
|
})($ || ($ = {}));
|
|
810
|
-
//log3.
|
|
816
|
+
//mol/log3/log3.ts
|
|
811
817
|
;
|
|
812
818
|
"use strict";
|
|
813
|
-
//extract.test.
|
|
819
|
+
//mol/type/keys/extract/extract.test.ts
|
|
814
820
|
;
|
|
815
821
|
"use strict";
|
|
816
|
-
//extract.
|
|
822
|
+
//mol/type/keys/extract/extract.ts
|
|
817
823
|
;
|
|
818
824
|
"use strict";
|
|
819
825
|
var $;
|
|
820
826
|
(function ($_1) {
|
|
821
|
-
$
|
|
827
|
+
$mol_test_mocks.push($ => {
|
|
822
828
|
$.$mol_log3_come = () => { };
|
|
823
829
|
$.$mol_log3_done = () => { };
|
|
824
830
|
$.$mol_log3_fail = () => { };
|
|
@@ -827,7 +833,7 @@ var $;
|
|
|
827
833
|
$.$mol_log3_area = () => () => { };
|
|
828
834
|
});
|
|
829
835
|
})($ || ($ = {}));
|
|
830
|
-
//log3.test.
|
|
836
|
+
//mol/log3/log3.test.ts
|
|
831
837
|
;
|
|
832
838
|
"use strict";
|
|
833
839
|
var $;
|
|
@@ -856,12 +862,12 @@ var $;
|
|
|
856
862
|
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
857
863
|
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
858
864
|
})($ || ($ = {}));
|
|
859
|
-
//log3.web.
|
|
865
|
+
//mol/log3/log3.web.ts
|
|
860
866
|
;
|
|
861
867
|
"use strict";
|
|
862
|
-
//equals.test.
|
|
868
|
+
//mol/type/equals/equals.test.ts
|
|
863
869
|
;
|
|
864
870
|
"use strict";
|
|
865
|
-
//equals.
|
|
871
|
+
//mol/type/equals/equals.ts
|
|
866
872
|
|
|
867
873
|
//# sourceMappingURL=web.test.js.map
|