mol_time_all 1.1.9 → 1.1.13

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/web.test.js CHANGED
@@ -1,119 +1,18 @@
1
1
  "use strict";
2
- var $;
3
- (function ($) {
4
- function $mol_log(path, ...values) {
5
- if ($.$mol_log_filter() == null)
6
- return;
7
- path = String(path);
8
- if (path.indexOf($.$mol_log_filter()) === -1)
9
- return;
10
- if ($.$mol_log_context())
11
- $.$mol_log_context()();
12
- console.debug(path, ...values);
13
- if ($.$mol_log_debug() == null)
14
- return;
15
- if (path.indexOf($.$mol_log_debug()) === -1)
16
- return;
17
- debugger;
18
- }
19
- $.$mol_log = $mol_log;
20
- })($ || ($ = {}));
21
- //log.js.map
22
- ;
23
- "use strict";
24
- var $;
25
- (function ($) {
26
- let context = null;
27
- function $mol_log_context(next = context) {
28
- return context = next;
29
- }
30
- $.$mol_log_context = $mol_log_context;
31
- })($ || ($ = {}));
32
- //log_context.js.map
33
- ;
34
- "use strict";
35
- var $;
36
- (function ($) {
37
- function $mol_log_debug(next) {
38
- if (next !== undefined) {
39
- if (next == null) {
40
- sessionStorage.removeItem('$mol_log_debug()');
41
- }
42
- else {
43
- sessionStorage.setItem('$mol_log_debug()', next);
44
- }
45
- }
46
- return sessionStorage.getItem('$mol_log_debug()');
47
- }
48
- $.$mol_log_debug = $mol_log_debug;
49
- })($ || ($ = {}));
50
- //log_debug.web.js.map
51
- ;
2
+ function require( path ){ return $node[ path ] };
52
3
  "use strict";
53
4
  var $;
