Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make template live reload account for dependencies
Fixes #57.
- Loading branch information
Showing
5 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
BEGIN %*ENV<CRO_DEV> = True; | ||
use Test; | ||
use Cro::WebApp::Template; | ||
plan 2; | ||
plan 4; | ||
|
||
my $test-file = $*PROGRAM.parent.add('test-data').add('reload.crotmp'); | ||
END try unlink $test-file; | ||
$test-file.spurt: 'Hello <.name>.'; | ||
is render-template($test-file, {name => "World"}), 'Hello World.'; | ||
is render-template($test-file, {name => "World"}), 'Hello World.', | ||
'Correct rendering before change'; | ||
|
||
$test-file.spurt: 'Goodbye <.name>!'; | ||
is render-template($test-file, {name => "dlroW"}), 'Goodbye dlroW!'; | ||
is render-template($test-file, {name => "dlroW"}), 'Goodbye dlroW!', | ||
'Change was detected'; | ||
|
||
my $used-file = $*PROGRAM.parent.add('test-data').add('reload-used.crotmp'); | ||
END try unlink $used-file; | ||
$used-file.spurt: "<:sub foo>yes!</:>"; | ||
my $using-file = $*PROGRAM.parent.add('test-data').add('reload-using.crotmp'); | ||
END try unlink $using-file; | ||
$using-file.spurt: "<:use 'reload-used.crotmp'><&foo>"; | ||
template-location $*PROGRAM.parent.add('test-data'); | ||
is render-template($using-file, {}), 'yes!', | ||
'Correct rendering involving `use` before change'; | ||
|
||
$used-file.spurt: "<:sub foo>no!</:>"; | ||
is render-template($using-file, {}), 'no!', | ||
'Change in used module was detected'; |