aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/tooltip/methods.js
diff options
context:
space:
mode:
authorAmanpreet Singh <apsdehal@gmail.com>2016-04-06 19:29:12 +0530
committerAmanpreet Singh <apsdehal@gmail.com>2016-04-14 00:14:57 +0530
commit92f122d5b1c1eaa77ae0ab3af8bf68bf268e300d (patch)
treeb4da2ad985f180f3cb295721ff952c3039e775c9 /tests/unit/tooltip/methods.js
parentbfcd6358fe1d088f4d0ecd3632182578c0bfb865 (diff)
downloadjquery-ui-92f122d5b1c1eaa77ae0ab3af8bf68bf268e300d.tar.gz
jquery-ui-92f122d5b1c1eaa77ae0ab3af8bf68bf268e300d.zip
Tooltip: Shift to use no globals
Diffstat (limited to 'tests/unit/tooltip/methods.js')
-rw-r--r--tests/unit/tooltip/methods.js67
1 files changed, 34 insertions, 33 deletions
diff --git a/tests/unit/tooltip/methods.js b/tests/unit/tooltip/methods.js
index 31fe86532..e98d1b9ed 100644
--- a/tests/unit/tooltip/methods.js
+++ b/tests/unit/tooltip/methods.js
@@ -1,12 +1,13 @@
define( [
+ "qunit",
"jquery",
"ui/widgets/tooltip"
-], function( $ ) {
+], function( QUnit, $ ) {
-module( "tooltip: methods" );
+QUnit.module( "tooltip: methods" );
-test( "destroy", function( assert ) {
- expect( 3 );
+QUnit.test( "destroy", function( assert ) {
+ assert.expect( 3 );
var element = $( "#tooltipped1" );
assert.domEqual( "#tooltipped1", function() {
@@ -20,89 +21,89 @@ test( "destroy", function( assert ) {
.tooltip( "open", $.Event( "mouseover", { target: element[ 0 ] } ) )
.tooltip( "destroy" );
} );
- equal( $( ".ui-tooltip" ).length, 0 );
+ assert.equal( $( ".ui-tooltip" ).length, 0 );
} );
-test( "open/close", function() {
- expect( 3 );
+QUnit.test( "open/close", function( assert ) {
+ assert.expect( 3 );
$.fx.off = true;
var tooltip,
element = $( "#tooltipped1" ).tooltip();
- equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
+ assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
element.tooltip( "open" );
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
- ok( tooltip.is( ":visible" ) );
+ assert.ok( tooltip.is( ":visible" ) );
element.tooltip( "close" );
- ok( tooltip.is( ":hidden" ) );
+ assert.ok( tooltip.is( ":hidden" ) );
$.fx.off = false;
} );
// #8626 - Calling open() without an event
-test( "open/close with tracking", function() {
- expect( 3 );
+QUnit.test( "open/close with tracking", function( assert ) {
+ assert.expect( 3 );
$.fx.off = true;
var tooltip,
element = $( "#tooltipped1" ).tooltip( { track: true } );
- equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
+ assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
element.tooltip( "open" );
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
- ok( tooltip.is( ":visible" ) );
+ assert.ok( tooltip.is( ":visible" ) );
element.tooltip( "close" );
- ok( tooltip.is( ":hidden" ) );
+ assert.ok( tooltip.is( ":hidden" ) );
$.fx.off = false;
} );
-test( "enable/disable", function( assert ) {
- expect( 11 );
+QUnit.test( "enable/disable", function( assert ) {
+ assert.expect( 11 );
$.fx.off = true;
var tooltip,
element = $( "#tooltipped1" ).tooltip();
- equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
+ assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
element.tooltip( "open" );
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
- ok( tooltip.is( ":visible" ) );
+ assert.ok( tooltip.is( ":visible" ) );
element.tooltip( "disable" );
- equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" );
+ assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" );
assert.lacksClasses( element.tooltip( "widget" ), "ui-state-disabled" );
- ok( !element.tooltip( "widget" ).attr( "aria-disabled" ), "element doesn't get aria-disabled" );
+ assert.ok( !element.tooltip( "widget" ).attr( "aria-disabled" ), "element doesn't get aria-disabled" );
assert.lacksClasses( element.tooltip( "widget" ), "ui-tooltip-disabled" );
- equal( tooltip.attr( "title" ), null, "title removed on disable" );
+ assert.equal( tooltip.attr( "title" ), null, "title removed on disable" );
element.tooltip( "open" );
- equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" );
+ assert.equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" );
element.tooltip( "enable" );
- equal( element.attr( "title" ), "anchortitle", "title restored on enable" );
+ assert.equal( element.attr( "title" ), "anchortitle", "title restored on enable" );
// #9719 - Title should be preserved after disabling twice
element.tooltip( "disable" );
element.tooltip( "disable" );
element.tooltip( "enable" );
- equal( element.attr( "title" ), "anchortitle", "title restored on enable after being disabled twice" );
+ assert.equal( element.attr( "title" ), "anchortitle", "title restored on enable after being disabled twice" );
element.tooltip( "open" );
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
- ok( tooltip.is( ":visible" ) );
+ assert.ok( tooltip.is( ":visible" ) );
$.fx.off = false;
} );
-test( "widget", function() {
- expect( 2 );
+QUnit.test( "widget", function( assert ) {
+ assert.expect( 2 );
var element = $( "#tooltipped1" ).tooltip(),
widgetElement = element.tooltip( "widget" );
- equal( widgetElement.length, 1, "one element" );
- strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
+ assert.equal( widgetElement.length, 1, "one element" );
+ assert.strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
} );
-test( "preserve changes to title attributes on close and destroy", function() {
- expect( 6 );
+QUnit.test( "preserve changes to title attributes on close and destroy", function( assert ) {
+ assert.expect( 6 );
var element = $( "#tooltipped1" ),
changed = "changed title text",
original = "original title text",
@@ -136,7 +137,7 @@ test( "preserve changes to title attributes on close and destroy", function() {
element.removeAttr( "title" );
}
element.tooltip( test.method );
- equal( $( "#tooltipped1" ).attr( "title" ), test.expected );
+ assert.equal( $( "#tooltipped1" ).attr( "title" ), test.expected );
} );
} );