summaryrefslogtreecommitdiffstats
path: root/test/test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.js')
-rw-r--r--test/test.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/test.js b/test/test.js
index c93cdfd..457f1e7 100644
--- a/test/test.js
+++ b/test/test.js
@@ -29,10 +29,10 @@ test("Called only once", function() {
ok(count === 1);
});
-test("Apply the class correctly", function() {
+test("Apply the value to attribute correctly", function() {
// Verify that the element starts without the class.
- var hasClass = $('#test3 span').hasClass('test3-processed');
- ok(!hasClass, 'Processed class not applied in the beginning.');
+ var hasClass = ($('#test3 span').attr('data-jquery-once') || '').indexOf('test3') !== -1;
+ ok(!hasClass, 'Value not applied in the beginning.');
// Create one once() call.
$('#test3 span').once('test3', function() {
@@ -40,22 +40,22 @@ test("Apply the class correctly", function() {
});
// Verify the class is applied.
- hasClass = $('#test3 span').hasClass('test3-processed');
- ok(hasClass, 'The processed class is properly applied after once().');
+ hasClass = $('#test3 span').attr('data-jquery-once').indexOf('test3') !== -1;
+ ok(hasClass, 'The value is properly applied after once().');
});
-test("Remove the class correctly", function() {
+test("Remove the value from attribute correctly", function() {
// Create one once() call.
$('#test4 span').once('test4', function() {
// Do nothing.
});
// Verify the class is applied.
- var hasClass = $('#test4 span').hasClass('test4-processed');
- ok(hasClass, 'The processed class is properly applied after once().');
+ var hasClass = $('#test4 span').attr('data-jquery-once').indexOf('test4') !== -1;
+ ok(hasClass, 'The value is properly applied after once().');
// Remove the once property.
$('#test4 span').removeOnce('test4');
- hasClass = $('#test4 span').hasClass('test4-processed');
- ok(!hasClass, 'The processed class is properly removed when called removeOnce().');
+ hasClass = $('#test4 span').attr('data-jquery-once').indexOf('test4') !== -1;
+ ok(!hasClass, 'The value is properly removed when called removeOnce().');
});