diff options
author | Rob Loach <robloach@gmail.com> | 2014-10-07 12:02:21 -0400 |
---|---|---|
committer | Rob Loach <robloach@gmail.com> | 2014-10-07 12:02:21 -0400 |
commit | 79a4179e1cd4f873fe4144dcf47425e773cb07f6 (patch) | |
tree | a1a52b8fbe931988d9a65883033cd8e2dcc5d341 /test | |
parent | 18dad06c6b8901314fba8eb5508673b30b82eb0a (diff) | |
download | jquery-once-79a4179e1cd4f873fe4144dcf47425e773cb07f6.zip jquery-once-79a4179e1cd4f873fe4144dcf47425e773cb07f6.tar.gz jquery-once-79a4179e1cd4f873fe4144dcf47425e773cb07f6.tar.bz2 |
Remove function callback
Diffstat (limited to 'test')
-rw-r--r-- | test/test.js | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/test/test.js b/test/test.js index 6e6353f..88d59e7 100644 --- a/test/test.js +++ b/test/test.js @@ -1,8 +1,6 @@ test("Properly executed", function() { // Create one once() call. - $('#test1 span').once(function() { - $(this).data('test1', 'foobar'); - }); + $('#test1 span').once().data('test1', 'foobar'); var data = $('#test1 span').data('test1'); ok(data === "foobar"); @@ -21,7 +19,7 @@ test("Called only once", function() { // Call once() a bunch of times. for (var i = 0; i < 10; i++) { - $('#test2 span').once('count', callback); + $('#test2 span').once('count').each(callback); } // Verify that it was only called once. @@ -35,9 +33,7 @@ test("Apply the value to data correctly", function() { ok(!hasData, 'Value not applied in the beginning.'); // Create one once() call. - $('#test3 span').once('test3', function() { - // Do nothing. - }); + $('#test3 span').once('test3'); // Verify the data is applied. hasData = $('#test3 span').data('jquery-once-test3'); @@ -46,9 +42,7 @@ test("Apply the value to data correctly", function() { test("Remove the value from attribute correctly", function() { // Create one once() call. - $('#test4 span').once('test4', function() { - // Do nothing. - }); + $('#test4 span').once('test4'); // Verify the data is applied. var hasData = $('#test4 span').data('jquery-once-test4'); @@ -62,12 +56,10 @@ test("Remove the value from attribute correctly", function() { test("Finding elements correctly through findOnce()", function() { // Create one once() call. - $('#test5 span').once('test5', function() { - // Do nothing. - }); + $('#test5 span').once('test5'); // Find the once'd element through the callback. - var elements = $('span').findOnce('test5', function() { + var elements = $('span').findOnce('test5').each(function() { var hasData = $(this).data('jquery-once-test5'); ok(hasData, 'Finding the correct span element after once() through callback.'); }); |