Permalink
Browse files

Updated tests for latest version of the API.

  • Loading branch information...
1 parent ce4bdeb commit 53f330dac64e59d55e6664dad004dd1f66ef1450 @stevenbenner committed Oct 4, 2012
Showing with 43 additions and 8 deletions.
  1. +4 −1 test/tests.js
  2. +39 −7 test/unit/core.js
View
@@ -64,8 +64,11 @@ $(function() {
test('expose API', function() {
ok($.powerTip, 'API is defined');
+ strictEqual(typeof $.powerTip.show, 'function', 'show method is defined');
+ strictEqual(typeof $.powerTip.reposition, 'function', 'reposition method is defined');
+ strictEqual(typeof $.powerTip.hide, 'function', 'closeTip method is defined');
+ // deprecated
strictEqual(typeof $.powerTip.showTip, 'function', 'showTip method is defined');
- strictEqual(typeof $.powerTip.resetPosition, 'function', 'resetPosition method is defined');
strictEqual(typeof $.powerTip.closeTip, 'function', 'closeTip method is defined');
});
View
@@ -118,13 +118,30 @@ $(function() {
});
test('expose API', function() {
+ strictEqual(typeof $.powerTip.show, 'function', 'show is defined');
+ strictEqual(typeof $.powerTip.reposition, 'function', 'reposition is defined');
+ strictEqual(typeof $.powerTip.hide, 'function', 'hide is defined');
+ strictEqual(typeof $.powerTip.destroy, 'function', 'destroy is defined');
+ // deprecated
strictEqual(typeof $.powerTip.showTip, 'function', 'showTip is defined');
- strictEqual(typeof $.powerTip.resetPosition, 'function', 'resetPosition is defined');
strictEqual(typeof $.powerTip.closeTip, 'function', 'closeTip is defined');
- strictEqual(typeof $.powerTip.destroy, 'function', 'destroy is defined');
});
- test('API showTip method should call DisplayController.show', function() {
+ test('API show method should call DisplayController.show', function() {
+ var showCalled = false,
+ element = $('<span />')
+ .data(DATA_DISPLAYCONTROLLER, new MockDisplayController(
+ function() {
+ showCalled = true;
+ }
+ ));
+
+ $.powerTip.show(element);
+
+ ok(showCalled, 'show method was called');
+ });
+
+ test('API showTip (DEPRECATED) method should call DisplayController.show', function() {
var showCalled = false,
element = $('<span />')
.data(DATA_DISPLAYCONTROLLER, new MockDisplayController(
@@ -138,7 +155,7 @@ $(function() {
ok(showCalled, 'show method was called');
});
- test('API resetPosition method should call DisplayController.resetPosition', function() {
+ test('API reposition method should call DisplayController.resetPosition', function() {
var resetCalled = false,
element = $('<span />')
.data(DATA_DISPLAYCONTROLLER, new MockDisplayController(
@@ -150,12 +167,27 @@ $(function() {
}
));
- $.powerTip.resetPosition(element);
+ $.powerTip.reposition(element);
- ok(resetCalled, 'resetPosition method was called');
+ ok(resetCalled, 'reposition method was called');
+ });
+
+ test('API hide method should call DisplayController.hide', function() {
+ var hideCalled = false,
+ element = $('<span />')
+ .data(DATA_DISPLAYCONTROLLER, new MockDisplayController(
+ null,
+ function() {
+ hideCalled = true;
+ }
+ ));
+
+ $.powerTip.hide(element);
+
+ ok(hideCalled, 'hide method was called');
});
- test('API closeTip method should call DisplayController.hide', function() {
+ test('API closeTip (DEPRECATED) method should call DisplayController.hide', function() {
var hideCalled = false,
element = $('<span />')
.data(DATA_DISPLAYCONTROLLER, new MockDisplayController(

0 comments on commit 53f330d

Please sign in to comment.