mol_wire_lib 1.0.197 → 1.0.200

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.test.js CHANGED
@@ -2335,7 +2335,7 @@ var $;
2335
2335
  return $mol_jsx("button", { title: props.hint }, target());
2336
2336
  };
2337
2337
  const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
2338
- $mol_assert_equal(dom.outerHTML, '<button title="click me" id="foo" class="Button">hey!</button>');
2338
+ $mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
2339
2339
  },
2340
2340
  'Nested guid generation'() {
2341
2341
  const Foo = () => {
@@ -2400,7 +2400,7 @@ var $;
2400
2400
  function $mol_jsx(Elem, props, ...childNodes) {
2401
2401
  const id = props && props.id || '';
2402
2402
  const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
2403
- const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id}`) : $.$mol_jsx_crumbs;
2403
+ const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
2404
2404
  if (Elem && $.$mol_jsx_booked) {
2405
2405
  if ($.$mol_jsx_booked.has(id)) {
2406
2406
  $mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
@@ -2476,7 +2476,11 @@ var $;
2476
2476
  $mol_dom_render_children(node, [].concat(...childNodes));
2477
2477
  if (!Elem)
2478
2478
  return node;
2479
+ if (guid)
2480
+ node.id = guid;
2479
2481
  for (const key in props) {
2482
+ if (key === 'id')
2483
+ continue;
2480
2484
  if (typeof props[key] === 'string') {
2481
2485
  ;
2482
2486
  node.setAttribute(key, props[key]);
@@ -2493,8 +2497,6 @@ var $;
2493
2497
  node[key] = props[key];
2494
2498
  }
2495
2499
  }
2496
- if (guid)
2497
- node.id = guid;
2498
2500
  if ($.$mol_jsx_crumbs)
2499
2501
  node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
2500
2502
  return node;
@@ -3682,6 +3684,33 @@ var $;
3682
3684
  $mol_assert_equal(Fib.value(4), 8);
3683
3685
  $mol_assert_equal(Fib.sums, 6);
3684
3686
  },
3687
+ 'Unsubscribe from temp pubs on complete'($) {
3688
+ class Random extends $mol_object2 {
3689
+ static $ = $;
3690
+ static seed() {
3691
+ return Math.random();
3692
+ }
3693
+ static resets(next) {
3694
+ return Math.random();
3695
+ }
3696
+ static value() {
3697
+ this.resets();
3698
+ return this.seed();
3699
+ }
3700
+ }
3701
+ __decorate([
3702
+ $mol_wire_method
3703
+ ], Random, "seed", null);
3704
+ __decorate([
3705
+ $mol_wire_mem(0)
3706
+ ], Random, "resets", null);
3707
+ __decorate([
3708
+ $mol_wire_mem(0)
3709
+ ], Random, "value", null);
3710
+ const first = Random.value();
3711
+ Random.resets(null);
3712
+ $mol_assert_unique(Random.value(), first);
3713
+ },
3685
3714
  });
3686
3715
  })($ || ($ = {}));
3687
3716
  //mol/wire/mem/mem.test.ts