From 0ee5875c0c9694310ec4e9b4aa04226b371f8b9f Mon Sep 17 00:00:00 2001 From: Ryan Turnquist Date: Fri, 31 Jan 2025 14:59:21 -0800 Subject: [PATCH] fix: restore tests (#2484) --- .../__snapshots__/csr-sanitized.expected.md | 14 ++ .../__snapshots__/csr.expected.md | 24 ++ .../resume-sanitized.expected.md | 14 ++ .../__snapshots__/resume.expected.md | 35 +++ .../cleanup-n-child-if-shallow/test.ts | 2 +- .../__snapshots__/csr-sanitized.expected.md | 80 ++++++ .../for-by/__snapshots__/csr.expected.md | 119 ++++++++- .../dom.expected/template.hydrate.js | 87 +++++-- .../__snapshots__/dom.expected/template.js | 30 ++- .../__snapshots__/html.expected/template.js | 53 +++- .../resume-sanitized.expected.md | 80 ++++++ .../for-by/__snapshots__/resume.expected.md | 238 ++++++++++++++++-- .../__snapshots__/ssr-sanitized.expected.md | 20 ++ .../for-by/__snapshots__/ssr.expected.md | 108 +++++++- .../__tests__/fixtures/for-by/template.marko | 4 +- 15 files changed, 853 insertions(+), 55 deletions(-) diff --git a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr-sanitized.expected.md b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr-sanitized.expected.md index 74b3355e44..2d3f479caf 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr-sanitized.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr-sanitized.expected.md @@ -53,3 +53,17 @@ container.querySelector("button").click(); c

``` + + +# Render +```js +container.querySelector("button").click(); +``` +```html + +
+ destroyed +
+``` diff --git a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr.expected.md b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr.expected.md index 76758a2acb..4d638950e0 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/csr.expected.md @@ -79,4 +79,28 @@ INSERT p REMOVE #text after div0 REMOVE #text in div0 INSERT div0/#text +``` + +# Render +```js +container.querySelector("button").click(); +``` +```html + +
+ destroyed +
+ +``` + +# Mutations +``` +INSERT #text +REMOVE #text in div +INSERT div/#text +REMOVE div after div +REMOVE span after div +REMOVE p after div ``` \ No newline at end of file diff --git a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume-sanitized.expected.md b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume-sanitized.expected.md index 74b3355e44..2d3f479caf 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume-sanitized.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume-sanitized.expected.md @@ -53,3 +53,17 @@ container.querySelector("button").click(); c

``` + + +# Render +```js +container.querySelector("button").click(); +``` +```html + +
+ destroyed +
+``` diff --git a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume.expected.md b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume.expected.md index 77e878b7f5..ec2d92161f 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/__snapshots__/resume.expected.md @@ -113,4 +113,39 @@ INSERT html/body/p REMOVE #comment after html/body/#comment1 REMOVE #text in html/body/div0 INSERT html/body/div0/#text +``` + +# Render +```js +container.querySelector("button").click(); +``` +```html + + + + + +
+ destroyed +
+ + + + + + +``` + +# Mutations +``` +INSERT html/body/#comment2 +REMOVE #text in html/body/div +INSERT html/body/div/#text +REMOVE div after html/body/#comment1 +REMOVE span after html/body/#comment1 +REMOVE p after html/body/#comment1 ``` \ No newline at end of file diff --git a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/test.ts b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/test.ts index bd30d73f0e..d7fdaf5d2d 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/test.ts +++ b/packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-shallow/test.ts @@ -1,4 +1,4 @@ -export const steps = [{}, click, click]; +export const steps = [{}, click, click, click]; function click(container: Element) { container.querySelector("button")!.click(); diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr-sanitized.expected.md b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr-sanitized.expected.md index 5785751811..e7a5ca1647 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr-sanitized.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr-sanitized.expected.md @@ -6,6 +6,26 @@ > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
@@ -24,6 +44,26 @@ container.querySelector("button").click(); > secondthirdfirst +
+ secondthirdfirst +
+
+ secondthirdfirst +
+
+ secondthirdfirst +
+
+ secondthirdfirst +
@@ -42,6 +82,26 @@ container.querySelector("button").click(); > thirdfirstsecond +
+ thirdfirstsecond +
+
+ thirdfirstsecond +
+
+ thirdfirstsecond +
+
+ thirdfirstsecond +
@@ -60,6 +120,26 @@ container.querySelector("button").click(); > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr.expected.md b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr.expected.md index a833f3e026..a8bc1971d0 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/csr.expected.md @@ -6,6 +6,26 @@ > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
@@ -28,6 +48,26 @@ container.querySelector("button").click(); > secondthirdfirst +
+ secondthirdfirst +
+
+ secondthirdfirst +
+
+ secondthirdfirst +
+
+ secondthirdfirst +
@@ -36,8 +76,17 @@ container.querySelector("button").click(); # Mutations ``` -REMOVE div/div/#text2 before div/div/#text0 -INSERT div/div/#text2 +REMOVE div/div0/#text2 before div/div0/#text0 +INSERT div/div0/#text2 +REMOVE div/div1/#text2 before div/div1/#text0 +INSERT div/div1/#text2 +REMOVE div/div2/#text2 before div/div2/#text0 +INSERT div/div2/#text2 +REMOVE div/div3/#text2 before div/div3/#text0 +INSERT div/div3/#text2 +UPDATE div/div4/#text0 "first" => "second" +UPDATE div/div4/#text1 "second" => "third" +UPDATE div/div4/#text2 "third" => "first" ``` # Render @@ -51,6 +100,26 @@ container.querySelector("button").click(); > thirdfirstsecond +
+ thirdfirstsecond +
+
+ thirdfirstsecond +
+
+ thirdfirstsecond +
+
+ thirdfirstsecond +
@@ -59,8 +128,17 @@ container.querySelector("button").click(); # Mutations ``` -REMOVE div/div/#text2 before div/div/#text0 -INSERT div/div/#text2 +REMOVE div/div0/#text2 before div/div0/#text0 +INSERT div/div0/#text2 +REMOVE div/div1/#text2 before div/div1/#text0 +INSERT div/div1/#text2 +REMOVE div/div2/#text2 before div/div2/#text0 +INSERT div/div2/#text2 +REMOVE div/div3/#text2 before div/div3/#text0 +INSERT div/div3/#text2 +UPDATE div/div4/#text0 "second" => "third" +UPDATE div/div4/#text1 "third" => "first" +UPDATE div/div4/#text2 "first" => "second" ``` # Render @@ -74,6 +152,26 @@ container.querySelector("button").click(); > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
@@ -82,6 +180,15 @@ container.querySelector("button").click(); # Mutations ``` -REMOVE div/div/#text2 before div/div/#text0 -INSERT div/div/#text2 +REMOVE div/div0/#text2 before div/div0/#text0 +INSERT div/div0/#text2 +REMOVE div/div1/#text2 before div/div1/#text0 +INSERT div/div1/#text2 +REMOVE div/div2/#text2 before div/div2/#text0 +INSERT div/div2/#text2 +REMOVE div/div3/#text2 before div/div3/#text0 +INSERT div/div3/#text2 +UPDATE div/div4/#text0 "third" => "first" +UPDATE div/div4/#text1 "first" => "second" +UPDATE div/div4/#text2 "second" => "third" ``` \ No newline at end of file diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.hydrate.js b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.hydrate.js index a4f6023d55..dba16ba370 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.hydrate.js +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.hydrate.js @@ -1,7 +1,52 @@ -// size: 486 (min) 242 (brotli) -const _text$for_content = _$.value(3, (_scope, text) => - _$.data(_scope[0], text), +// size: 1281 (min) 396 (brotli) +const getStringBy = _getStringBy, + getFunctionBy = _getFunctionBy, + getMissingBy = _getMissingBy, + _text$for_content5 = _$.value(3, (_scope, text) => _$.data(_scope[0], text)), + _pattern_5$for_content = _$.value(2, (_scope, _pattern_5) => + _text$for_content5(_scope, _pattern_5.text), ), + _params_6$for_content = _$.value(1, (_scope, _params_6) => + _pattern_5$for_content(_scope, _params_6?.[0]), + ), + _for_content5 = _$.register( + "a4", + _$.createRenderer(" ", " ", void 0, () => _params_6$for_content), + ), + _text$for_content4 = _$.value(3, (_scope, text) => _$.data(_scope[0], text)), + _pattern_4$for_content = _$.value(2, (_scope, _pattern_4) => + _text$for_content4(_scope, _pattern_4.text), + ), + _params_5$for_content = _$.value(1, (_scope, _params_5) => + _pattern_4$for_content(_scope, _params_5?.[0]), + ), + _for_content4 = _$.register( + "a5", + _$.createRenderer(" ", " ", void 0, () => _params_5$for_content), + ), + _text$for_content3 = _$.value(3, (_scope, text) => _$.data(_scope[0], text)), + _pattern_3$for_content = _$.value(2, (_scope, _pattern_3) => + _text$for_content3(_scope, _pattern_3.text), + ), + _params_4$for_content = _$.value(1, (_scope, _params_4) => + _pattern_3$for_content(_scope, _params_4?.[0]), + ), + _for_content3 = _$.register( + "a6", + _$.createRenderer(" ", " ", void 0, () => _params_4$for_content), + ), + _text$for_content2 = _$.value(3, (_scope, text) => _$.data(_scope[0], text)), + _pattern_2$for_content = _$.value(2, (_scope, _pattern_2) => + _text$for_content2(_scope, _pattern_2.text), + ), + _params_3$for_content = _$.value(1, (_scope, _params_3) => + _pattern_2$for_content(_scope, _params_3?.[0]), + ), + _for_content2 = _$.register( + "a7", + _$.createRenderer(" ", " ", void 0, () => _params_3$for_content), + ), + _text$for_content = _$.value(3, (_scope, text) => _$.data(_scope[0], text)), _pattern_$for_content = _$.value(2, (_scope, _pattern_) => _text$for_content(_scope, _pattern_.text), ), @@ -9,27 +54,39 @@ const _text$for_content = _$.value(3, (_scope, text) => _pattern_$for_content(_scope, _params_2?.[0]), ), _for_content = _$.register( - "a4", + "a8", _$.createRenderer(" ", " ", void 0, () => _params_2$for_content), ), + _for5 = _$.loopOf(4, _for_content5), + _for4 = _$.loopOf(3, _for_content4), + _for3 = _$.loopOf(2, _for_content3), + _for2 = _$.loopOf(1, _for_content2), _for = _$.loopOf(0, _for_content), - _items_effect = _$.effect("a5", (_scope, { 2: items }) => - _$.on(_scope[1], "click", function () { + _items_effect = _$.effect("a9", (_scope, { 6: items }) => + _$.on(_scope[5], "click", function () { _items(_scope, [...items.slice(1), items[0]]); }), ), - _items = _$.state(2, (_scope, items) => { - _items_effect(_scope), _for(_scope, [items, "id"]); + _items = _$.state(6, (_scope, items) => { + _items_effect(_scope), + _for(_scope, [items, "id"]), + _for2(_scope, [items, (item) => item.id]), + _for3(_scope, [items, getStringBy()]), + _for4(_scope, [items, getFunctionBy()]), + _for5(_scope, [items, getMissingBy()]); }); +function _getStringBy() { + return "id"; +} function _anonymous(item) { return item.id; } -_$.register("a0", function () { - return "id"; -}), +function _getFunctionBy() { + return _anonymous; +} +function _getMissingBy() {} +_$.register("a0", _getStringBy), _$.register("a2", _anonymous), - _$.register("a1", function () { - return _anonymous; - }), - _$.register("a3", function () {}), + _$.register("a1", _getFunctionBy), + _$.register("a3", _getMissingBy), init(); diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.js b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.js index a48d8e4775..426fc609c3 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.js +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/dom.expected/template.js @@ -1,22 +1,46 @@ -export const _template_ = "
"; -export const _walks_ = /* next(1), get, over(1), get, out(1) */"D b l"; +export const _template_ = "
"; +export const _walks_ = /* next(1), get, over(1), get, over(1), get, over(1), get, over(1), get, over(1), get, out(1) */"D b b b b b l"; const getStringBy = _getStringBy; const getFunctionBy = _getFunctionBy; const getMissingBy = _getMissingBy; import * as _$ from "@marko/runtime-tags/debug/dom"; +const _text$for_content5 = /* @__PURE__ */_$.value("text", (_scope, text) => _$.data(_scope["#text/0"], text)); +const _pattern_5$for_content = /* @__PURE__ */_$.value("_pattern_5", (_scope, _pattern_5) => _text$for_content5(_scope, _pattern_5.text)); +const _params_6$for_content = /* @__PURE__ */_$.value("_params_6", (_scope, _params_6) => _pattern_5$for_content(_scope, _params_6?.[0])); +const _for_content5 = _$.register("__tests__/template.marko_5_renderer", /* @__PURE__ */_$.createRenderer(" ", /* get */" ", void 0, () => _params_6$for_content)); +const _text$for_content4 = /* @__PURE__ */_$.value("text", (_scope, text) => _$.data(_scope["#text/0"], text)); +const _pattern_4$for_content = /* @__PURE__ */_$.value("_pattern_4", (_scope, _pattern_4) => _text$for_content4(_scope, _pattern_4.text)); +const _params_5$for_content = /* @__PURE__ */_$.value("_params_5", (_scope, _params_5) => _pattern_4$for_content(_scope, _params_5?.[0])); +const _for_content4 = _$.register("__tests__/template.marko_4_renderer", /* @__PURE__ */_$.createRenderer(" ", /* get */" ", void 0, () => _params_5$for_content)); +const _text$for_content3 = /* @__PURE__ */_$.value("text", (_scope, text) => _$.data(_scope["#text/0"], text)); +const _pattern_3$for_content = /* @__PURE__ */_$.value("_pattern_3", (_scope, _pattern_3) => _text$for_content3(_scope, _pattern_3.text)); +const _params_4$for_content = /* @__PURE__ */_$.value("_params_4", (_scope, _params_4) => _pattern_3$for_content(_scope, _params_4?.[0])); +const _for_content3 = _$.register("__tests__/template.marko_3_renderer", /* @__PURE__ */_$.createRenderer(" ", /* get */" ", void 0, () => _params_4$for_content)); +const _text$for_content2 = /* @__PURE__ */_$.value("text", (_scope, text) => _$.data(_scope["#text/0"], text)); +const _pattern_2$for_content = /* @__PURE__ */_$.value("_pattern_2", (_scope, _pattern_2) => _text$for_content2(_scope, _pattern_2.text)); +const _params_3$for_content = /* @__PURE__ */_$.value("_params_3", (_scope, _params_3) => _pattern_2$for_content(_scope, _params_3?.[0])); +const _for_content2 = _$.register("__tests__/template.marko_2_renderer", /* @__PURE__ */_$.createRenderer(" ", /* get */" ", void 0, () => _params_3$for_content)); const _text$for_content = /* @__PURE__ */_$.value("text", (_scope, text) => _$.data(_scope["#text/0"], text)); const _pattern_$for_content = /* @__PURE__ */_$.value("_pattern_", (_scope, _pattern_) => _text$for_content(_scope, _pattern_.text)); const _params_2$for_content = /* @__PURE__ */_$.value("_params_2", (_scope, _params_2) => _pattern_$for_content(_scope, _params_2?.[0])); const _for_content = _$.register("__tests__/template.marko_1_renderer", /* @__PURE__ */_$.createRenderer(" ", /* get */" ", void 0, () => _params_2$for_content)); +const _for5 = /* @__PURE__ */_$.loopOf("#div/4", _for_content5); +const _for4 = /* @__PURE__ */_$.loopOf("#div/3", _for_content4); +const _for3 = /* @__PURE__ */_$.loopOf("#div/2", _for_content3); +const _for2 = /* @__PURE__ */_$.loopOf("#div/1", _for_content2); const _for = /* @__PURE__ */_$.loopOf("#div/0", _for_content); const _items_effect = _$.effect("__tests__/template.marko_0_items", (_scope, { items -}) => _$.on(_scope["#button/1"], "click", function () { +}) => _$.on(_scope["#button/5"], "click", function () { _items(_scope, [...items.slice(1), items[0]]); })); const _items = /* @__PURE__ */_$.state("items", (_scope, items) => { _items_effect(_scope); _for(_scope, [items, "id"]); + _for2(_scope, [items, item => item.id]); + _for3(_scope, [items, getStringBy()]); + _for4(_scope, [items, getFunctionBy()]); + _for5(_scope, [items, getMissingBy()]); }); export function _setup_(_scope) { _items(_scope, [{ diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/html.expected/template.js b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/html.expected/template.js index 40e2e18fba..4d42df8ba2 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/html.expected/template.js +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/html.expected/template.js @@ -34,11 +34,60 @@ const _renderer = /* @__PURE__ */_$.createRenderer((input, _tagVar) => { _$.write(`${_$.escapeXML(text)}${_$.markResumeNode(_scope1_id, "#text/0")}`); _$.writeScope(_scope1_id, {}); }, _scope0_id, "#div/0"); - _$.write(`${_$.markResumeNode(_scope0_id, "#div/0")}${_$.markResumeNode(_scope0_id, "#button/1")}`); + _$.write(`${_$.markResumeNode(_scope0_id, "#div/0")}
`); + const _by = item => item.id; + const _scope2_ = new Map(); + _$.resumeSingleNodeForOf(items, (_list2, _index2) => { + const _scope2_id = _$.nextScopeId(); + let { + text + } = _list2; + _scope2_.set(_by(_list2, _index2), _$.ensureScopeWithId(_scope2_id)); + _$.write(`${_$.escapeXML(text)}${_$.markResumeNode(_scope2_id, "#text/0")}`); + _$.writeScope(_scope2_id, {}); + }, _scope0_id, "#div/1"); + _$.write(`
${_$.markResumeNode(_scope0_id, "#div/1")}
`); + const _scope3_ = new Map(); + _$.resumeSingleNodeForOf(items, (_list3, _index3) => { + const _scope3_id = _$.nextScopeId(); + let { + text + } = _list3; + _scope3_.set(_$.forOfBy(getStringBy(), _list3, _index3), _$.ensureScopeWithId(_scope3_id)); + _$.write(`${_$.escapeXML(text)}${_$.markResumeNode(_scope3_id, "#text/0")}`); + _$.writeScope(_scope3_id, {}); + }, _scope0_id, "#div/2"); + _$.write(`
${_$.markResumeNode(_scope0_id, "#div/2")}
`); + const _scope4_ = new Map(); + _$.resumeSingleNodeForOf(items, (_list4, _index4) => { + const _scope4_id = _$.nextScopeId(); + let { + text + } = _list4; + _scope4_.set(_$.forOfBy(getFunctionBy(), _list4, _index4), _$.ensureScopeWithId(_scope4_id)); + _$.write(`${_$.escapeXML(text)}${_$.markResumeNode(_scope4_id, "#text/0")}`); + _$.writeScope(_scope4_id, {}); + }, _scope0_id, "#div/3"); + _$.write(`
${_$.markResumeNode(_scope0_id, "#div/3")}
`); + const _scope5_ = new Map(); + _$.resumeSingleNodeForOf(items, (_list5, _index5) => { + const _scope5_id = _$.nextScopeId(); + let { + text + } = _list5; + _scope5_.set(_$.forOfBy(getMissingBy(), _list5, _index5), _$.ensureScopeWithId(_scope5_id)); + _$.write(`${_$.escapeXML(text)}${_$.markResumeNode(_scope5_id, "#text/0")}`); + _$.writeScope(_scope5_id, {}); + }, _scope0_id, "#div/4"); + _$.write(`
${_$.markResumeNode(_scope0_id, "#div/4")}${_$.markResumeNode(_scope0_id, "#button/5")}`); _$.writeEffect(_scope0_id, "__tests__/template.marko_0_items"); _$.writeScope(_scope0_id, { "items": items, - "#div/0(": _scope1_.size ? _scope1_ : undefined + "#div/0(": _scope1_.size ? _scope1_ : undefined, + "#div/1(": _scope2_.size ? _scope2_ : undefined, + "#div/2(": _scope3_.size ? _scope3_ : undefined, + "#div/3(": _scope4_.size ? _scope4_ : undefined, + "#div/4(": _scope5_.size ? _scope5_ : undefined }); _$.resumeClosestBranch(_scope0_id); }); diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume-sanitized.expected.md b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume-sanitized.expected.md index 5785751811..e7a5ca1647 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume-sanitized.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume-sanitized.expected.md @@ -6,6 +6,26 @@ > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
@@ -24,6 +44,26 @@ container.querySelector("button").click(); > secondthirdfirst +
+ secondthirdfirst +
+
+ secondthirdfirst +
+
+ secondthirdfirst +
+
+ secondthirdfirst +
@@ -42,6 +82,26 @@ container.querySelector("button").click(); > thirdfirstsecond +
+ thirdfirstsecond +
+
+ thirdfirstsecond +
+
+ thirdfirstsecond +
+
+ thirdfirstsecond +
@@ -60,6 +120,26 @@ container.querySelector("button").click(); > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume.expected.md b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume.expected.md index 9dc287b9aa..c932e43644 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/resume.expected.md @@ -16,13 +16,61 @@ +
+ first + + second + + third + + +
+ +
+ first + + second + + third + + +
+ +
+ first + + second + + third + + +
+ +
+ first + + second + + third + + +
+ - + @@ -50,13 +98,61 @@ container.querySelector("button").click(); first +
+ + second + + third + + + first +
+ +
+ + second + + third + + + first +
+ +
+ + second + + third + + + first +
+ +
+ second + + third + + first + + +
+ - + @@ -64,8 +160,17 @@ container.querySelector("button").click(); # Mutations ``` -REMOVE html/body/div/div/#text2 before html/body/div/div/#comment0 -INSERT html/body/div/div/#text2 +REMOVE html/body/div/div0/#text2 before html/body/div/div0/#comment0 +INSERT html/body/div/div0/#text2 +REMOVE html/body/div/div1/#text2 before html/body/div/div1/#comment0 +INSERT html/body/div/div1/#text2 +REMOVE html/body/div/div2/#text2 before html/body/div/div2/#comment0 +INSERT html/body/div/div2/#text2 +REMOVE html/body/div/div3/#text2 before html/body/div/div3/#comment0 +INSERT html/body/div/div3/#text2 +UPDATE html/body/div/div4/#text0 "first" => "second" +UPDATE html/body/div/div4/#text1 "second" => "third" +UPDATE html/body/div/div4/#text2 "third" => "first" ``` # Render @@ -88,13 +193,58 @@ container.querySelector("button").click(); firstsecond +
+ + + third + + + firstsecond +
+ +
+ + + third + + + firstsecond +
+ +
+ + + third + + + firstsecond +
+ +
+ third + + first + + second + + +
+ - + @@ -102,8 +252,17 @@ container.querySelector("button").click(); # Mutations ``` -REMOVE html/body/div/div/#text2 after html/body/div/div/#comment0 -INSERT html/body/div/div/#text2 +REMOVE html/body/div/div0/#text2 after html/body/div/div0/#comment0 +INSERT html/body/div/div0/#text2 +REMOVE html/body/div/div1/#text2 after html/body/div/div1/#comment0 +INSERT html/body/div/div1/#text2 +REMOVE html/body/div/div2/#text2 after html/body/div/div2/#comment0 +INSERT html/body/div/div2/#text2 +REMOVE html/body/div/div3/#text2 after html/body/div/div3/#comment0 +INSERT html/body/div/div3/#text2 +UPDATE html/body/div/div4/#text0 "second" => "third" +UPDATE html/body/div/div4/#text1 "third" => "first" +UPDATE html/body/div/div4/#text2 "first" => "second" ``` # Render @@ -125,13 +284,55 @@ container.querySelector("button").click(); firstsecondthird +
+ + + + + firstsecondthird +
+ +
+ + + + + firstsecondthird +
+ +
+ + + + + firstsecondthird +
+ +
+ first + + second + + third + + +
+ - + @@ -139,6 +340,15 @@ container.querySelector("button").click(); # Mutations ``` -REMOVE html/body/div/div/#text2 after html/body/div/div/#comment1 -INSERT html/body/div/div/#text2 +REMOVE html/body/div/div0/#text2 after html/body/div/div0/#comment1 +INSERT html/body/div/div0/#text2 +REMOVE html/body/div/div1/#text2 after html/body/div/div1/#comment1 +INSERT html/body/div/div1/#text2 +REMOVE html/body/div/div2/#text2 after html/body/div/div2/#comment1 +INSERT html/body/div/div2/#text2 +REMOVE html/body/div/div3/#text2 after html/body/div/div3/#comment1 +INSERT html/body/div/div3/#text2 +UPDATE html/body/div/div4/#text0 "third" => "first" +UPDATE html/body/div/div4/#text1 "first" => "second" +UPDATE html/body/div/div4/#text2 "second" => "third" ``` \ No newline at end of file diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr-sanitized.expected.md b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr-sanitized.expected.md index cb2951ffc8..5bbd577703 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr-sanitized.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr-sanitized.expected.md @@ -6,6 +6,26 @@ > firstsecondthird +
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
+
+ firstsecondthird +
diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr.expected.md b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr.expected.md index 5c90eafb47..1711b2e9b3 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr.expected.md +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/__snapshots__/ssr.expected.md @@ -1,6 +1,6 @@ # Write ```html -
firstsecondthird
+
firstsecondthird
firstsecondthird
firstsecondthird
firstsecondthird
firstsecondthird
``` # Render End @@ -21,13 +21,61 @@ +
+ first + + second + + third + + +
+ +
+ first + + second + + third + + +
+ +
+ first + + second + + third + + +
+ +
+ first + + second + + third + + +
+ - + @@ -39,18 +87,54 @@ INSERT html INSERT html/head INSERT html/body INSERT html/body/div -INSERT html/body/div/div -INSERT html/body/div/div/#text0 -INSERT html/body/div/div/#comment0 -INSERT html/body/div/div/#text1 -INSERT html/body/div/div/#comment1 -INSERT html/body/div/div/#text2 -INSERT html/body/div/div/#comment2 -INSERT html/body/div/div/#comment3 +INSERT html/body/div/div0 +INSERT html/body/div/div0/#text0 +INSERT html/body/div/div0/#comment0 +INSERT html/body/div/div0/#text1 +INSERT html/body/div/div0/#comment1 +INSERT html/body/div/div0/#text2 +INSERT html/body/div/div0/#comment2 +INSERT html/body/div/div0/#comment3 INSERT html/body/div/#comment0 +INSERT html/body/div/div1 +INSERT html/body/div/div1/#text0 +INSERT html/body/div/div1/#comment0 +INSERT html/body/div/div1/#text1 +INSERT html/body/div/div1/#comment1 +INSERT html/body/div/div1/#text2 +INSERT html/body/div/div1/#comment2 +INSERT html/body/div/div1/#comment3 +INSERT html/body/div/#comment1 +INSERT html/body/div/div2 +INSERT html/body/div/div2/#text0 +INSERT html/body/div/div2/#comment0 +INSERT html/body/div/div2/#text1 +INSERT html/body/div/div2/#comment1 +INSERT html/body/div/div2/#text2 +INSERT html/body/div/div2/#comment2 +INSERT html/body/div/div2/#comment3 +INSERT html/body/div/#comment2 +INSERT html/body/div/div3 +INSERT html/body/div/div3/#text0 +INSERT html/body/div/div3/#comment0 +INSERT html/body/div/div3/#text1 +INSERT html/body/div/div3/#comment1 +INSERT html/body/div/div3/#text2 +INSERT html/body/div/div3/#comment2 +INSERT html/body/div/div3/#comment3 +INSERT html/body/div/#comment3 +INSERT html/body/div/div4 +INSERT html/body/div/div4/#text0 +INSERT html/body/div/div4/#comment0 +INSERT html/body/div/div4/#text1 +INSERT html/body/div/div4/#comment1 +INSERT html/body/div/div4/#text2 +INSERT html/body/div/div4/#comment2 +INSERT html/body/div/div4/#comment3 +INSERT html/body/div/#comment4 INSERT html/body/div/button INSERT html/body/div/button/#text -INSERT html/body/div/#comment1 +INSERT html/body/div/#comment5 INSERT html/body/script INSERT html/body/script/#text ``` \ No newline at end of file diff --git a/packages/runtime-tags/src/__tests__/fixtures/for-by/template.marko b/packages/runtime-tags/src/__tests__/fixtures/for-by/template.marko index 8fbfd815e4..f54fea9fae 100644 --- a/packages/runtime-tags/src/__tests__/fixtures/for-by/template.marko +++ b/packages/runtime-tags/src/__tests__/fixtures/for-by/template.marko @@ -17,7 +17,7 @@ static function getMissingBy() { ${text} - +