54
5
  (function ($) {
55
- let filter;
56
- function $mol_log_filter(next) {
57
- if (next !== undefined) {
58
- if (next == null) {
59
- sessionStorage.removeItem('$mol_log_filter()');
60
- }
61
- else {
62
- sessionStorage.setItem('$mol_log_filter()', next);
63
- }
64
- filter = next;
65
- }
66
- if (filter !== undefined)
67
- return filter;
68
- return filter = sessionStorage.getItem('$mol_log_filter()');
6
+ function $mol_fail_hidden(error) {
7
+ throw error;
69
8
  }
70
- $.$mol_log_filter = $mol_log_filter;
71
- if ($mol_log_filter() == null)
72
- console.info('Use $mol_log_filter( needle : string|null ) to toggle logs');
9
+ $.$mol_fail_hidden = $mol_fail_hidden;
73
10
  })($ || ($ = {}));
74
- //log_filter.web.js.map
75
- ;
76
- "use strict";
77
- var $;
78
- (function ($) {
79
- function $mol_log_group(name, task) {
80
- return function $mol_log_group_wrapper(...args) {
81
- const filter = $.$mol_log_filter();
82
- if (filter == null)
83
- return task.apply(this, args);
84
- let started = false;
85
- let prev = $.$mol_log_context();
86
- $.$mol_log_context(() => {
87
- if (prev)
88
- prev();
89
- started = true;
90
- if (filter)
91
- console.group(name);
92
- else
93
- console.groupCollapsed(name);
94
- $.$mol_log_context(prev = null);
95
- });
96
- try {
97
- return task.apply(this, args);
98
- }
99
- finally {
100
- if (started)
101
- console.groupEnd();
102
- $.$mol_log_context(prev);
103
- }
104
- };
105
- }
106
- $.$mol_log_group = $mol_log_group;
107
- })($ || ($ = {}));
108
- //log_group.js.map
11
+ //hidden.js.map
109
12
  ;
110
13
  "use strict";
111
14
  var $;
112
15
  (function ($_1) {
113
- let $$;
114
- (function ($$) {
115
- let $;
116
- })($$ = $_1.$$ || ($_1.$$ = {}));
117
16
  function $mol_test(set) {
118
17
  for (let name in set) {
119
18
  const code = set[name];
@@ -125,13 +24,18 @@ var $;
125
24
  $_1.$mol_test = $mol_test;
126
25
  $_1.$mol_test_mocks = [];
127
26
  $_1.$mol_test_all = [];
128
- function $mol_test_run() {
27
+ async function $mol_test_run() {
129
28
  for (var test of $_1.$mol_test_all) {
130
- let context = Object.create($$);
29
+ let context = Object.create($_1.$$);
131
30
  for (let mock of $_1.$mol_test_mocks)
132
- mock(context);
133
- test(context);
31
+ await mock(context);
32
+ await test(context);
134
33
  }
34
+ $_1.$$.$mol_log3_done({
35
+ place: '$mol_test',
36
+ message: 'All tests passed',
37
+ count: $_1.$mol_test_all.length,
38
+ });
135
39
  }
136
40
  $_1.$mol_test_run = $mol_test_run;
137
41
  let scheduled = false;
@@ -139,10 +43,15 @@ var $;
139
43
  if (scheduled)
140
44
  return;
141
45
  scheduled = true;
142
- setTimeout($_1.$mol_log_group('$mol_test_run()', () => {
46
+ setTimeout(async () => {
143
47
  scheduled = false;
144
- $mol_test_run();
145
- }));
48
+ try {
49
+ await $mol_test_run();
50
+ }
51
+ finally {
52
+ $_1.$$.$mol_test_complete();
53
+ }
54
+ }, 0);
146
55
  }
147
56
  $_1.$mol_test_schedule = $mol_test_schedule;
148
57
  $_1.$mol_test_mocks.push(context => {
@@ -153,10 +62,10 @@ var $;
153
62
  for (let api of forbidden) {
154
63
  context[api] = new Proxy(function () { }, {
155
64
  get() {
156
- throw new Error(`${api} is forbidden in tests`);
65
+ $_1.$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
157
66
  },
158
67
  apply() {
159
- throw new Error(`${api} is forbidden in tests`);
68
+ $_1.$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
160
69
  },
161
70
  });
162
71
  }
@@ -188,6 +97,463 @@ var $;
188
97
  ;
189
98
  "use strict";
190
99
  var $;
100
+ (function ($) {
101
+ function $mol_test_complete() {
102
+ }
103
+ $.$mol_test_complete = $mol_test_complete;
104
+ })($ || ($ = {}));
105
+ //test.web.test.js.map
106
+ ;
107
+ "use strict";
108
+ var $;
109
+ (function ($) {
110
+ })($ || ($ = {}));
111
+ //context.js.map
112
+ ;
113
+ "use strict";
114
+ var $;
115
+ (function ($) {
116
+ $.$mol_dom_context = self;
117
+ })($ || ($ = {}));
118
+ //context.web.js.map
119
+ ;
120
+ "use strict";
121
+ var $;
122
+ (function ($) {
123
+ function $mol_dom_render_children(el, childNodes) {
124
+ const node_set = new Set(childNodes);
125
+ let nextNode = el.firstChild;
126
+ for (let view of childNodes) {
127
+ if (view == null)
128
+ continue;
129
+ if (view instanceof $.$mol_dom_context.Node) {
130
+ while (true) {
131
+ if (!nextNode) {
132
+ el.appendChild(view);
133
+ break;
134
+ }
135
+ if (nextNode == view) {
136
+ nextNode = nextNode.nextSibling;
137
+ break;
138
+ }
139
+ else {
140
+ if (node_set.has(nextNode)) {
141
+ el.insertBefore(view, nextNode);
142
+ break;
143
+ }
144
+ else {
145
+ const nn = nextNode.nextSibling;
146
+ el.removeChild(nextNode);
147
+ nextNode = nn;
148
+ }
149
+ }
150
+ }
151
+ }
152
+ else {
153
+ if (nextNode && nextNode.nodeName === '#text') {
154
+ const str = String(view);
155
+ if (nextNode.nodeValue !== str)
156
+ nextNode.nodeValue = str;
157
+ nextNode = nextNode.nextSibling;
158
+ }
159
+ else {
160
+ const textNode = $.$mol_dom_context.document.createTextNode(String(view));
161
+ el.insertBefore(textNode, nextNode);
162
+ }
163
+ }
164
+ }
165
+ while (nextNode) {
166
+ const currNode = nextNode;
167
+ nextNode = currNode.nextSibling;
168
+ el.removeChild(currNode);
169
+ }
170
+ }
171
+ $.$mol_dom_render_children = $mol_dom_render_children;
172
+ })($ || ($ = {}));
173
+ //children.js.map
174
+ ;
175
+ "use strict";
176
+ //error.js.map
177
+ ;
178
+ "use strict";
179
+ //assert.test.js.map
180
+ ;
181
+ "use strict";
182
+ //assert.js.map
183
+ ;
184
+ "use strict";
185
+ //deep.test.js.map
186
+ ;
187
+ "use strict";
188
+ //deep.js.map
189
+ ;
190
+ "use strict";
191
+ var $;
192
+ (function ($) {
193
+ $.$mol_test({
194
+ 'Make empty div'() {
195
+ $.$mol_assert_equal(($.$mol_jsx("div", null)).outerHTML, '<div></div>');
196
+ },
197
+ 'Define native field'() {
198
+ const dom = $.$mol_jsx("input", { value: '123' });
199
+ $.$mol_assert_equal(dom.outerHTML, '<input value="123">');
200
+ $.$mol_assert_equal(dom.value, '123');
201
+ },
202
+ 'Define classes'() {
203
+ const dom = $.$mol_jsx("div", { class: 'foo bar' });
204
+ $.$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
205
+ },
206
+ 'Define styles'() {
207
+ const dom = $.$mol_jsx("div", { style: { color: 'red' } });
208
+ $.$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
209
+ },
210
+ 'Define dataset'() {
211
+ const dom = $.$mol_jsx("div", { dataset: { foo: 'bar' } });
212
+ $.$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
213
+ },
214
+ 'Define attributes'() {
215
+ const dom = $.$mol_jsx("div", { lang: "ru", hidden: true });
216
+ $.$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
217
+ },
218
+ 'Define child nodes'() {
219
+ const dom = $.$mol_jsx("div", null,
220
+ "hello",
221
+ $.$mol_jsx("strong", null, "world"),
222
+ "!");
223
+ $.$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
224
+ },
225
+ 'Function as component'() {
226
+ const Button = ({ hint }, target) => {
227
+ return $.$mol_jsx("button", { title: hint }, target());
228
+ };
229
+ const dom = $.$mol_jsx(Button, { id: "/foo", hint: "click me" }, () => 'hey!');
230
+ $.$mol_assert_equal(dom.outerHTML, '<button title="click me" id="/foo">hey!</button>');
231
+ },
232
+ 'Nested guid generation'() {
233
+ const Foo = () => {
234
+ return $.$mol_jsx("div", null,
235
+ $.$mol_jsx(Bar, { id: "/bar" },
236
+ $.$mol_jsx("img", { id: "/icon" })));
237
+ };
238
+ const Bar = (props, icon) => {
239
+ return $.$mol_jsx("span", null, icon);
240
+ };
241
+ const dom = $.$mol_jsx(Foo, { id: "/foo" });
242
+ $.$mol_assert_equal(dom.outerHTML, '<div id="/foo"><span id="/foo/bar"><img id="/foo/icon"></span></div>');
243
+ },
244
+ 'Fail on non unique ids'() {
245
+ const App = () => {
246
+ return $.$mol_jsx("div", null,
247
+ $.$mol_jsx("span", { id: "/bar" }),
248
+ $.$mol_jsx("span", { id: "/bar" }));
249
+ };
250
+ $.$mol_assert_fail(() => $.$mol_jsx(App, { id: "/foo" }), 'JSX already has tag with id "/bar"');
251
+ },
252
+ });
253
+ })($ || ($ = {}));
254
+ //jsx.test.js.map
255
+ ;
256
+ "use strict";
257
+ var $;
258
+ (function ($) {
259
+ $.$mol_jsx_prefix = '';
260
+ $.$mol_jsx_booked = null;
261
+ $.$mol_jsx_document = {
262
+ getElementById: () => null,
263
+ createElementNS: (space, name) => $.$mol_dom_context.document.createElementNS(space, name),
264
+ createDocumentFragment: () => $.$mol_dom_context.document.createDocumentFragment(),
265
+ };
266
+ $.$mol_jsx_frag = '';
267
+ function $mol_jsx(Elem, props, ...childNodes) {
268
+ const id = props && props.id || '';
269
+ if (Elem && $.$mol_jsx_booked) {
270
+ if ($.$mol_jsx_booked.has(id)) {
271
+ $.$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(id)}`));
272
+ }
273
+ else {
274
+ $.$mol_jsx_booked.add(id);
275
+ }
276
+ }
277
+ const guid = $.$mol_jsx_prefix + id;
278
+ let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
279
+ if (typeof Elem !== 'string') {
280
+ if ('prototype' in Elem) {
281
+ const view = node && node[Elem] || new Elem;
282
+ Object.assign(view, props);
283
+ view[Symbol.toStringTag] = guid;
284
+ view.childNodes = childNodes;
285
+ if (!view.ownerDocument)
286
+ view.ownerDocument = $.$mol_jsx_document;
287
+ node = view.valueOf();
288
+ node[Elem] = view;
289
+ return node;
290
+ }
291
+ else {
292
+ const prefix = $.$mol_jsx_prefix;
293
+ const booked = $.$mol_jsx_booked;
294
+ try {
295
+ $.$mol_jsx_prefix = guid;
296
+ $.$mol_jsx_booked = new Set;
297
+ return Elem(props, ...childNodes);
298
+ }
299
+ finally {
300
+ $.$mol_jsx_prefix = prefix;
301
+ $.$mol_jsx_booked = booked;
302
+ }
303
+ }
304
+ }
305
+ if (!node) {
306
+ node = Elem
307
+ ? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
308
+ : $.$mol_jsx_document.createDocumentFragment();
309
+ }
310
+ $.$mol_dom_render_children(node, [].concat(...childNodes));
311
+ if (!Elem)
312
+ return node;
313
+ for (const key in props) {
314
+ if (typeof props[key] === 'string') {
315
+ ;
316
+ node.setAttribute(key, props[key]);
317
+ }
318
+ else if (props[key] &&
319
+ typeof props[key] === 'object' &&
320
+ Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
321
+ if (typeof node[key] === 'object') {
322
+ Object.assign(node[key], props[key]);
323
+ continue;
324
+ }
325
+ }
326
+ else {
327
+ node[key] = props[key];
328
+ }
329
+ }
330
+ if (guid)
331
+ node.id = guid;
332
+ return node;
333
+ }
334
+ $.$mol_jsx = $mol_jsx;
335
+ })($ || ($ = {}));
336
+ //jsx.js.map
337
+ ;
338
+ "use strict";
339
+ var $;
340
+ (function ($) {
341
+ $.$mol_test({
342
+ 'nulls & undefineds'() {
343
+ $.$mol_assert_ok($.$mol_compare_deep(null, null));
344
+ $.$mol_assert_ok($.$mol_compare_deep(undefined, undefined));
345
+ $.$mol_assert_not($.$mol_compare_deep(undefined, null));
346
+ $.$mol_assert_not($.$mol_compare_deep({}, null));
347
+ },
348
+ 'number'() {
349
+ $.$mol_assert_ok($.$mol_compare_deep(1, 1));
350
+ $.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
351
+ $.$mol_assert_not($.$mol_compare_deep(1, 2));
352
+ },
353
+ 'Number'() {
354
+ $.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
355
+ $.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
356
+ $.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
357
+ },
358
+ 'empty POJOs'() {
359
+ $.$mol_assert_ok($.$mol_compare_deep({}, {}));
360
+ },
361
+ 'different POJOs'() {
362
+ $.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
363
+ },
364
+ 'different POJOs with same keys but different values'() {
365
+ $.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
366
+ },
367
+ 'different POJOs with different keys but same values'() {
368
+ $.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
369
+ },
370
+ 'Array'() {
371
+ $.$mol_assert_ok($.$mol_compare_deep([], []));
372
+ $.$mol_assert_ok($.$mol_compare_deep([1, [2]], [1, [2]]));
373
+ $.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
374
+ $.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
375
+ },
376
+ 'same POJO trees'() {
377
+ $.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
378
+ },
379
+ 'different classes with same values'() {
380
+ class Obj {
381
+ foo = 1;
382
+ }
383
+ const a = new Obj;
384
+ const b = new class extends Obj {
385
+ };
386
+ $.$mol_assert_not($.$mol_compare_deep(a, b));
387
+ },
388
+ 'same POJOs with cyclic reference'() {
389
+ const a = { foo: {} };
390
+ a['self'] = a;
391
+ const b = { foo: {} };
392
+ b['self'] = b;
393
+ $.$mol_assert_ok($.$mol_compare_deep(a, b));
394
+ },
395
+ 'empty Element'() {
396
+ $.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("div", null)));
397
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("span", null)));
398
+ },
399
+ 'Element with attributes'() {
400
+ $.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "rtl" })));
401
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", null)));
402
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "ltr" })));
403
+ },
404
+ 'Element with styles'() {
405
+ $.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'red' } })));
406
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: {} })));
407
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'blue' } })));
408
+ },
409
+ 'Element with content'() {
410
+ $.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null,
411
+ "foo",
412
+ $.$mol_jsx("br", null)), $.$mol_jsx("div", null,
413
+ "foo",
414
+ $.$mol_jsx("br", null))));
415
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
416
+ "foo",
417
+ $.$mol_jsx("br", null)), $.$mol_jsx("div", null,
418
+ "bar",
419
+ $.$mol_jsx("br", null))));
420
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
421
+ "foo",
422
+ $.$mol_jsx("br", null)), $.$mol_jsx("div", null,
423
+ "foo",
424
+ $.$mol_jsx("hr", null))));
425
+ },
426
+ 'Element with handlers'() {
427
+ $.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 1 })));
428
+ $.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 2 })));
429
+ },
430
+ 'Date'() {
431
+ $.$mol_assert_ok($.$mol_compare_deep(new Date(12345), new Date(12345)));
432
+ $.$mol_assert_not($.$mol_compare_deep(new Date(12345), new Date(12346)));
433
+ },
434
+ 'RegExp'() {
435
+ $.$mol_assert_ok($.$mol_compare_deep(/\x22/mig, /\x22/mig));
436
+ $.$mol_assert_not($.$mol_compare_deep(/\x22/mig, /\x21/mig));
437
+ $.$mol_assert_not($.$mol_compare_deep(/\x22/mig, /\x22/mg));
438
+ },
439
+ 'Map'() {
440
+ $.$mol_assert_ok($.$mol_compare_deep(new Map, new Map));
441
+ $.$mol_assert_ok($.$mol_compare_deep(new Map([[[1], [2]]]), new Map([[[1], [2]]])));
442
+ $.$mol_assert_not($.$mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
443
+ },
444
+ 'Set'() {
445
+ $.$mol_assert_ok($.$mol_compare_deep(new Set, new Set));
446
+ $.$mol_assert_ok($.$mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
447
+ $.$mol_assert_not($.$mol_compare_deep(new Set([1]), new Set([2])));
448
+ },
449
+ 'Uint8Array'() {
450
+ $.$mol_assert_ok($.$mol_compare_deep(new Uint8Array, new Uint8Array));
451
+ $.$mol_assert_ok($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
452
+ $.$mol_assert_not($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
453
+ },
454
+ });
455
+ })($ || ($ = {}));
456
+ //deep.test.js.map
457
+ ;
458
+ "use strict";
459
+ var $;
460
+ (function ($) {
461
+ const a_stack = [];
462
+ const b_stack = [];
463
+ let cache = null;
464
+ function $mol_compare_deep(a, b) {
465
+ if (Object.is(a, b))
466
+ return true;
467
+ const a_type = typeof a;
468
+ const b_type = typeof b;
469
+ if (a_type !== b_type)
470
+ return false;
471
+ if (a_type === 'function')
472
+ return a['toString']() === b['toString']();
473
+ if (a_type !== 'object')
474
+ return false;
475
+ if (!a || !b)
476
+ return false;
477
+ if (a instanceof Error)
478
+ return false;
479
+ if (a['constructor'] !== b['constructor'])
480
+ return false;
481
+ if (a instanceof RegExp)
482
+ return a.toString() === b['toString']();
483
+ const ref = a_stack.indexOf(a);
484
+ if (ref >= 0) {
485
+ return Object.is(b_stack[ref], b);
486
+ }
487
+ if (!cache)
488
+ cache = new WeakMap;
489
+ let a_cache = cache.get(a);
490
+ if (a_cache) {
491
+ const b_cache = a_cache.get(b);
492
+ if (typeof b_cache === 'boolean')
493
+ return b_cache;
494
+ }
495
+ else {
496
+ a_cache = new WeakMap();
497
+ cache.set(a, a_cache);
498
+ }
499
+ a_stack.push(a);
500
+ b_stack.push(b);
501
+ let result;
502
+ try {
503
+ if (Symbol.iterator in a) {
504
+ const a_iter = a[Symbol.iterator]();
505
+ const b_iter = b[Symbol.iterator]();
506
+ while (true) {
507
+ const a_next = a_iter.next();
508
+ const b_next = b_iter.next();
509
+ if (a_next.done !== b_next.done)
510
+ return result = false;
511
+ if (a_next.done)
512
+ break;
513
+ if (!$mol_compare_deep(a_next.value, b_next.value))
514
+ return result = false;
515
+ }
516
+ return result = true;
517
+ }
518
+ let count = 0;
519
+ for (let key in a) {
520
+ try {
521
+ if (!$mol_compare_deep(a[key], b[key]))
522
+ return result = false;
523
+ }
524
+ catch (error) {
525
+ $.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${a} and ${b}`, error));
526
+ }
527
+ ++count;
528
+ }
529
+ for (let key in b) {
530
+ --count;
531
+ if (count < 0)
532
+ return result = false;
533
+ }
534
+ if (a instanceof Number || a instanceof String || a instanceof Symbol || a instanceof Boolean || a instanceof Date) {
535
+ if (!Object.is(a['valueOf'](), b['valueOf']()))
536
+ return result = false;
537
+ }
538
+ return result = true;
539
+ }
540
+ finally {
541
+ a_stack.pop();
542
+ b_stack.pop();
543
+ if (a_stack.length === 0) {
544
+ cache = null;
545
+ }
546
+ else {
547
+ a_cache.set(b, result);
548
+ }
549
+ }
550
+ }
551
+ $.$mol_compare_deep = $mol_compare_deep;
552
+ })($ || ($ = {}));
553
+ //deep.js.map
554
+ ;
555
+ "use strict";
556
+ var $;
191
557
  (function ($) {
192
558
  $.$mol_test({
193
559
  'must be false'() {
@@ -208,6 +574,12 @@ var $;
208
574
  'three must be unique'() {
209
575
  $.$mol_assert_unique([3], [3], [3]);
210
576
  },
577
+ 'two must be alike'() {
578
+ $.$mol_assert_like([3], [3]);
579
+ },
580
+ 'three must be alike'() {
581
+ $.$mol_assert_like([3], [3], [3]);
582
+ },
211
583
  });
212
584
  })($ || ($ = {}));
213
585
  //assert.test.js.map
@@ -218,26 +590,37 @@ var $;
218
590
  function $mol_assert_ok(value) {
219
591
  if (value)
220
592
  return;
221
- throw new Error(`Not true (${value})`);
593
+ $.$mol_fail(new Error(`${value} ≠ true`));
222
594
  }
223
595
  $.$mol_assert_ok = $mol_assert_ok;
224
596
  function $mol_assert_not(value) {
225
597
  if (!value)
226
598
  return;
227
- throw new Error(`Not false (${value})`);
599
+ $.$mol_fail(new Error(`${value} ≠ false`));
228
600
  }
229
601
  $.$mol_assert_not = $mol_assert_not;
230
602
  function $mol_assert_fail(handler, ErrorRight) {
603
+ const fail = $.$mol_fail;
231
604
  try {
605
+ $.$mol_fail = $.$mol_fail_hidden;
232
606
  handler();
233
607
  }
234
608
  catch (error) {
235
- if (ErrorRight)
236
- if (!(error instanceof ErrorRight))
237
- throw error;
609
+ if (!ErrorRight)
610
+ return error;
611
+ $.$mol_fail = fail;
612
+ if (typeof ErrorRight === 'string') {
613
+ $mol_assert_equal(error.message, ErrorRight);
614
+ }
615
+ else {
616
+ $mol_assert_ok(error instanceof ErrorRight);
617
+ }
238
618
  return error;
239
619
  }
240
- throw new Error('Not failed');
620
+ finally {
621
+ $.$mol_fail = fail;
622
+ }
623
+ $.$mol_fail(new Error('Not failed'));
241
624
  }
242
625
  $.$mol_assert_fail = $mol_assert_fail;
243
626
  function $mol_assert_equal(...args) {
@@ -248,7 +631,7 @@ var $;
248
631
  if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
249
632
  continue;
250
633
  if (args[i] !== args[j])
251
- throw new Error(`Not equal (${args[i]}!==${args[j]})`);
634
+ $.$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
252
635
  }
253
636
  }
254
637
  }
@@ -259,12 +642,35 @@ var $;
259
642
  if (i === j)
260
643
  continue;
261
644
  if (args[i] === args[j] || (Number.isNaN(args[i]) && Number.isNaN(args[j]))) {
262
- throw new Error(`Not unique (args[${i}]===args[${j}])===${args[i]}`);
645
+ $.$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
263
646
  }
264
647
  }
265
648
  }
266
649
  }
267
650
  $.$mol_assert_unique = $mol_assert_unique;
651
+ function $mol_assert_like(head, ...tail) {
652
+ for (let [index, value] of Object.entries(tail)) {
653
+ if (!$.$mol_compare_deep(value, head)) {
654
+ const print = (val) => {
655
+ if (!val)
656
+ return val;
657
+ if (typeof val !== 'object')
658
+ return val;
659
+ if ('outerHTML' in val)
660
+ return val.outerHTML;
661
+ try {
662
+ return JSON.stringify(val);
663
+ }
664
+ catch (error) {
665
+ console.error(error);
666
+ return val;
667
+ }
668
+ };
669
+ return $.$mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
670
+ }
671
+ }
672
+ }
673
+ $.$mol_assert_like = $mol_assert_like;
268
674
  })($ || ($ = {}));
269
675
  //assert.js.map
270
676
  ;
@@ -310,7 +716,7 @@ var $;
310
716
  $.$mol_assert_equal(new $.$mol_time_moment('T03').toString(), 'T03');
311
717
  },
312
718
  'format simple'() {
313
- $.$mol_assert_equal(new $.$mol_time_moment('2014-01-02T01:02:03.000').toString('AD YY-M-D h:m:s'), '21 14-1-2 1:2:3');
719
+ $.$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');
314
720
  },
