mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Inherit parent vars and add own vars when a template is included with vars from another template that has vars; add unit tests for vars inheritance
This commit is contained in:
parent
5b47151440
commit
6085b82d19
7 changed files with 92 additions and 12 deletions
3
tests/_data/template/incl/scopetest1.html
Normal file
3
tests/_data/template/incl/scopetest1.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<config version="2" />
|
||||
<div>{{ $foobar }}</div>
|
||||
<div>{{ $globalonly }}</div>
|
||||
5
tests/_data/template/incl/scopetest2.html
Normal file
5
tests/_data/template/incl/scopetest2.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<config version="2" />
|
||||
<div class="self">{{ $foobar }}</div>
|
||||
<div class="incl">
|
||||
<include src="incl/scopetest1.html" vars="['foobar' => 'Included #3']" />
|
||||
</div>
|
||||
18
tests/_data/template/v2varscope.executed.html
Normal file
18
tests/_data/template/v2varscope.executed.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
<div class="global">
|
||||
<div>Rhymix Template</div>
|
||||
<div>Context Variable</div>
|
||||
</div>
|
||||
|
||||
<div class="test1">
|
||||
<div>Included #1</div>
|
||||
<div></div>
|
||||
</div>
|
||||
|
||||
<div class="test2">
|
||||
<div class="self">Included #2</div>
|
||||
<div class="incl">
|
||||
<div>Included #3</div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
18
tests/_data/template/v2varscope.html
Normal file
18
tests/_data/template/v2varscope.html
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
@version(2)
|
||||
|
||||
@php
|
||||
$foobar = 'Rhymix Template';
|
||||
$globalonly = 'Context Variable';
|
||||
@endphp
|
||||
|
||||
<div class="global">
|
||||
@include ('incl/scopetest1.html')
|
||||
</div>
|
||||
|
||||
<div class="test1">
|
||||
@include ('incl/scopetest1.html', ['foobar' => 'Included #1'])
|
||||
</div>
|
||||
|
||||
<div class="test2">
|
||||
@include ('incl/scopetest2.html', ['foobar' => 'Included #2'])
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue