Added failing test for issue #88

This commit is contained in:
Patrick Steele-Idem 2015-06-05 19:02:07 -06:00
parent 70c3e0bc2a
commit 89a8228987
5 changed files with 50 additions and 0 deletions

View File

@ -294,4 +294,46 @@ describe('marko/api' , function() {
});
});
it('should allow global data with callback-style render', function(done) {
var template = marko.load(nodePath.join(__dirname, 'fixtures/templates/api-tests/global-data.marko'));
template.render({
$global: {
foo: 'bar'
}
},
function(err, output) {
if (err) {
return done(err);
}
expect(output).to.equal('bar');
done();
});
});
it('should allow global data with render to writable stream', function(done) {
var output = '';
var stream = through(function write(data) {
output += data;
});
stream.on('end', function() {
expect(output).to.equal('bar');
done();
})
.on('error', function(e) {
done(e);
});
var template = marko.load(nodePath.join(__dirname, 'fixtures/templates/api-tests/global-data.marko'));
template.render(
{
$global: {
foo: 'bar'
}
},
stream);
});
});

View File

@ -0,0 +1 @@
${out.global.foo}

View File

@ -0,0 +1 @@
Global: bar

View File

@ -0,0 +1 @@
Global: ${out.global.foo}

View File

@ -0,0 +1,5 @@
exports.templateData = {
$global: {
foo: 'bar'
}
};