Skip to content
This repository has been archived by the owner on Feb 17, 2020. It is now read-only.

Commit

Permalink
Add index-as test
Browse files Browse the repository at this point in the history
  • Loading branch information
thosakwe committed Jun 27, 2018
1 parent f811dfc commit 5a7eccb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
14 changes: 12 additions & 2 deletions jael.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@
<excludeFolder url="file://$MODULE_DIR$/angel_jael/build" />
</content>
<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/build" />
</content>
<content url="file://$MODULE_DIR$/dsx" />
<content url="file://$MODULE_DIR$/dsx_generator" />
<content url="file://$MODULE_DIR$/dsx">
<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">
<excludeFolder url="file://$MODULE_DIR$/jael/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/jael/.pub" />
<excludeFolder url="file://$MODULE_DIR$/jael/build" />
</content>
<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/build" />
</content>
Expand Down
4 changes: 2 additions & 2 deletions jael/lib/src/renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ class Renderer {
.firstWhere((a) => a.name == 'index-as', orElse: () => null);
var alias = asAttribute?.value?.compute(scope) ?? 'item';
var indexAs = indexAsAttribute?.value?.compute(scope)?.toString() ?? 'item';
var otherAttributes =
element.attributes.where((a) => a.name != 'for-each' && a.name != 'as');
var otherAttributes = element.attributes.where(
(a) => a.name != 'for-each' && a.name != 'as' && a.name != 'index-as');
Element strippedElement;

if (element is SelfClosingElement)
Expand Down
8 changes: 4 additions & 4 deletions jael/test/render/render_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ main() {
<body>
<h1>Pokémon</h1>
<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>
</body>
</html>
Expand All @@ -124,13 +124,13 @@ main() {
</h1>
<ul>
<li>
Bulbasaur - Grass
#0 Bulbasaur - Grass
</li>
<li>
Charmander - Fire
#1 Charmander - Fire
</li>
<li>
Squirtle - Water
#2 Squirtle - Water
</li>
</ul>
</body>
Expand Down

0 comments on commit 5a7eccb

Please sign in to comment.