315
721
  'format padded'() {
316
722
  $.$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');
@@ -331,12 +737,15 @@ var $;
331
737
  $.$mol_assert_equal(new $.$mol_time_moment('2014-01').shift('PT-8760h').toString(), '2013-01');
332
738
  },
333
739
  'normalization'() {
334
- $.$mol_assert_equal(new $.$mol_time_moment('2015-07-35').normal.toString(), '2015-08-04');
740
+ $.$mol_assert_equal(new $.$mol_time_moment({ year: 2015, month: 6, day: 34 }).normal.toString(), '2015-08-04');
335
741
  },
336
742
  'iso week day'() {
337
- $.$mol_assert_equal(new $.$mol_time_moment('2017-09-17').weekday, 6);
338
- $.$mol_assert_equal(new $.$mol_time_moment('2017-09-18').weekday, 0);
743
+ $.$mol_assert_equal(new $.$mol_time_moment('2017-09-17').weekday, $.$mol_time_moment_weekdays.sunday);
744
+ $.$mol_assert_equal(new $.$mol_time_moment('2017-09-18').weekday, $.$mol_time_moment_weekdays.monday);
339
745
  },
746
+ 'change offset'() {
747
+ $.$mol_assert_equal(new $.$mol_time_moment('2021-04-10 +03:00').toOffset('Z').toString(), '2021-04-09T21:00:00+00:00');
748
+ }
340
749
  });
