mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fix issue when using getEls with repeated id in a split component (#1343)
This commit is contained in:
parent
4a73060bc6
commit
e729b89b1e
@ -4,6 +4,6 @@ var FLAG_WILL_RERENDER_IN_BROWSER = 1;
|
||||
|
||||
module.exports = function markoKeyAttr(key, componentDef) {
|
||||
if ((componentDef.___flags & FLAG_WILL_RERENDER_IN_BROWSER) === 0) {
|
||||
return key + " " + componentDef.id;
|
||||
return componentDef.___nextKey(key) + " " + componentDef.id;
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
<div.split-component>
|
||||
<button key="button">Click me</button>
|
||||
|
||||
<ul>
|
||||
<for|i| from=1 to=3>
|
||||
<li key="li[]">${i}</li>
|
||||
</for>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -6,5 +6,12 @@ describe(path.basename(__dirname), function() {
|
||||
var splitComponent = window.splitComponent;
|
||||
expect(splitComponent.getEl("button") != null).to.equal(true);
|
||||
expect(splitComponent.getEl("button").nodeName).to.equal("BUTTON");
|
||||
|
||||
expect(splitComponent.getEls("li").length).to.equal(3);
|
||||
expect(splitComponent.getEls("li").map(el => el.textContent)).to.eql([
|
||||
"1",
|
||||
"2",
|
||||
"3"
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user