|
245 | 245 | "parent": "{{#nested}}{{$block}}You say {{fruit}}.{{/block}}{{/nested}}"
|
246 | 246 | },
|
247 | 247 | "expected": "I say bananas."
|
| 248 | + }, |
| 249 | + { |
| 250 | + "name": "Standalone parent", |
| 251 | + "desc": "A parent's opening and closing tags need not be on separate lines in order to be standalone", |
| 252 | + "data": { |
| 253 | + }, |
| 254 | + "template": "Hi,\n {{<parent}}{{/parent}}\n", |
| 255 | + "partials": { |
| 256 | + "parent": "one\ntwo\n" |
| 257 | + }, |
| 258 | + "expected": "Hi,\n one\n two\n" |
| 259 | + }, |
| 260 | + { |
| 261 | + "name": "Standalone block", |
| 262 | + "desc": "A block's opening and closing tags need not be on separate lines in order to be standalone", |
| 263 | + "data": { |
| 264 | + }, |
| 265 | + "template": "{{<parent}}{{$block}}\none\ntwo{{/block}}\n{{/parent}}\n", |
| 266 | + "partials": { |
| 267 | + "parent": "Hi,\n {{$block}}{{/block}}\n" |
| 268 | + }, |
| 269 | + "expected": "Hi,\n one\n two\n" |
| 270 | + }, |
| 271 | + { |
| 272 | + "name": "Block reindentation", |
| 273 | + "desc": "Block indentation is removed at the site of definition and added at the site of expansion", |
| 274 | + "data": { |
| 275 | + }, |
| 276 | + "template": "{{<parent}}{{$block}}\n one\n two\n{{/block}}{{/parent}}\n", |
| 277 | + "partials": { |
| 278 | + "parent": "Hi,\n {{$block}}\n {{/block}}\n" |
| 279 | + }, |
| 280 | + "expected": "Hi,\n one\n two\n" |
| 281 | + }, |
| 282 | + { |
| 283 | + "name": "Intrinsic indentation", |
| 284 | + "desc": "When the block opening tag is standalone, indentation is determined by default content", |
| 285 | + "data": { |
| 286 | + }, |
| 287 | + "template": "{{<parent}}{{$block}}\none\ntwo\n{{/block}}{{/parent}}\n", |
| 288 | + "partials": { |
| 289 | + "parent": "Hi,\n{{$block}}\n default\n{{/block}}\n" |
| 290 | + }, |
| 291 | + "expected": "Hi,\n one\n two\n" |
| 292 | + }, |
| 293 | + { |
| 294 | + "name": "Nested block reindentation", |
| 295 | + "desc": "Nested blocks are reindented relative to the surrounding block", |
| 296 | + "data": { |
| 297 | + }, |
| 298 | + "template": "{{<parent}}{{$nested}}\nthree\n{{/nested}}{{/parent}}\n", |
| 299 | + "partials": { |
| 300 | + "parent": "{{<grandparent}}{{$block}}\n one\n {{$nested}}\n two\n {{/nested}}\n{{/block}}{{/grandparent}}\n", |
| 301 | + "grandparent": "{{$block}}default{{/block}}" |
| 302 | + }, |
| 303 | + "expected": "one\n three\n" |
248 | 304 | }
|
249 | 305 | ]
|
250 | 306 | }
|
0 commit comments