diff --git a/packages/pug/test/regression-2436/__snapshots__/index.test.js.snap b/packages/pug/test/regression-2436/__snapshots__/index.test.js.snap new file mode 100644 index 000000000..afb4067e7 --- /dev/null +++ b/packages/pug/test/regression-2436/__snapshots__/index.test.js.snap @@ -0,0 +1,15 @@ +exports[`test #2436 - block with a same name extends from different layout in nesting 1`] = ` +" +
Other A
+Other A
" +`; + +exports[`test #2436 - block with a same name extends from the same layout in nesting 1`] = ` +" +Other A
+Other A
" +`; diff --git a/packages/pug/test/regression-2436/index.test.js b/packages/pug/test/regression-2436/index.test.js new file mode 100644 index 000000000..47a1ae44b --- /dev/null +++ b/packages/pug/test/regression-2436/index.test.js @@ -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(); +}); diff --git a/packages/pug/test/regression-2436/issue1.pug b/packages/pug/test/regression-2436/issue1.pug new file mode 100644 index 000000000..f521c6ea2 --- /dev/null +++ b/packages/pug/test/regression-2436/issue1.pug @@ -0,0 +1,7 @@ +extends layout.pug + +block a + p Main A + +block b + include other1.pug diff --git a/packages/pug/test/regression-2436/issue2.pug b/packages/pug/test/regression-2436/issue2.pug new file mode 100644 index 000000000..7acba598a --- /dev/null +++ b/packages/pug/test/regression-2436/issue2.pug @@ -0,0 +1,7 @@ +extends layout.pug + +block a + p Main A + +block b + include other2.pug diff --git a/packages/pug/test/regression-2436/layout.pug b/packages/pug/test/regression-2436/layout.pug new file mode 100644 index 000000000..71ad7eb93 --- /dev/null +++ b/packages/pug/test/regression-2436/layout.pug @@ -0,0 +1,6 @@ +h1 layout + +block a + p block in layout + +block b diff --git a/packages/pug/test/regression-2436/other1.pug b/packages/pug/test/regression-2436/other1.pug new file mode 100644 index 000000000..206cb4fc9 --- /dev/null +++ b/packages/pug/test/regression-2436/other1.pug @@ -0,0 +1,4 @@ +extends layout.pug + +block a + p Other A diff --git a/packages/pug/test/regression-2436/other2.pug b/packages/pug/test/regression-2436/other2.pug new file mode 100644 index 000000000..6329aebb0 --- /dev/null +++ b/packages/pug/test/regression-2436/other2.pug @@ -0,0 +1,4 @@ +extends other_layout.pug + +block a + p Other A diff --git a/packages/pug/test/regression-2436/other_layout.pug b/packages/pug/test/regression-2436/other_layout.pug new file mode 100644 index 000000000..edda16157 --- /dev/null +++ b/packages/pug/test/regression-2436/other_layout.pug @@ -0,0 +1,4 @@ +h1 other layout + +block a + p block in other layout