mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixed support for using native for loops
This commit is contained in:
parent
df86ec83ae
commit
2ac6d56a8e
@ -234,7 +234,9 @@ ForNode.prototype = {
|
||||
}
|
||||
}, this).line('});');
|
||||
} else {
|
||||
if (this.getProperty('forLoop') === true) {
|
||||
var forLoopProp = this.getProperty('forLoop');
|
||||
|
||||
if (forLoopProp && forLoopProp.toString() === 'true') {
|
||||
forEachParams = [
|
||||
'__array',
|
||||
'__index',
|
||||
|
||||
@ -159,6 +159,10 @@ describe('marko/marko' , function() {
|
||||
testRender("test-project/html-templates/looping.marko", {}, done);
|
||||
});
|
||||
|
||||
it.only("should allow for looping (native for-loop)", function(done) {
|
||||
testRender("test-project/html-templates/looping-native-for-loop.marko", {}, done);
|
||||
});
|
||||
|
||||
it("should allow for looping over properties", function(done) {
|
||||
testRender("test-project/html-templates/looping-props.marko", {}, done);
|
||||
});
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
<for each="item in ['a', 'b', 'c']" for-loop="true">
|
||||
${item}
|
||||
</for>
|
||||
<div for="item in ['red', 'green', 'blue']; for-loop=true" >
|
||||
${item}
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
abc<div>red</div><div>green</div><div>blue</div>
|
||||
Loading…
x
Reference in New Issue
Block a user