summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2013-06-23 20:52:43 -0400
committerRob Loach <robloach@gmail.com>2013-06-23 20:52:43 -0400
commit8cb2697ad8e8131bea202e9c23784417e29b3efd (patch)
treebebd6dce1a0787b3665b530204c013708203ee37
parent197e5372917a96c53ba001a7652dc52e93021801 (diff)
downloadjquery-once-8cb2697ad8e8131bea202e9c23784417e29b3efd.zip
jquery-once-8cb2697ad8e8131bea202e9c23784417e29b3efd.tar.gz
jquery-once-8cb2697ad8e8131bea202e9c23784417e29b3efd.tar.bz2
Add removeOnce() test
-rw-r--r--test/index.html4
-rw-r--r--test/test.js16
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().');
+});