Skip to content

Commit 9ef26c1

Browse files
author
Lawrence Goldstien
committed
Add appropriate tests
1 parent 180b163 commit 9ef26c1

File tree

3 files changed

+10
-35
lines changed

3 files changed

+10
-35
lines changed

src/dragpan.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
/*jshint -W098 */
2-
/*! Dragpan - v0.1.0 - 2013-08-19
3-
* https://github.com/lgoldstien/jquery-dragpan
4-
* Copyright (c) 2013 Lawrence Goldstien; Licensed MIT */
52
(function ($) {
63
$.fn.dragpan = function (opts) {
74

@@ -94,7 +91,7 @@
9491
};
9592

9693
Dragpan.setup();
97-
94+
return this;
9895
};
9996

10097
}( jQuery ));

test/dragpan.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
<body>
2020
<div id="qunit"></div>
2121
<div id="qunit-fixture">
22-
<span>lame test markup</span>
23-
<span>normal test markup</span>
24-
<span>awesome test markup</span>
22+
<div id="parent">
23+
<div id="child"></div>
24+
</div>
2525
</div>
2626
</body>
2727
</html>

test/dragpan_test.js

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,21 @@
2020
throws(block, [expected], [message])
2121
*/
2222

23-
module('jQuery#awesome', {
23+
module('jQuery#dragpan', {
2424
// This will run before each test in this module.
2525
setup: function() {
26-
this.elems = $('#qunit-fixture').children();
26+
this.elems = $('#parent').dragpan();
2727
}
2828
});
2929

30-
test('is chainable', function() {
30+
test('is a function', function() {
3131
expect(1);
32-
// Not a bad test to run on collection methods.
33-
strictEqual(this.elems.awesome(), this.elems, 'should be chainable');
32+
strictEqual(typeof $.fn.dragpan, 'function', 'dragpan should be a function');
3433
});
3534

36-
test('is awesome', function() {
35+
test('applies cursor', function() {
3736
expect(1);
38-
strictEqual(this.elems.awesome().text(), 'awesome0awesome1awesome2', 'should be awesome');
39-
});
40-
41-
module('jQuery.awesome');
42-
43-
test('is awesome', function() {
44-
expect(2);
45-
strictEqual($.awesome(), 'awesome.', 'should be awesome');
46-
strictEqual($.awesome({punctuation: '!'}), 'awesome!', 'should be thoroughly awesome');
47-
});
48-
49-
module(':awesome selector', {
50-
// This will run before each test in this module.
51-
setup: function() {
52-
this.elems = $('#qunit-fixture').children();
53-
}
54-
});
55-
56-
test('is awesome', function() {
57-
expect(1);
58-
// Use deepEqual & .get() when comparing jQuery objects.
59-
deepEqual(this.elems.filter(':awesome').get(), this.elems.last().get(), 'knows awesome when it sees it');
37+
strictEqual($('#parent').css('cursor'), 'all-scroll', 'the parent should have an all-scroll cursor');
6038
});
6139

6240
}(jQuery));

0 commit comments

Comments
 (0)