aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-06-05 16:38:18 -0400
committerRick Waldron <waldron.rick@gmail.com>2012-06-05 16:38:18 -0400
commite680f36ca096090a6e699ce0eece5b3635a46f47 (patch)
tree5292f7cd02f177e5306e8532730976342059ba9b /test
parent3225d6149655f68939111ffc76a1dffeb329afe9 (diff)
downloadjquery-e680f36ca096090a6e699ce0eece5b3635a46f47.tar.gz
jquery-e680f36ca096090a6e699ce0eece5b3635a46f47.zip
Fix busted tests that relied on width in 2nd param to jQuery(), dimensions stays modular. (core, attributes, offset)
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/unit/attributes.js24
-rw-r--r--test/unit/core.js36
-rw-r--r--test/unit/offset.js7
3 files changed, 47 insertions, 20 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 95dfd7669..7dec60619 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -383,17 +383,27 @@ test("attr(jquery_method)", function(){
$elem.attr({css: {color: "red"}}, true);
ok( /^(#ff0000|red)$/i.test(elem.style.color), "attr(css)");
- $elem.attr({height: 10}, true);
- equal( elem.style.height, "10px", "attr(height)");
+ if ( jQuery.fn.width ) {
+ $elem.attr({height: 10}, true);
+ equal( elem.style.height, "10px", "attr(height)");
- // Multiple attributes
-
- $elem.attr({
+ // Multiple attributes
+ $elem.attr({
width:10,
css:{ paddingLeft:1, paddingRight:1 }
- }, true);
+ }, true);
+
+ equal( elem.style.width, "10px", "attr({...})");
+ } else {
+
+ $elem.attr({
+ css:{ paddingLeft:1, paddingRight:1 }
+ }, true);
+
+ ok( true, "DUMMY: attr(height)" );
+ ok( true, "DUMMY: attr({...})" );
+ }
- equal( elem.style.width, "10px", "attr({...})");
equal( elem.style.paddingLeft, "1px", "attr({...})");
equal( elem.style.paddingRight, "1px", "attr({...})");
});
diff --git a/test/unit/core.js b/test/unit/core.js
index 4605795b4..f7de6c702 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -70,18 +70,32 @@ test("jQuery()", function() {
equal( jQuery(document.body).get(0), jQuery("body").get(0), "Test passing an html node to the factory" );
- var exec = false;
-
- var elem = jQuery("<div/>", {
- width: 10,
- css: { paddingLeft:1, paddingRight:1 },
- click: function(){ ok(exec, "Click executed."); },
- text: "test",
- "class": "test2",
- id: "test3"
- });
+ var exec = false,
+ elem;
+
+ if ( jQuery.fn.width ) {
+ elem = jQuery("<div/>", {
+ width: 10,
+ css: { paddingLeft:1, paddingRight:1 },
+ click: function(){ ok(exec, "Click executed."); },
+ text: "test",
+ "class": "test2",
+ id: "test3"
+ });
+
+ equal( elem[0].style.width, "10px", "jQuery() quick setter width");
+ } else {
+ elem = jQuery("<div/>", {
+ css: { paddingLeft:1, paddingRight:1 },
+ click: function(){ ok(exec, "Click executed."); },
+ text: "test",
+ "class": "test2",
+ id: "test3"
+ });
+
+ ok( true, "DUMMY: jQuery() quick setter width");
+ }
- equal( elem[0].style.width, "10px", "jQuery() quick setter width");
equal( elem[0].style.paddingLeft, "1px", "jQuery quick setter css");
equal( elem[0].style.paddingRight, "1px", "jQuery quick setter css");
equal( elem[0].childNodes.length, 1, "jQuery quick setter text");
diff --git a/test/unit/offset.js b/test/unit/offset.js
index 6664a6bdb..750228281 100644
--- a/test/unit/offset.js
+++ b/test/unit/offset.js
@@ -14,13 +14,16 @@ var supportsScroll = false;
testIframe("offset/absolute", "absolute", function($, iframe) {
expect(4);
- var doc = iframe.document, tests;
+ var doc = iframe.document,
+ tests, forceScroll;
// force a scroll value on the main window
// this insures that the results will be wrong
// if the offset method is using the scroll offset
// of the parent window
- var forceScroll = jQuery("<div>", { width: 2000, height: 2000 }).appendTo("body");
+ forceScroll = jQuery("<div>").css({ width: 2000, height: 2000 });
+ forceScroll.appendTo("body");
+
window.scrollTo(200, 200);
if ( document.documentElement.scrollTop || document.body.scrollTop ) {