Provide Handlebars.noConflict implementation

Allows for users who are loading via a global pattern to avoid conflicting with other instances of the library.

Fixes #887
This commit is contained in:
kpdecker
2014-11-26 07:48:45 -06:00
parent 617dd57162
commit c4b3c901a5
5 changed files with 40 additions and 2 deletions
+18
View File
@@ -60,4 +60,22 @@ describe('runtime', function() {
equal(template._child(1, undefined, [{bar: 'baz'}])(), 'baz');
});
});
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;
});
});
});