added two more negative case tests

This commit is contained in:
John Bender 2010-11-18 00:43:18 -08:00
parent 04a29ba83b
commit 3834f56d35

View file

@ -5,12 +5,34 @@
(function( $ ) {
test( "getting data attributes from creation options", function(){
expect( 1 );
var result, expected = "bizzle";
var expected = "bizzle";
$.mobile.widget.prototype.options = { "fooBar" : true };
$.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">");
result = $.mobile.widget.prototype._getCreateOptions();
same(result["fooBar"], expected);
same($.mobile.widget.prototype._getCreateOptions()["fooBar"],
expected);
});
test( "getting an no data when the options are empty", function(){
expect( 1 );
var expected = {};
$.mobile.widget.prototype.options = {};
$.mobile.widget.prototype.element = $("<div data-foo-bar=" + expected + ">");
same($.mobile.widget.prototype._getCreateOptions(),
expected);
});
test( "getting no data when the element has none", function(){
expect( 1 );
var expected = {};
$.mobile.widget.prototype.options = { "fooBar" : true };
$.mobile.widget.prototype.element = $("<div>");
same($.mobile.widget.prototype._getCreateOptions(),
expected);
});
})(jQuery);