forked from jashkenas/backbone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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')); | ||
}); | ||
|
||
}); |
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