Add index-as test
This commit is contained in:
parent
f811dfcd80
commit
5a7eccbcb8
3 changed files with 18 additions and 8 deletions
14
jael.iml
14
jael.iml
|
@ -8,17 +8,27 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/angel_jael/build" />
|
<excludeFolder url="file://$MODULE_DIR$/angel_jael/build" />
|
||||||
</content>
|
</content>
|
||||||
<content url="file://$MODULE_DIR$/build_jael">
|
<content url="file://$MODULE_DIR$/build_jael">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build_jael/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build_jael/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/build_jael/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build_jael/build" />
|
<excludeFolder url="file://$MODULE_DIR$/build_jael/build" />
|
||||||
</content>
|
</content>
|
||||||
<content url="file://$MODULE_DIR$/dsx" />
|
<content url="file://$MODULE_DIR$/dsx">
|
||||||
<content url="file://$MODULE_DIR$/dsx_generator" />
|
<excludeFolder url="file://$MODULE_DIR$/dsx/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/dsx/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/dsx/build" />
|
||||||
|
</content>
|
||||||
|
<content url="file://$MODULE_DIR$/dsx_generator">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/dsx_generator/.dart_tool" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/dsx_generator/.pub" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/dsx_generator/build" />
|
||||||
|
</content>
|
||||||
<content url="file://$MODULE_DIR$/jael">
|
<content url="file://$MODULE_DIR$/jael">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/jael/.dart_tool" />
|
<excludeFolder url="file://$MODULE_DIR$/jael/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/jael/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/jael/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/jael/build" />
|
<excludeFolder url="file://$MODULE_DIR$/jael/build" />
|
||||||
</content>
|
</content>
|
||||||
<content url="file://$MODULE_DIR$/jael_preprocessor">
|
<content url="file://$MODULE_DIR$/jael_preprocessor">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/jael_preprocessor/.dart_tool" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/jael_preprocessor/.pub" />
|
<excludeFolder url="file://$MODULE_DIR$/jael_preprocessor/.pub" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/jael_preprocessor/build" />
|
<excludeFolder url="file://$MODULE_DIR$/jael_preprocessor/build" />
|
||||||
</content>
|
</content>
|
||||||
|
|
|
@ -173,8 +173,8 @@ class Renderer {
|
||||||
.firstWhere((a) => a.name == 'index-as', orElse: () => null);
|
.firstWhere((a) => a.name == 'index-as', orElse: () => null);
|
||||||
var alias = asAttribute?.value?.compute(scope) ?? 'item';
|
var alias = asAttribute?.value?.compute(scope) ?? 'item';
|
||||||
var indexAs = indexAsAttribute?.value?.compute(scope)?.toString() ?? 'item';
|
var indexAs = indexAsAttribute?.value?.compute(scope)?.toString() ?? 'item';
|
||||||
var otherAttributes =
|
var otherAttributes = element.attributes.where(
|
||||||
element.attributes.where((a) => a.name != 'for-each' && a.name != 'as');
|
(a) => a.name != 'for-each' && a.name != 'as' && a.name != 'index-as');
|
||||||
Element strippedElement;
|
Element strippedElement;
|
||||||
|
|
||||||
if (element is SelfClosingElement)
|
if (element is SelfClosingElement)
|
||||||
|
|
|
@ -99,7 +99,7 @@ main() {
|
||||||
<body>
|
<body>
|
||||||
<h1>Pokémon</h1>
|
<h1>Pokémon</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li for-each=starters as="starter">{{ starter.name }} - {{ starter.type }}</li>
|
<li for-each=starters as="starter" index-as="idx">#{{ idx }} {{ starter.name }} - {{ starter.type }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -124,13 +124,13 @@ main() {
|
||||||
</h1>
|
</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
Bulbasaur - Grass
|
#0 Bulbasaur - Grass
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Charmander - Fire
|
#1 Charmander - Fire
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Squirtle - Water
|
#2 Squirtle - Water
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue