docs(for): document that dictionary for doesn't support space
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
- `for` block now allows you to iterate over array of tuples or dictionaries.
|
- `for` block now allows you to iterate over array of tuples or dictionaries.
|
||||||
|
|
||||||
```html+django
|
```html+django
|
||||||
{% for key, value in thing %}
|
{% for key,value in thing %}
|
||||||
<li>{{ key }}: {{ value }}</li>
|
<li>{{ key }}: {{ value }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -127,6 +127,18 @@ func testForNode() {
|
|||||||
try expect(result) == fixture
|
try expect(result) == fixture
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$0.it("can iterate over dictionary") {
|
||||||
|
let templateString = "{% for key,value in dict %}" +
|
||||||
|
"{{ key }}: {{ value }}\n" +
|
||||||
|
"{% endfor %}\n"
|
||||||
|
|
||||||
|
let template = Template(templateString: templateString)
|
||||||
|
let result = try template.render(context)
|
||||||
|
|
||||||
|
let fixture = "one: I\ntwo: II\n\n"
|
||||||
|
try expect(result) == fixture
|
||||||
|
}
|
||||||
|
|
||||||
$0.it("renders supports iterating over dictionary") {
|
$0.it("renders supports iterating over dictionary") {
|
||||||
let nodes: [NodeType] = [VariableNode(variable: "key")]
|
let nodes: [NodeType] = [VariableNode(variable: "key")]
|
||||||
let emptyNodes: [NodeType] = [TextNode(text: "empty")]
|
let emptyNodes: [NodeType] = [TextNode(text: "empty")]
|
||||||
|
|||||||
Reference in New Issue
Block a user