Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue with keys under ssr no-update root (#1527)
Co-authored-by: Michael Rawlings <mirawlings@ebay.com> (cherry picked from commit fd03031)
- Loading branch information
1 parent
3f30b02
commit 480bc77
Showing
10 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...est/components-pages/fixtures/no-update-nested-component-key/components/child/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class { | ||
onMount() { | ||
window.child = this; | ||
} | ||
} | ||
|
||
<div key="div">Child</div> | ||
<nested-child key="nested" no-update/> |
3 changes: 3 additions & 0 deletions
3
...components-pages/fixtures/no-update-nested-component-key/components/container/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="container"> | ||
<${input.renderBody}/> | ||
</div> |
7 changes: 7 additions & 0 deletions
7
...ponents-pages/fixtures/no-update-nested-component-key/components/nested-child/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class { | ||
onMount() { | ||
window.nestedChild = this; | ||
} | ||
} | ||
|
||
<div key="div">Nested Child</div> |
9 changes: 9 additions & 0 deletions
9
...test/components-pages/fixtures/no-update-nested-component-key/components/root/index.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class { | ||
onMount() { | ||
window.root = this; | ||
} | ||
} | ||
|
||
<container> | ||
<child key="child"/> | ||
</container> |
14 changes: 14 additions & 0 deletions
14
packages/marko/test/components-pages/fixtures/no-update-nested-component-key/template.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
html lang="en" | ||
head | ||
meta charset="UTF-8" | ||
title -- Marko Test | ||
body | ||
|
||
div id="test" | ||
div id="mocha" | ||
div id="testsTarget" | ||
|
||
<root/> | ||
|
||
init-components immediate |
14 changes: 14 additions & 0 deletions
14
packages/marko/test/components-pages/fixtures/no-update-nested-component-key/tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var expect = require("chai").expect; | ||
|
||
it("should render correctly", function() { | ||
var root = window.root; | ||
var child = window.child; | ||
var nestedChild = window.nestedChild; | ||
|
||
expect(root.getComponent("child")).to.eql(child); | ||
|
||
expect(child.getComponent("nested")).to.eql(nestedChild); | ||
expect(child.getEl("div")).has.property("textContent", "Child"); | ||
|
||
expect(nestedChild.getEl("div")).has.property("textContent", "Nested Child"); | ||
}); |