diff options
-rw-r--r-- | test/index.html | 4 | ||||
-rw-r--r-- | test/test.js | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/index.html b/test/index.html index adc06ba..6f1ed00 100644 --- a/test/index.html +++ b/test/index.html @@ -20,6 +20,10 @@ <p>This is <span>Test 3</span>.</p> </div> + <div id="test4"> + <p>This is <span>Test 4</span>.</p> + </div> + </div> <script src="http://code.jquery.com/jquery-1.10.0.js"></script> diff --git a/test/test.js b/test/test.js index 533c532..c93cdfd 100644 --- a/test/test.js +++ b/test/test.js @@ -43,3 +43,19 @@ test("Apply the class correctly", function() { hasClass = $('#test3 span').hasClass('test3-processed'); ok(hasClass, 'The processed class is properly applied after once().'); }); + +test("Remove the class 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().'); + + // 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().'); +}); |