-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change/test to support VARIABLES config option.
- Loading branch information
Showing
3 changed files
with
48 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var t = new Test.Jemplate(); | ||
|
||
t.plan(3); | ||
|
||
t.compile(); | ||
|
||
var j = new Jemplate(); | ||
var jVAR = new Jemplate({VARIABLES:{who:'Beaver'}}); | ||
|
||
var test1 = t.state.blocks.shift(); | ||
t.is( | ||
j.process('hello', {who: 'Wally'}), | ||
test1.data.output, | ||
test1.name | ||
); | ||
|
||
var test2 = t.state.blocks.shift(); | ||
t.is( | ||
jVAR.process('hello',{}), | ||
test2.data.output, | ||
test2.name | ||
); | ||
|
||
var test3 = t.state.blocks.shift(); | ||
t.is( | ||
jVAR.process('hello', {who: 'Wally'}), | ||
test3.data.output, | ||
test3.name | ||
); | ||
|
||
|
||
/* Test | ||
=== Test without VARIABLES set in config hash | ||
--- output | ||
Hello, Wally! | ||
=== Test with VARIABLES set in config hash | ||
--- output | ||
Hello, Beaver! | ||
=== Test with VARIABLES set in config hash being overridden by local var | ||
--- output | ||
Hello, Wally! | ||
*/ |