aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-07-05 17:21:58 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-07-05 17:21:58 -0400
commitcdd5132dcc02d4a3ff8df390677ffb8ff4b5a477 (patch)
treebc940409bbeff4c1279b4d2132801806e456b062 /test
parent1e027610d6000494558da753ce5601a05319408b (diff)
downloadjquery-cdd5132dcc02d4a3ff8df390677ffb8ff4b5a477.tar.gz
jquery-cdd5132dcc02d4a3ff8df390677ffb8ff4b5a477.zip
Fix #12026. Let props in $(html, props) be any jQuery.fn method.
Closes gh-839.
Diffstat (limited to 'test')
-rw-r--r--test/unit/core.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index 58305b688..44920edcf 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -35,20 +35,24 @@ test("jQuery()", function() {
"id": "test3"
};
+ // The $(html, props) signature can stealth-call any $.fn method, check for a
+ // few here but beware of modular builds where these methods may be excluded.
if ( jQuery.fn.width ) {
expected++;
attrObj["width"] = 10;
}
-
if ( jQuery.fn.offset ) {
expected++;
attrObj["offset"] = { "top": 1, "left": 1 };
}
-
- if ( jQuery.css ) {
+ if ( jQuery.fn.css ) {
expected += 2;
attrObj["css"] = { "paddingLeft": 1, "paddingRight": 1 };
}
+ if ( jQuery.fn.attr ) {
+ expected++;
+ attrObj.attr = { "desired": "very" };
+ }
expect( expected );
@@ -107,11 +111,15 @@ test("jQuery()", function() {
equal( elem[0].style.top, "1px", "jQuery() quick setter offset");
}
- if ( jQuery.css ) {
+ if ( jQuery.fn.css ) {
equal( elem[0].style.paddingLeft, "1px", "jQuery quick setter css");
equal( elem[0].style.paddingRight, "1px", "jQuery quick setter css");
}
+ if ( jQuery.fn.attr ) {
+ equal( elem[0].getAttribute("desired"), "very", "jQuery quick setter attr");
+ }
+
equal( elem[0].childNodes.length, 1, "jQuery quick setter text");
equal( elem[0].firstChild.nodeValue, "test", "jQuery quick setter text");
equal( elem[0].className, "test2", "jQuery() quick setter class");