341
750
  })($ || ($ = {}));
342
751
  //moment.test.js.map
@@ -353,4 +762,170 @@ var $;
353
762
  });
354
763
  })($ || ($ = {}));
355
764
  //interval.test.js.map
356
- //# sourceMappingURL=web.test.js.map
765
+ ;
766
+ "use strict";
767
+ var $;
768
+ (function ($) {
769
+ function $mol_log3_area_lazy(event) {
770
+ const self = this;
771
+ const stack = self.$mol_log3_stack;
772
+ const deep = stack.length;
773
+ let logged = false;
774
+ stack.push(() => {
775
+ logged = true;
776
+ self.$mol_log3_area.call(self, event);
777
+ });
778
+ return () => {
779
+ if (logged)
780
+ self.console.groupEnd();
781
+ if (stack.length > deep)
782
+ stack.length = deep;
783
+ };
784
+ }
785
+ $.$mol_log3_area_lazy = $mol_log3_area_lazy;
786
+ $.$mol_log3_stack = [];
787
+ })($ || ($ = {}));
788
+ //log3.js.map
789
+ ;
790
+ "use strict";
791
+ //extract.test.js.map
792
+ ;
793
+ "use strict";
794
+ //extract.js.map
795
+ ;
796
+ "use strict";
797
+ var $;
798
+ (function ($_1) {
799
+ $_1.$mol_test_mocks.push($ => {
800
+ $.$mol_log3_come = () => { };
801
+ $.$mol_log3_done = () => { };
802
+ $.$mol_log3_fail = () => { };
803
+ $.$mol_log3_warn = () => { };
804
+ $.$mol_log3_rise = () => { };
805
+ $.$mol_log3_area = () => () => { };
806
+ });
807
+ })($ || ($ = {}));
808
+ //log3.test.js.map
809
+ ;
810
+ "use strict";
811
+ var $;
812
+ (function ($) {
813
+ function $mol_log3_web_make(level, color) {
814
+ return function $mol_log3_logger(event) {
815
+ const pending = this.$mol_log3_stack.pop();
816
+ if (pending)
817
+ pending();
818
+ let tpl = '%c';
819
+ const chunks = Object.values(event);
820
+ for (let i = 0; i < chunks.length; ++i) {
821
+ tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
822
+ }
823
+ const style = `color:${color};font-weight:bolder`;
824
+ this.console[level](tpl, style, ...chunks);
825
+ const self = this;
826
+ return () => self.console.groupEnd();
827
+ };
828
+ }
829
+ $.$mol_log3_web_make = $mol_log3_web_make;
830
+ $.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
831
+ $.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
832
+ $.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
833
+ $.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
834
+ $.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
835
+ $.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
836
+ })($ || ($ = {}));
837
+ //log3.web.js.map
838
+ ;
839
+ "use strict";
840
+ //equals.test.js.map
841
+ ;
842
+ "use strict";
843
+ //equals.js.map
844
+ ;
845
+ "use strict";
846
+ var $;
847
+ (function ($) {
848
+ $.$mol_test({
849
+ 'equal paths'() {
850
+ const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]);
851
+ $.$mol_assert_like(diff, {
852
+ prefix: [1, 2, 3, 4],
853
+ suffix: [[], [], []],
854
+ });
855
+ },
856
+ 'different suffix'() {
857
+ const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2, 3, 5], [1, 2, 5, 4]);
858
+ $.$mol_assert_like(diff, {
859
+ prefix: [1, 2],
860
+ suffix: [[3, 4], [3, 5], [5, 4]],
861
+ });
862
+ },
863
+ 'one contains other'() {
864
+ const diff = $.$mol_diff_path([1, 2, 3, 4], [1, 2], [1, 2, 3]);
865
+ $.$mol_assert_like(diff, {
866
+ prefix: [1, 2],
867
+ suffix: [[3, 4], [], [3]],
868
+ });
869
+ },
870
+ 'fully different'() {
871
+ const diff = $.$mol_diff_path([1, 2], [3, 4], [5, 6]);
872
+ $.$mol_assert_like(diff, {
873
+ prefix: [],
874
+ suffix: [[1, 2], [3, 4], [5, 6]],
875
+ });
876
+ },
877
+ });
878
+ })($ || ($ = {}));
879
+ //path.test.js.map
880
+ ;
881
+ "use strict";
882
+ var $;
883
+ (function ($) {
884
+ function $mol_diff_path(...paths) {
885
+ const limit = Math.min(...paths.map(path => path.length));
886
+ lookup: for (var i = 0; i < limit; ++i) {
887
+ const first = paths[0][i];
888
+ for (let j = 1; j < paths.length; ++j) {
889
+ if (paths[j][i] !== first)
890
+ break lookup;
891
+ }
892
+ }
893
+ return {
894
+ prefix: paths[0].slice(0, i),
895
+ suffix: paths.map(path => path.slice(i)),
896
+ };
897
+ }
898
+ $.$mol_diff_path = $mol_diff_path;
899
+ })($ || ($ = {}));
900
+ //path.js.map
901
+ ;
902
+ "use strict";
903
+ var $;
904
+ (function ($) {
905
+ class $mol_error_mix extends Error {
906
+ errors;
907
+ constructor(message, ...errors) {
908
+ super(message);
909
+ this.errors = errors;
910
+ if (errors.length) {
911
+ const stacks = [...errors.map(error => error.stack), this.stack];
912
+ const diff = $.$mol_diff_path(...stacks.map(stack => {
913
+ if (!stack)
914
+ return [];
915
+ return stack.split('\n').reverse();
916
+ }));
917
+ const head = diff.prefix.reverse().join('\n');
918
+ const tails = diff.suffix.map(path => path.reverse().map(line => line.replace(/^(?!\s+at)/, '\tat (.) ')).join('\n')).join('\n\tat (.) -----\n');
919
+ this.stack = `Error: ${this.constructor.name}\n\tat (.) /"""\\\n${tails}\n\tat (.) \\___/\n${head}`;
920
+ this.message += errors.map(error => '\n' + error.message).join('');
921
+ }
922
+ }
923
+ toJSON() {
924
+ return this.message;
925
+ }
926
+ }
927
+ $.$mol_error_mix = $mol_error_mix;
928
+ })($ || ($ = {}));
929
+ //mix.js.map
930
+
931
+ //# sourceMappingURL=web.test.js.map