Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases for @block-partial issue in Handlebars engine #548

Merged
merged 1 commit into from
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions test/engine_handlebars_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,42 @@ tap.test('hidden handlebars patterns can be called by their nice names', functio
test.equals(util.sanitized(testPattern.render()), util.sanitized('Here\'s the hidden atom: [I\'m the hidden atom\n]\n'));
test.end();
});

tap.test('@partial-block template should render without throwing (@geoffp repo issue #3)', function(test) {
test.plan(1);

var patternPath = path.join('00-atoms', '00-global', '10-at-partial-block.hbs');

// do all the normal processing of the pattern
var patternlab = new fakePatternLab();
var assembler = new pa();
var atPartialBlockPattern = assembler.process_pattern_iterative(patternPath, patternlab);
assembler.process_pattern_recursive(patternPath, patternlab);

var results = '{{> @partial-block }}' + eol + 'It worked!' + eol;
test.equal(atPartialBlockPattern.render(), results);
test.end();
})

tap.test('A template calling a @partial-block template should render correctly', function(test) {
test.plan(1);

// pattern paths
var pattern1Path = path.join('00-atoms', '00-global', '10-at-partial-block.hbs');
var pattern2Path = path.join('00-molecules', '00-global', '10-call-at-partial-block.hbs');

// set up environment
var patternlab = new fakePatternLab(); // environment
var assembler = new pa();

// do all the normal processing of the pattern
assembler.process_pattern_iterative(pattern1Path, patternlab);
var callAtPartialBlockPattern = assembler.process_pattern_iterative(pattern2Path, patternlab);
assembler.process_pattern_recursive(pattern1Path, patternlab);
assembler.process_pattern_recursive(pattern2Path, patternlab);

// test
var results = 'Hello World!' + eol + 'It worked!' + eol;
test.equals(callAtPartialBlockPattern.render(), results);
test.end();
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{> @partial-block }}
It worked!
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#> atoms-at-partial-block }}
Hello World!
{{/atoms-at-partial-block}}