Skip to content

Commit 60c13a6

Browse files
authoredNov 12, 2017
Merge pull request #912 from esarbanis/arg-name-clash
Use a block scoped unique name for the context solves #911
2 parents 70750a9 + 9218f20 commit 60c13a6

File tree

6 files changed

+50
-2
lines changed

6 files changed

+50
-2
lines changed
 

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ test/sourcemaps/samples/*/output.js.map
1414
_actual.*
1515
_actual-bundle.*
1616
src/generators/dom/shared.ts
17-
package-lock.json
17+
package-lock.json
18+
.idea/
19+
*.iml

‎src/generators/dom/preprocess.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ const preprocessors = {
225225
);
226226
listNames.set(node.context, listName);
227227

228-
const context = generator.getUniqueName(node.context);
228+
const context = block.getUniqueName(node.context);
229229
const contexts = new Map(block.contexts);
230230
contexts.set(node.context, context);
231231

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li>animal</li>
3+
<li>vegetable</li>
4+
<li>mineral</li>
5+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
<li>animal</li>
3+
<li>vegetable</li>
4+
<li>mineral</li>
5+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export default {
2+
data: {
3+
things: {
4+
foo: [
5+
'animal',
6+
'vegetable',
7+
'mineral'
8+
]
9+
}
10+
},
11+
12+
snapshot(target) {
13+
const ul = target.querySelector('ul');
14+
const lis = ul.querySelectorAll('li');
15+
16+
return {
17+
ul,
18+
lis
19+
};
20+
},
21+
22+
test(assert, target, snapshot) {
23+
const ul = target.querySelector('ul');
24+
const lis = ul.querySelectorAll('li');
25+
26+
assert.equal(ul, snapshot.ul);
27+
assert.equal(lis[0], snapshot.lis[0]);
28+
assert.equal(lis[1], snapshot.lis[1]);
29+
assert.equal(lis[2], snapshot.lis[2]);
30+
}
31+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<ul>
2+
{{#each things.foo as foo}}
3+
<li>{{foo}}</li>
4+
{{/each}}
5+
</ul>

0 commit comments

Comments
 (0)
Please sign in to comment.