mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-08 03:00:26 -04:00
merging in setDomLibrary
This commit is contained in:
30
test/setdomlibrary.js
Normal file
30
test/setdomlibrary.js
Normal file
@@ -0,0 +1,30 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// a mock object that looks sufficiently jQuery-ish
|
||||
var myLib = function() {
|
||||
return {
|
||||
attr: function() { return "spam" },
|
||||
html: function() { return "spam" },
|
||||
hasClass: function() { return "spam" }
|
||||
};
|
||||
};
|
||||
|
||||
var viewAttrs = { id: 'test-setdomlibrary', className: 'test-setdomlibrary' }
|
||||
|
||||
module("Backbone.setDomLibrary");
|
||||
|
||||
test('Changing jQuery library to custom library', function() {
|
||||
Backbone.setDomLibrary(myLib);
|
||||
var view = new Backbone.View(viewAttrs);
|
||||
|
||||
ok(view.$el.hasClass('test-setdomlibrary') === 'spam');
|
||||
});
|
||||
|
||||
test('Changing jQuery library back to global jQuery', function() {
|
||||
Backbone.setDomLibrary(jQuery);
|
||||
var view = new Backbone.View(viewAttrs);
|
||||
|
||||
ok(view.$el.hasClass('test-setdomlibrary'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -21,6 +21,7 @@
|
||||
<script type="text/javascript" src="view.js"></script>
|
||||
<script type="text/javascript" src="sync.js"></script>
|
||||
<script type="text/javascript" src="speed.js"></script>
|
||||
<script type="text/javascript" src="setdomlibrary.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">Backbone Test Suite</h1>
|
||||
|
||||
Reference in New Issue
Block a user