mol_wire_lib 1.0.501 → 1.0.503

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
@@ -168,112 +168,16 @@ var $;
168
168
  //mol/type/error/error.ts
169
169
  ;
170
170
  "use strict";
171
- //mol/type/assert/assert.test.ts
172
- ;
173
- "use strict";
174
171
  //mol/type/assert/assert.ts
175
172
  ;
176
173
  "use strict";
177
- //mol/type/equals/equals.test.ts
178
- ;
179
- "use strict";
180
- //mol/type/equals/equals.ts
181
- ;
182
- "use strict";
183
- //mol/type/partial/deep/deep.test.ts
174
+ //mol/type/assert/assert.test.ts
184
175
  ;
185
176
  "use strict";
186
177
  //mol/type/partial/deep/deep.ts
187
178
  ;
188
179
  "use strict";
189
- var $;
190
- (function ($) {
191
- $mol_test({
192
- 'Make empty div'() {
193
- $mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
194
- },
195
- 'Define native field'() {
196
- const dom = $mol_jsx("input", { value: '123' });
197
- $mol_assert_equal(dom.outerHTML, '<input value="123">');
198
- $mol_assert_equal(dom.value, '123');
199
- },
200
- 'Define classes'() {
201
- const dom = $mol_jsx("div", { class: 'foo bar' });
202
- $mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
203
- },
204
- 'Define styles'() {
205
- const dom = $mol_jsx("div", { style: { color: 'red' } });
206
- $mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
207
- },
208
- 'Define dataset'() {
209
- const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
210
- $mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
211
- },
212
- 'Define attributes'() {
213
- const dom = $mol_jsx("div", { lang: "ru", hidden: true });
214
- $mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
215
- },
216
- 'Define child nodes'() {
217
- const dom = $mol_jsx("div", null,
218
- "hello",
219
- $mol_jsx("strong", null, "world"),
220
- "!");
221
- $mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
222
- },
223
- 'Function as component'() {
224
- const Button = (props, target) => {
225
- return $mol_jsx("button", { title: props.hint }, target());
226
- };
227
- const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
228
- $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
229
- },
230
- 'Nested guid generation'() {
231
- const Foo = () => {
232
- return $mol_jsx("div", null,
233
- $mol_jsx(Bar, { id: "bar" },
234
- $mol_jsx("img", { id: "icon" })));
235
- };
236
- const Bar = (props, icon) => {
237
- return $mol_jsx("span", null,
238
- icon,
239
- $mol_jsx("i", { id: "label" }));
240
- };
241
- const dom = $mol_jsx(Foo, { id: "foo" });
242
- $mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></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 "foo/bar"');
251
- },
252
- 'Owner based guid generationn'() {
253
- const Foo = () => {
254
- return $mol_jsx("div", null,
255
- $mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
256
- };
257
- const Bar = (props) => {
258
- return $mol_jsx("span", null, props.icon());
259
- };
260
- const dom = $mol_jsx(Foo, { id: "app" });
261
- $mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
262
- },
263
- 'Fail on same ids from different caller'() {
264
- const Foo = () => {
265
- return $mol_jsx("div", null,
266
- $mol_jsx("img", { id: "icon" }),
267
- $mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
268
- };
269
- const Bar = (props) => {
270
- return $mol_jsx("span", null, props.icon());
271
- };
272
- $mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
273
- },
274
- });
275
- })($ || ($ = {}));
276
- //mol/jsx/jsx.test.tsx
180
+ //mol/type/partial/deep/deep.test.ts
277
181
  ;
278
182
  "use strict";
279
183
  var $;
@@ -398,6 +302,96 @@ var $;
398
302
  ;
399
303
  "use strict";
400
304
  var $;
305
+ (function ($) {
306
+ $mol_test({
307
+ 'Make empty div'() {
308
+ $mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
309
+ },
310
+ 'Define native field'() {
311
+ const dom = $mol_jsx("input", { value: '123' });
312
+ $mol_assert_equal(dom.outerHTML, '<input value="123">');
313
+ $mol_assert_equal(dom.value, '123');
314
+ },
315
+ 'Define classes'() {
316
+ const dom = $mol_jsx("div", { class: 'foo bar' });
317
+ $mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
318
+ },
319
+ 'Define styles'() {
320
+ const dom = $mol_jsx("div", { style: { color: 'red' } });
321
+ $mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
322
+ },
323
+ 'Define dataset'() {
324
+ const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
325
+ $mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
326
+ },
327
+ 'Define attributes'() {
328
+ const dom = $mol_jsx("div", { lang: "ru", hidden: true });
329
+ $mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
330
+ },
331
+ 'Define child nodes'() {
332
+ const dom = $mol_jsx("div", null,
333
+ "hello",
334
+ $mol_jsx("strong", null, "world"),
335
+ "!");
336
+ $mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
337
+ },
338
+ 'Function as component'() {
339
+ const Button = (props, target) => {
340
+ return $mol_jsx("button", { title: props.hint }, target());
341
+ };
342
+ const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
343
+ $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
344
+ },
345
+ 'Nested guid generation'() {
346
+ const Foo = () => {
347
+ return $mol_jsx("div", null,
348
+ $mol_jsx(Bar, { id: "bar" },
349
+ $mol_jsx("img", { id: "icon" })));
350
+ };
351
+ const Bar = (props, icon) => {
352
+ return $mol_jsx("span", null,
353
+ icon,
354
+ $mol_jsx("i", { id: "label" }));
355
+ };
356
+ const dom = $mol_jsx(Foo, { id: "foo" });
357
+ $mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
358
+ },
359
+ 'Fail on non unique ids'() {
360
+ const App = () => {
361
+ return $mol_jsx("div", null,
362
+ $mol_jsx("span", { id: "bar" }),
363
+ $mol_jsx("span", { id: "bar" }));
364
+ };
365
+ $mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
366
+ },
367
+ 'Owner based guid generationn'() {
368
+ const Foo = () => {
369
+ return $mol_jsx("div", null,
370
+ $mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
371
+ };
372
+ const Bar = (props) => {
373
+ return $mol_jsx("span", null, props.icon());
374
+ };
375
+ const dom = $mol_jsx(Foo, { id: "app" });
376
+ $mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
377
+ },
378
+ 'Fail on same ids from different caller'() {
379
+ const Foo = () => {
380
+ return $mol_jsx("div", null,
381
+ $mol_jsx("img", { id: "icon" }),
382
+ $mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
383
+ };
384
+ const Bar = (props) => {
385
+ return $mol_jsx("span", null, props.icon());
386
+ };
387
+ $mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
388
+ },
389
+ });
390
+ })($ || ($ = {}));
391
+ //mol/jsx/jsx.test.tsx
392
+ ;
393
+ "use strict";
394
+ var $;
401
395
  (function ($) {
402
396
  $mol_test({
403
397
  'nulls & undefineds'() {
@@ -505,38 +499,6 @@ var $;
505
499
  ;
506
500
  "use strict";
507
501
  var $;
508
- (function ($) {
509
- $mol_test({
510
- 'must be false'() {
511
- $mol_assert_not(0);
512
- },
513
- 'must be true'() {
514
- $mol_assert_ok(1);
515
- },
516
- 'two must be equal'() {
517
- $mol_assert_equal(2, 2);
518
- },
519
- 'three must be equal'() {
520
- $mol_assert_equal(2, 2, 2);
521
- },
522
- 'two must be unique'() {
523
- $mol_assert_unique([3], [3]);
524
- },
525
- 'three must be unique'() {
526
- $mol_assert_unique([3], [3], [3]);
527
- },
528
- 'two must be alike'() {
529
- $mol_assert_like([3], [3]);
530
- },
531
- 'three must be alike'() {
532
- $mol_assert_like([3], [3], [3]);
533
- },
534
- });
535
- })($ || ($ = {}));
536
- //mol/assert/assert.test.ts
537
- ;
538
- "use strict";
539
- var $;
540
502
  (function ($) {
541
503
  function $mol_assert_ok(value) {
542
504
  if (value)
@@ -630,6 +592,44 @@ var $;
630
592
  //mol/assert/assert.ts
631
593
  ;
632
594
  "use strict";
595
+ var $;
596
+ (function ($) {
597
+ $mol_test({
598
+ 'must be false'() {
599
+ $mol_assert_not(0);
600
+ },
601
+ 'must be true'() {
602
+ $mol_assert_ok(1);
603
+ },
604
+ 'two must be equal'() {
605
+ $mol_assert_equal(2, 2);
606
+ },
607
+ 'three must be equal'() {
608
+ $mol_assert_equal(2, 2, 2);
609
+ },
610
+ 'two must be unique'() {
611
+ $mol_assert_unique([3], [3]);
612
+ },
613
+ 'three must be unique'() {
614
+ $mol_assert_unique([3], [3], [3]);
615
+ },
616
+ 'two must be alike'() {
617
+ $mol_assert_like([3], [3]);
618
+ },
619
+ 'three must be alike'() {
620
+ $mol_assert_like([3], [3], [3]);
621
+ },
622
+ });
623
+ })($ || ($ = {}));
624
+ //mol/assert/assert.test.ts
625
+ ;
626
+ "use strict";
627
+ //mol/type/equals/equals.ts
628
+ ;
629
+ "use strict";
630
+ //mol/type/equals/equals.test.ts
631
+ ;
632
+ "use strict";
633
633
  //mol/type/keys/extract/extract.test.ts
634
634
  ;
635
635
  "use strict";
@@ -915,6 +915,67 @@ var $;
915
915
  ;
916
916
  "use strict";
917
917
  var $;
918
+ (function ($) {
919
+ $mol_test({
920
+ 'Primitives'() {
921
+ $mol_assert_equal($mol_key(null), 'null');
922
+ $mol_assert_equal($mol_key(false), 'false');
923
+ $mol_assert_equal($mol_key(true), 'true');
924
+ $mol_assert_equal($mol_key(0), '0');
925
+ $mol_assert_equal($mol_key(''), '""');
926
+ },
927
+ 'Array & POJO'() {
928
+ $mol_assert_equal($mol_key([null]), '[null]');
929
+ $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
930
+ $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
931
+ },
932
+ 'Function'() {
933
+ const func = () => { };
934
+ $mol_assert_equal($mol_key(func), $mol_key(func));
935
+ $mol_assert_unique($mol_key(func), $mol_key(() => { }));
936
+ },
937
+ 'Objects'() {
938
+ class User {
939
+ }
940
+ const jin = new User();
941
+ $mol_assert_equal($mol_key(jin), $mol_key(jin));
942
+ $mol_assert_unique($mol_key(jin), $mol_key(new User()));
943
+ },
944
+ 'Elements'() {
945
+ const foo = $mol_jsx("div", null, "bar");
946
+ $mol_assert_equal($mol_key(foo), $mol_key(foo));
947
+ $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
948
+ },
949
+ 'Custom JSON representation'() {
950
+ class User {
951
+ name;
952
+ age;
953
+ constructor(name, age) {
954
+ this.name = name;
955
+ this.age = age;
956
+ }
957
+ toJSON() { return { name: this.name }; }
958
+ }
959
+ $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
960
+ },
961
+ 'Special native classes'() {
962
+ $mol_assert_equal($mol_key(new Date('xyz')), 'null');
963
+ $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
964
+ $mol_assert_equal($mol_key(/./), '"/./"');
965
+ $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
966
+ },
967
+ });
968
+ })($ || ($ = {}));
969
+ //mol/key/key.test.tsx
970
+ ;
971
+ "use strict";
972
+ //mol/type/tail/tail.test.ts
973
+ ;
974
+ "use strict";
975
+ //mol/type/foot/foot.test.ts
976
+ ;
977
+ "use strict";
978
+ var $;
918
979
  (function ($_1) {
919
980
  $mol_test_mocks.push($ => {
920
981
  $.$mol_after_timeout = $mol_after_mock_timeout;
@@ -966,9 +1027,6 @@ var $;
966
1027
  //mol/wire/async/async.test.ts
967
1028
  ;
968
1029
  "use strict";
969
- //mol/type/tail/tail.test.ts
970
- ;
971
- "use strict";
972
1030
  var $;
973
1031
  (function ($_1) {
974
1032
  $mol_test({
@@ -1559,64 +1617,6 @@ var $;
1559
1617
  ;
1560
1618
  "use strict";
1561
1619
  var $;
1562
- (function ($) {
1563
- $mol_test({
1564
- 'Primitives'() {
1565
- $mol_assert_equal($mol_key(null), 'null');
1566
- $mol_assert_equal($mol_key(false), 'false');
1567
- $mol_assert_equal($mol_key(true), 'true');
1568
- $mol_assert_equal($mol_key(0), '0');
1569
- $mol_assert_equal($mol_key(''), '""');
1570
- },
1571
- 'Array & POJO'() {
1572
- $mol_assert_equal($mol_key([null]), '[null]');
1573
- $mol_assert_equal($mol_key({ foo: 0 }), '{"foo":0}');
1574
- $mol_assert_equal($mol_key({ foo: [false] }), '{"foo":[false]}');
1575
- },
1576
- 'Function'() {
1577
- const func = () => { };
1578
- $mol_assert_equal($mol_key(func), $mol_key(func));
1579
- $mol_assert_unique($mol_key(func), $mol_key(() => { }));
1580
- },
1581
- 'Objects'() {
1582
- class User {
1583
- }
1584
- const jin = new User();
1585
- $mol_assert_equal($mol_key(jin), $mol_key(jin));
1586
- $mol_assert_unique($mol_key(jin), $mol_key(new User()));
1587
- },
1588
- 'Elements'() {
1589
- const foo = $mol_jsx("div", null, "bar");
1590
- $mol_assert_equal($mol_key(foo), $mol_key(foo));
1591
- $mol_assert_unique($mol_key(foo), $mol_key($mol_jsx("div", null, "bar")));
1592
- },
1593
- 'Custom JSON representation'() {
1594
- class User {
1595
- name;
1596
- age;
1597
- constructor(name, age) {
1598
- this.name = name;
1599
- this.age = age;
1600
- }
1601
- toJSON() { return { name: this.name }; }
1602
- }
1603
- $mol_assert_equal($mol_key(new User('jin', 18)), '{"name":"jin"}');
1604
- },
1605
- 'Special native classes'() {
1606
- $mol_assert_equal($mol_key(new Date('xyz')), 'null');
1607
- $mol_assert_equal($mol_key(new Date('2001-01-02T03:04:05.678Z')), '"2001-01-02T03:04:05.678Z"');
1608
- $mol_assert_equal($mol_key(/./), '"/./"');
1609
- $mol_assert_equal($mol_key(/\./gimsu), '"/\\\\./gimsu"');
1610
- },
1611
- });
1612
- })($ || ($ = {}));
1613
- //mol/key/key.test.tsx
1614
- ;
1615
- "use strict";
1616
- //mol/type/foot/foot.test.ts
1617
- ;
1618
- "use strict";
1619
- var $;
1620
1620
  (function ($) {
1621
1621
  $mol_wire_log.active();
1622
1622
  })($ || ($ = {}));