aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2013-02-13 12:14:20 -0500
committerRick Waldron <waldron.rick@gmail.com>2013-02-13 12:14:20 -0500
commit93043d002a5ec8646cbd9d5658434848a1d07a49 (patch)
tree4022f7907d7ebac54320575f63cfa21f4f8f29ed /test
parentb734666f4d2e9a92b8ebb99db5b05bd4c82e71f2 (diff)
downloadjquery-93043d002a5ec8646cbd9d5658434848a1d07a49.tar.gz
jquery-93043d002a5ec8646cbd9d5658434848a1d07a49.zip
Refactor: Data.prototype.access. Thanks to @RubyLouvre and @gibson042. Closes #1167
Diffstat (limited to 'test')
-rw-r--r--test/unit/data.js34
1 files changed, 26 insertions, 8 deletions
diff --git a/test/unit/data.js b/test/unit/data.js
index 4307ac2dc..64cd04e90 100644
--- a/test/unit/data.js
+++ b/test/unit/data.js
@@ -7,29 +7,47 @@ test("expando", function(){
});
test( "jQuery.data & removeData, expected returns", function() {
- expect(2);
+ expect(4);
+ var elem = document.body;
equal(
- jQuery.data( document.body, "hello", "world" ), "world",
+ jQuery.data( elem, "hello", "world" ), "world",
"jQuery.data( elem, key, value ) returns value"
);
equal(
- jQuery.removeData( document.body, "hello" ), undefined,
+ jQuery.data( elem, "hello" ), "world",
+ "jQuery.data( elem, key ) returns value"
+ );
+ deepEqual(
+ jQuery.data( elem, { goodnight: "moon" }), { goodnight: "moon" },
+ "jQuery.data( elem, key, obj ) returns obj"
+ );
+ equal(
+ jQuery.removeData( elem, "hello" ), undefined,
"jQuery.removeData( elem, key, value ) returns undefined"
);
});
test( "jQuery._data & _removeData, expected returns", function() {
- expect(2);
+ expect(4);
+ var elem = document.body;
equal(
- jQuery._data( document.body, "hello", "world" ), "world",
- "jQuery.data( elem, key, value ) returns value"
+ jQuery._data( elem, "hello", "world" ), "world",
+ "jQuery._data( elem, key, value ) returns value"
);
equal(
- jQuery._removeData( document.body, "hello" ), undefined,
- "jQuery.removeData( elem, key, value ) returns undefined"
+ jQuery._data( elem, "hello" ), "world",
+ "jQuery._data( elem, key ) returns value"
+ );
+ deepEqual(
+ jQuery._data( elem, { goodnight: "moon" }), { goodnight: "moon" },
+ "jQuery._data( elem, obj ) returns obj"
+ );
+ equal(
+ jQuery._removeData( elem, "hello" ), undefined,
+ "jQuery._removeData( elem, key, value ) returns undefined"
);
});