diff options
author | Rob Loach <robloach@gmail.com> | 2013-06-23 20:52:43 -0400 |
---|---|---|
committer | Rob Loach <robloach@gmail.com> | 2013-06-23 20:52:43 -0400 |
commit | 8cb2697ad8e8131bea202e9c23784417e29b3efd (patch) | |
tree | bebd6dce1a0787b3665b530204c013708203ee37 | |
parent | 197e5372917a96c53ba001a7652dc52e93021801 (diff) | |
download | jquery-once-8cb2697ad8e8131bea202e9c23784417e29b3efd.zip jquery-once-8cb2697ad8e8131bea202e9c23784417e29b3efd.tar.gz jquery-once-8cb2697ad8e8131bea202e9c23784417e29b3efd.tar.bz2 |
Add removeOnce() test
-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().'); +}); |