Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
handlebars.js/spec/runtime.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
76 lines (72 sloc)
1.87 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('runtime', function () { | |
describe('#template', function () { | |
it('should throw on invalid templates', function () { | |
shouldThrow( | |
function () { | |
Handlebars.template({}); | |
}, | |
Error, | |
'Unknown template object: object' | |
); | |
shouldThrow( | |
function () { | |
Handlebars.template(); | |
}, | |
Error, | |
'Unknown template object: undefined' | |
); | |
shouldThrow( | |
function () { | |
Handlebars.template(''); | |
}, | |
Error, | |
'Unknown template object: string' | |
); | |
}); | |
it('should throw on version mismatch', function () { | |
shouldThrow( | |
function () { | |
Handlebars.template({ | |
main: {}, | |
compiler: [Handlebars.COMPILER_REVISION + 1], | |
}); | |
}, | |
Error, | |
/Template was precompiled with a newer version of Handlebars than the current runtime/ | |
); | |
shouldThrow( | |
function () { | |
Handlebars.template({ | |
main: {}, | |
compiler: [Handlebars.LAST_COMPATIBLE_COMPILER_REVISION - 1], | |
}); | |
}, | |
Error, | |
/Template was precompiled with an older version of Handlebars than the current runtime/ | |
); | |
shouldThrow( | |
function () { | |
Handlebars.template({ | |
main: {}, | |
}); | |
}, | |
Error, | |
/Template was precompiled with an older version of Handlebars than the current runtime/ | |
); | |
}); | |
}); | |
describe('#noConflict', function () { | |
if (!CompilerContext.browser) { | |
return; | |
} | |
it('should reset on no conflict', function () { | |
var reset = Handlebars; | |
Handlebars.noConflict(); | |
equal(Handlebars, 'no-conflict'); | |
Handlebars = 'really, none'; | |
reset.noConflict(); | |
equal(Handlebars, 'really, none'); | |
Handlebars = reset; | |
}); | |
}); | |
}); |