Skip to content

Commit

Permalink
Add failing test case for duplicate block
Browse files Browse the repository at this point in the history
[see #2367]
  • Loading branch information
ForbesLindesay committed Jan 24, 2017
1 parent 298d87d commit d91bab7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 24 deletions.
22 changes: 0 additions & 22 deletions packages/pug-linker/test/common.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/pug-linker/test/index.test.js
@@ -1,8 +1,6 @@
var assert = require('assert');
var fs = require('fs');
var link = require('../');
var prettyStringify = require('./common').prettyStringify;
var assertObjEqual = require('./common').assertObjEqual;

function testDir (dir) {
fs.readdirSync(dir).forEach(function (name) {
Expand Down
@@ -0,0 +1,3 @@
exports[`test layout with duplicate block 1`] = `"<div>Hello World</div>"`;

exports[`test layout with duplicate block 2`] = `"<!DOCTYPE html><html><head></head><body><div>Hello World</div></body></html>"`;
4 changes: 4 additions & 0 deletions packages/pug/test/duplicate-block/index.pug
@@ -0,0 +1,4 @@
extends ./layout-with-duplicate-block.pug

block content
div Hello World
14 changes: 14 additions & 0 deletions packages/pug/test/duplicate-block/index.test.js
@@ -0,0 +1,14 @@
const pug = require('../../');

test('layout with duplicate block', () => {
const outputWithAjax = pug.renderFile(
__dirname + '/index.pug',
{ajax: true}
);
const outputWithoutAjax = pug.renderFile(
__dirname + '/index.pug',
{ajax: false}
);
expect(outputWithAjax).toMatchSnapshot();
expect(outputWithoutAjax).toMatchSnapshot();
});
@@ -0,0 +1,8 @@
if ajax
block content
else
doctype html
html
head
body
block content

0 comments on commit d91bab7

Please sign in to comment.