Skip to content

Commit

Permalink
Add regression tests for #2436
Browse files Browse the repository at this point in the history
  • Loading branch information
Secbone authored and ForbesLindesay committed May 1, 2017
1 parent df7d661 commit 65e445e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/pug/test/regression-2436/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
exports[`test #2436 - block with a same name extends from different layout in nesting 1`] = `
"
<h1>layout </h1>
<p>Other A</p>
<h1>other layout</h1>
<p>Other A</p>"
`;

exports[`test #2436 - block with a same name extends from the same layout in nesting 1`] = `
"
<h1>layout </h1>
<p>Other A</p>
<h1>layout </h1>
<p>Other A</p>"
`;
17 changes: 17 additions & 0 deletions packages/pug/test/regression-2436/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const pug = require('../../');

test('#2436 - block with a same name extends from the same layout in nesting', () => {
const output = pug.renderFile(
__dirname + '/issue1.pug',
{pretty: true}
);
expect(output).toMatchSnapshot();
});

test('#2436 - block with a same name extends from different layout in nesting', () => {
const output = pug.renderFile(
__dirname + '/issue2.pug',
{pretty: true}
);
expect(output).toMatchSnapshot();
});
7 changes: 7 additions & 0 deletions packages/pug/test/regression-2436/issue1.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends layout.pug

block a
p Main A

block b
include other1.pug
7 changes: 7 additions & 0 deletions packages/pug/test/regression-2436/issue2.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends layout.pug

block a
p Main A

block b
include other2.pug
6 changes: 6 additions & 0 deletions packages/pug/test/regression-2436/layout.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
h1 layout

block a
p block in layout

block b
4 changes: 4 additions & 0 deletions packages/pug/test/regression-2436/other1.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends layout.pug

block a
p Other A
4 changes: 4 additions & 0 deletions packages/pug/test/regression-2436/other2.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends other_layout.pug

block a
p Other A
4 changes: 4 additions & 0 deletions packages/pug/test/regression-2436/other_layout.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
h1 other layout

block a
p block in other layout

0 comments on commit 65e445e

Please sign in to comment.