mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
Add loop variable and dump directive; reorganize template v2 unit tests
This commit is contained in:
parent
fe804163bf
commit
a6afa3a61d
7 changed files with 394 additions and 41 deletions
22
tests/_data/template/v2loops.html
Normal file
22
tests/_data/template/v2loops.html
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
@version(2)
|
||||
|
||||
@php
|
||||
$foo = ['red', 'blue', 'yellow', 'black', 'white'];
|
||||
$bar = ['dog', 'cat', 'rabbit', 'panda', 'otter'];
|
||||
@endphp
|
||||
|
||||
<h1>Pets</h1>
|
||||
|
||||
<ul>
|
||||
@foreach ($foo as $color)
|
||||
@foreach ($bar as $animal)
|
||||
<li>
|
||||
<span>A {{ $color }} {{ $animal }}</span>
|
||||
<span>current index {{ $loop->index }} of {{ $loop->count }}</span>
|
||||
<span>parent index {{ $loop->parent->index }} of {{ $loop->parent->count }}</span>
|
||||
<span>first: @dump($loop->first)</span>
|
||||
<span>last: @dump($loop->last)</span>
|
||||
</li>
|
||||
@endforeach
|
||||
@endforeach
|
||||
</ul>
|
||||
Loading…
Add table
Add a link
Reference in a new issue