Skip to content

Commit

Permalink
Unit test for #2404 Extends extending even when in if block (#2743)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls authored and ForbesLindesay committed Apr 26, 2017
1 parent ec18ece commit 5c704b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/pug/test/pug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,15 @@ describe('pug', function(){
it('does not produce warnings for issue-1593', function () {
pug.compileFile(__dirname + '/fixtures/issue-1593/index.pug');
});
it('does throw error for issue-2404', function () {
var message = '';
try {
pug.compileFile(__dirname + '/fixtures/issue-2404/mixin.call.extends.pug');
} catch (e) {
message = e.message;
}
assert(message.indexOf('Declaration of template inheritance ("extends") should be the first thing in the file.') !== -1);
});
it('should support caching (pass 1)', function () {
fs.writeFileSync(__dirname + '/temp/input-compileFile.pug', '.foo bar');
var fn = pug.compileFile(__dirname + '/temp/input-compileFile.pug',
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/issue-2404/default.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
body
block content
10 changes: 10 additions & 0 deletions test/fixtures/issue-2404/mixin.call.extends.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
mixin content
if bar
extends default
block content
block
else
block

+content
h1 Hello!

0 comments on commit 5c704b2

Please sign in to comment.