Skip to content

Commit

Permalink
Add test for idx in nested loops
Browse files Browse the repository at this point in the history
  • Loading branch information
rragan committed Aug 21, 2012
1 parent 54f29ae commit 0f0bdf9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dustjs-helpers/test/jasmine-test/spec/helpersTests.js
Expand Up @@ -391,6 +391,13 @@ var helpersTests = [
context: { names: ["Moe", "Larry", "Curly"] },
expected: "0Moe 1Larry 2Curly ",
message: "test array reference $idx/$len {#.} section case"
},
{
name: "array reference $idx/$len nested loops",
source: "{#A}A loop:{$idx}-{$len},{#B}B loop:{$idx}-{$len}C[0]={.C[0]} {/B}A loop trailing: {$idx}-{$len}{/A}",
context: {"A": [ {"B": [ {"C": ["Ca1", "C2"]}, {"C": ["Ca2", "Ca22"]} ] }, {"B": [ {"C": ["Cb1", "C2"]}, {"C": ["Cb2", "Ca2"]} ] } ] },
expected: "A loop:0-2,B loop:0-2C[0]=Ca1 B loop:1-2C[0]=Ca2 A loop trailing: 0-2A loop:1-2,B loop:0-2C[0]=Cb1 B loop:1-2C[0]=Cb2 A loop trailing: 1-2",
message: "test array reference $idx/$len nested loops"
}
];

Expand Down

0 comments on commit 0f0bdf9

Please sign in to comment.