mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added a test case for using load with a required compiled JS template module
This commit is contained in:
parent
ea44bf17a1
commit
37423a1965
@ -256,4 +256,24 @@ describe('marko/api' , function() {
|
||||
expect(e).to.not.equal(undefined);
|
||||
});
|
||||
|
||||
it('should allow a template to be loaded from a compiled JS module', function(done) {
|
||||
// Load the JS file to ensure the hello.marko.js file is created
|
||||
marko.load(nodePath.join(__dirname, 'fixtures/templates/api-tests/hello.marko'))
|
||||
|
||||
var templateModule = require(nodePath.join(__dirname, 'fixtures/templates/api-tests/hello.marko.js'));
|
||||
|
||||
var template = marko.load(templateModule);
|
||||
template.render({
|
||||
name: 'John'
|
||||
},
|
||||
function(err, output) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
expect(output).to.equal('Hello John!');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user