mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added failing test for issue #88
This commit is contained in:
parent
70c3e0bc2a
commit
89a8228987
@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
1
test/fixtures/templates/api-tests/global-data.marko
vendored
Normal file
1
test/fixtures/templates/api-tests/global-data.marko
vendored
Normal file
@ -0,0 +1 @@
|
||||
${out.global.foo}
|
||||
1
test/fixtures/templates/global-data/expected.html
vendored
Normal file
1
test/fixtures/templates/global-data/expected.html
vendored
Normal file
@ -0,0 +1 @@
|
||||
Global: bar
|
||||
1
test/fixtures/templates/global-data/template.marko
vendored
Normal file
1
test/fixtures/templates/global-data/template.marko
vendored
Normal file
@ -0,0 +1 @@
|
||||
Global: ${out.global.foo}
|
||||
5
test/fixtures/templates/global-data/test.js
vendored
Normal file
5
test/fixtures/templates/global-data/test.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
exports.templateData = {
|
||||
$global: {
|
||||
foo: 'bar'
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user