2010-11-18 08:37:10 +00:00
|
|
|
/*
|
|
|
|
|
* mobile widget unit tests
|
|
|
|
|
*/
|
2011-03-20 06:12:55 +00:00
|
|
|
(function($){
|
|
|
|
|
module('jquery.mobile.widget.js');
|
2010-11-18 08:37:10 +00:00
|
|
|
|
2011-03-20 06:12:55 +00:00
|
|
|
test( "getting data from creation options", function(){
|
|
|
|
|
var expected = "bizzle";
|
2010-11-19 07:47:40 +00:00
|
|
|
|
2011-03-20 06:12:55 +00:00
|
|
|
$.mobile.widget.prototype.options = { "fooBar" : true };
|
|
|
|
|
$.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">");
|
|
|
|
|
same($.mobile.widget.prototype._getCreateOptions()["fooBar"],
|
|
|
|
|
expected);
|
|
|
|
|
});
|
2010-11-18 08:37:10 +00:00
|
|
|
|
2011-03-20 06:12:55 +00:00
|
|
|
test( "getting no data when the options are empty", function(){
|
|
|
|
|
var expected = {};
|
2010-11-18 08:43:18 +00:00
|
|
|
|
2011-03-20 06:12:55 +00:00
|
|
|
$.mobile.widget.prototype.options = {};
|
|
|
|
|
$.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">");
|
|
|
|
|
same($.mobile.widget.prototype._getCreateOptions(),
|
|
|
|
|
expected);
|
|
|
|
|
});
|
2010-11-18 08:43:18 +00:00
|
|
|
|
2011-03-20 06:12:55 +00:00
|
|
|
test( "getting no data when the element has none", function(){
|
|
|
|
|
var expected = {};
|
2010-11-18 08:43:18 +00:00
|
|
|
|
2011-03-20 06:12:55 +00:00
|
|
|
$.mobile.widget.prototype.options = { "fooBar" : true };
|
|
|
|
|
$.mobile.widget.prototype.element = $("<div>");
|
|
|
|
|
same($.mobile.widget.prototype._getCreateOptions(),
|
|
|
|
|
expected);
|
|
|
|
|
});
|
|
|
|
|
})(jQuery);
|