summaryrefslogtreecommitdiffstats
path: root/test/test.js
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2014-11-03 00:42:50 -0800
committerRob Loach <robloach@gmail.com>2014-11-03 00:42:50 -0800
commit43af89bfb0d71acf447ab3c21b552facb461da6a (patch)
tree638a10e1ecaeb9d143a861255a5667c4b9d95da7 /test/test.js
parentad87ba262b4ae6b64e31b10ef9bced5168d8e467 (diff)
parent2dde6eb29fa82af61ddba108da42c79cab60f100 (diff)
downloadjquery-once-43af89bfb0d71acf447ab3c21b552facb461da6a.zip
jquery-once-43af89bfb0d71acf447ab3c21b552facb461da6a.tar.gz
jquery-once-43af89bfb0d71acf447ab3c21b552facb461da6a.tar.bz2
Update CoffeeScript source
Diffstat (limited to 'test/test.js')
-rw-r--r--test/test.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/test/test.js b/test/test.js
index 88d59e7..44ab452 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,12 +1,26 @@
-test("Properly executed", function() {
- // Create one once() call.
- $('#test1 span').once().data('test1', 'foobar');
+test("ID required", function() {
+ expect(1);
+ try {
+ $("#test1 span").once();
+ }
+ catch (e) {
+ ok(e, "Error is triggered when ID is missing.");
+ }
+});
+
+test(".once('test1-2') properly executed", function() {
+ // Create one once('test1-2') call.
+ $('#test1 span').once('test1-2').data('test1-2', 'foo');
+
+ // Create another once('test1-2') call.
+ $('#test1 span').once('test1-2').data('test1-2', 'bar');
- var data = $('#test1 span').data('test1');
- ok(data === "foobar");
+ // The data should result to the first once() call.
+ var data = $('#test1 span').data('test1-2');
+ ok(data === "foo");
});
-test("Called only once", function() {
+test("Called only once, counted", function() {
// Count the number of times once() was called.
$('#test2 span').data('count', 0);