mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-06-07 00:47:00 +03:00
Remove broken jquery-ui
This commit is contained in:
parent
39aa35f2aa
commit
d3488a963e
718 changed files with 10 additions and 518340 deletions
|
@ -1,26 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Tooltip Test Suite</title>
|
||||
|
||||
<script src="../../../external/jquery/jquery.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="../../../external/qunit/qunit.css">
|
||||
<link rel="stylesheet" href="../../../external/qunit-composite/qunit-composite.css">
|
||||
<script src="../../../external/qunit/qunit.js"></script>
|
||||
<script src="../../../external/qunit-composite/qunit-composite.js"></script>
|
||||
<script src="../subsuite.js"></script>
|
||||
|
||||
<script>
|
||||
testAllVersions( "tooltip" );
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,31 +0,0 @@
|
|||
define( [
|
||||
"lib/common",
|
||||
"ui/widgets/tooltip"
|
||||
], function( common ) {
|
||||
|
||||
common.testWidget( "tooltip", {
|
||||
defaults: {
|
||||
classes: {
|
||||
"ui-tooltip": "ui-corner-all ui-widget-shadow"
|
||||
},
|
||||
content: function() {},
|
||||
disabled: false,
|
||||
hide: true,
|
||||
items: "[title]:not([disabled])",
|
||||
position: {
|
||||
my: "left top+15",
|
||||
at: "left bottom",
|
||||
collision: "flipfit flip"
|
||||
},
|
||||
show: true,
|
||||
tooltipClass: null,
|
||||
track: false,
|
||||
|
||||
// Callbacks
|
||||
close: null,
|
||||
create: null,
|
||||
open: null
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
30
jquery-ui/tests/unit/tooltip/common.js
vendored
30
jquery-ui/tests/unit/tooltip/common.js
vendored
|
@ -1,30 +0,0 @@
|
|||
define( [
|
||||
"lib/common",
|
||||
"ui/widgets/tooltip"
|
||||
], function( common ) {
|
||||
|
||||
common.testWidget( "tooltip", {
|
||||
defaults: {
|
||||
classes: {
|
||||
"ui-tooltip": "ui-corner-all ui-widget-shadow"
|
||||
},
|
||||
content: function() {},
|
||||
disabled: false,
|
||||
hide: true,
|
||||
items: "[title]:not([disabled])",
|
||||
position: {
|
||||
my: "left top+15",
|
||||
at: "left bottom",
|
||||
collision: "flipfit flip"
|
||||
},
|
||||
show: true,
|
||||
track: false,
|
||||
|
||||
// Callbacks
|
||||
close: null,
|
||||
create: null,
|
||||
open: null
|
||||
}
|
||||
} );
|
||||
|
||||
} );
|
253
jquery-ui/tests/unit/tooltip/core.js
vendored
253
jquery-ui/tests/unit/tooltip/core.js
vendored
|
@ -1,253 +0,0 @@
|
|||
define( [
|
||||
"qunit",
|
||||
"jquery",
|
||||
"ui/widgets/tooltip"
|
||||
], function( QUnit, $ ) {
|
||||
|
||||
QUnit.module( "tooltip: core" );
|
||||
|
||||
QUnit.test( "markup structure", function( assert ) {
|
||||
assert.expect( 7 );
|
||||
var element = $( "#tooltipped1" ).tooltip(),
|
||||
tooltip = $( ".ui-tooltip" );
|
||||
|
||||
assert.equal( element.attr( "aria-describedby" ), undefined, "no aria-describedby on init" );
|
||||
assert.equal( tooltip.length, 0, "no tooltip on init" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
|
||||
assert.equal( tooltip.length, 1, "tooltip exists" );
|
||||
assert.equal( element.attr( "aria-describedby" ), tooltip.attr( "id" ), "aria-describedby" );
|
||||
assert.hasClasses( tooltip, "ui-tooltip ui-widget ui-widget-content ui-widget-shadow" );
|
||||
assert.equal( tooltip.length, 1, ".ui-tooltip exists" );
|
||||
assert.equal( tooltip.find( ".ui-tooltip-content" ).length, 1,
|
||||
".ui-tooltip-content exists" );
|
||||
} );
|
||||
|
||||
QUnit.test( "accessibility", function( assert ) {
|
||||
assert.expect( 15 );
|
||||
|
||||
var tooltipId, tooltip,
|
||||
element = $( "#multiple-describedby" ).tooltip(),
|
||||
liveRegion = element.tooltip( "instance" ).liveRegion;
|
||||
|
||||
assert.equal( liveRegion.find( ">div" ).length, 0 );
|
||||
assert.equal( liveRegion.attr( "role" ), "log" );
|
||||
assert.equal( liveRegion.attr( "aria-live" ), "assertive" );
|
||||
assert.equal( liveRegion.attr( "aria-relevant" ), "additions" );
|
||||
element.tooltip( "open" );
|
||||
tooltipId = element.data( "ui-tooltip-id" );
|
||||
tooltip = $( "#" + tooltipId );
|
||||
assert.equal( tooltip.attr( "role" ), "tooltip", "role" );
|
||||
assert.equal( element.attr( "aria-describedby" ), "fixture-span " + tooltipId,
|
||||
"multiple describedby when open" );
|
||||
|
||||
assert.equal( element.attr( "title" ), null, "no title when open" );
|
||||
assert.equal( liveRegion.children().length, 1 );
|
||||
assert.equal( liveRegion.children().last().html(), "..." );
|
||||
element.tooltip( "close" );
|
||||
assert.equal( element.attr( "aria-describedby" ), "fixture-span",
|
||||
"correct describedby when closed" );
|
||||
assert.equal( element.attr( "title" ), "...", "title restored when closed" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
assert.equal( liveRegion.children().length, 2,
|
||||
"After the second tooltip show, there should be two children" );
|
||||
assert.equal( liveRegion.children().filter( ":visible" ).length, 1,
|
||||
"Only one of the children should be visible" );
|
||||
assert.ok( liveRegion.children().last().is( ":visible" ),
|
||||
"Only the last child should be visible" );
|
||||
element.tooltip( "close" );
|
||||
|
||||
element.tooltip( "destroy" );
|
||||
assert.equal( liveRegion.parent().length, 0,
|
||||
"Tooltip liveregion element should be removed" );
|
||||
} );
|
||||
|
||||
QUnit.test( "delegated removal", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
var container = $( "#contains-tooltipped" ).tooltip(),
|
||||
element = $( "#contained-tooltipped" );
|
||||
|
||||
element.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 1 );
|
||||
|
||||
container.empty();
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0 );
|
||||
} );
|
||||
|
||||
QUnit.test( "nested tooltips", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
var child = $( "#contained-tooltipped" ),
|
||||
parent = $( "#contains-tooltipped" ).tooltip( {
|
||||
show: null,
|
||||
hide: null
|
||||
} );
|
||||
|
||||
parent.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip:visible" ).text(), "parent" );
|
||||
|
||||
child.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip" ).text(), "child" );
|
||||
} );
|
||||
|
||||
// #8742
|
||||
QUnit.test( "form containing an input with name title", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
|
||||
var form = $( "#tooltip-form" ).tooltip( {
|
||||
show: null,
|
||||
hide: null
|
||||
} ),
|
||||
input = form.find( "[name=title]" );
|
||||
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltips on init" );
|
||||
|
||||
input.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 1, "tooltip for input" );
|
||||
input.trigger( "mouseleave" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "tooltip for input closed" );
|
||||
|
||||
form.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip for form" );
|
||||
} );
|
||||
|
||||
QUnit.test( "tooltip on .ui-state-disabled element", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
var container = $( "#contains-tooltipped" ).tooltip(),
|
||||
element = $( "#contained-tooltipped" ).addClass( "ui-state-disabled" );
|
||||
|
||||
element.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 1 );
|
||||
|
||||
container.empty();
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0 );
|
||||
} );
|
||||
|
||||
// http://bugs.jqueryui.com/ticket/8740
|
||||
QUnit.test( "programmatic focus with async content", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 2 );
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
content: function( response ) {
|
||||
setTimeout( function() {
|
||||
response( "test" );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
element.on( "tooltipopen", function( event ) {
|
||||
assert.deepEqual( event.originalEvent.type, "focusin" );
|
||||
|
||||
element.on( "tooltipclose", function( event ) {
|
||||
assert.deepEqual( event.originalEvent.type, "focusout" );
|
||||
ready();
|
||||
} );
|
||||
|
||||
setTimeout( function() {
|
||||
element.trigger( "blur" );
|
||||
} );
|
||||
} );
|
||||
|
||||
element.trigger( "focus" );
|
||||
} );
|
||||
|
||||
QUnit.test( "destroy during hide animation; only one close event", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 1 );
|
||||
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
show: false,
|
||||
hide: true
|
||||
} );
|
||||
|
||||
element.on( "tooltipclose", function() {
|
||||
assert.ok( true, "tooltip closed" );
|
||||
} );
|
||||
|
||||
element.tooltip( "open" );
|
||||
element.tooltip( "close" );
|
||||
setTimeout( function() {
|
||||
element.tooltip( "destroy" );
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
|
||||
// http://bugs.jqueryui.com/ticket/10602
|
||||
QUnit.test( "multiple active delegated tooltips", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 1 );
|
||||
|
||||
var anchor = $( "#tooltipped1" ),
|
||||
input = anchor.next(),
|
||||
actions = [];
|
||||
|
||||
$( document ).tooltip( {
|
||||
show: false,
|
||||
hide: false,
|
||||
open: function( event, ui ) {
|
||||
actions.push( "open:" + ui.tooltip.text() );
|
||||
},
|
||||
close: function( event, ui ) {
|
||||
actions.push( "close:" + ui.tooltip.text() );
|
||||
}
|
||||
} );
|
||||
|
||||
function step1() {
|
||||
anchor.simulate( "mouseover" );
|
||||
setTimeout( step2 );
|
||||
}
|
||||
|
||||
function step2() {
|
||||
input.simulate( "focus" );
|
||||
setTimeout( step3 );
|
||||
}
|
||||
|
||||
function step3() {
|
||||
input.simulate( "blur" );
|
||||
setTimeout( step4 );
|
||||
}
|
||||
|
||||
function step4() {
|
||||
anchor.simulate( "mouseout" );
|
||||
assert.deepEqual( actions, [
|
||||
"open:anchortitle",
|
||||
"open:inputtitle",
|
||||
"close:inputtitle",
|
||||
"close:anchortitle"
|
||||
], "Both tooltips open and close" );
|
||||
ready();
|
||||
}
|
||||
|
||||
step1();
|
||||
} );
|
||||
|
||||
// http://bugs.jqueryui.com/ticket/11272
|
||||
QUnit.test( "remove conflicting attributes from live region", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
|
||||
var element = $(
|
||||
"<div id='content'>" +
|
||||
"<input type='radio' name='hobby' id='hobby1' checked='checked'>" +
|
||||
"<label for='hobby1'>option 1</label>" +
|
||||
"<input type='radio' name='hobby' id='hobby2'>" +
|
||||
"<label for='hobby2'>option 2</label>" +
|
||||
"</div>" );
|
||||
|
||||
$( "#tooltipped1" )
|
||||
.tooltip( {
|
||||
content: element,
|
||||
open: function() {
|
||||
assert.equal( $( ".ui-helper-hidden-accessible [name]" ).length, 0,
|
||||
"no name attributes within live region" );
|
||||
assert.equal( $( ".ui-helper-hidden-accessible [id]" ).length, 0,
|
||||
"no id attributes within live region" );
|
||||
}
|
||||
} )
|
||||
.tooltip( "open" );
|
||||
} );
|
||||
|
||||
} );
|
|
@ -1,30 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Tooltip Test Suite</title>
|
||||
|
||||
<script src="../../../external/requirejs/require.js"></script>
|
||||
<script src="../../lib/css.js" data-modules="core tooltip"></script>
|
||||
<script src="../../lib/bootstrap.js" data-widget="tooltip" data-deprecated="true"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
<div>
|
||||
<a id="tooltipped1" href="#" title="anchortitle">anchor</a>
|
||||
<input title="inputtitle">
|
||||
<span id="multiple-describedby" aria-describedby="fixture-span" title="...">aria-describedby</span>
|
||||
<span id="fixture-span" title="title-text">span</span>
|
||||
<span id="contains-tooltipped" title="parent"><span id="contained-tooltipped" title="child">baz</span></span>
|
||||
</div>
|
||||
|
||||
<form id="tooltip-form">
|
||||
<input name="title" title="attroperties">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
17
jquery-ui/tests/unit/tooltip/deprecated.js
vendored
17
jquery-ui/tests/unit/tooltip/deprecated.js
vendored
|
@ -1,17 +0,0 @@
|
|||
define( [
|
||||
"qunit",
|
||||
"jquery",
|
||||
"ui/widgets/tooltip"
|
||||
], function( QUnit, $ ) {
|
||||
|
||||
QUnit.module( "tooltip: (deprecated) options" );
|
||||
|
||||
QUnit.test( "tooltipClass", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
tooltipClass: "custom"
|
||||
} ).tooltip( "open" );
|
||||
assert.hasClasses( $( "#" + element.data( "ui-tooltip-id" ) ), "custom" );
|
||||
} );
|
||||
|
||||
} );
|
61
jquery-ui/tests/unit/tooltip/events.js
vendored
61
jquery-ui/tests/unit/tooltip/events.js
vendored
|
@ -1,61 +0,0 @@
|
|||
define( [
|
||||
"qunit",
|
||||
"jquery",
|
||||
"ui/widgets/tooltip"
|
||||
], function( QUnit, $ ) {
|
||||
|
||||
QUnit.module( "tooltip: events" );
|
||||
|
||||
QUnit.test( "programmatic triggers", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
var tooltip,
|
||||
element = $( "#tooltipped1" ).tooltip();
|
||||
|
||||
element.one( "tooltipopen", function( event, ui ) {
|
||||
tooltip = ui.tooltip;
|
||||
assert.ok( !( "originalEvent" in event ), "open" );
|
||||
assert.strictEqual( ui.tooltip[ 0 ],
|
||||
$( "#" + element.data( "ui-tooltip-id" ) )[ 0 ], "ui.tooltip" );
|
||||
} );
|
||||
element.tooltip( "open" );
|
||||
|
||||
element.one( "tooltipclose", function( event, ui ) {
|
||||
assert.ok( !( "originalEvent" in event ), "close" );
|
||||
assert.strictEqual( ui.tooltip[ 0 ], tooltip[ 0 ], "ui.tooltip" );
|
||||
} );
|
||||
element.tooltip( "close" );
|
||||
} );
|
||||
|
||||
QUnit.test( "mouse events", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var element = $( "#tooltipped1" ).tooltip();
|
||||
|
||||
element.on( "tooltipopen", function( event ) {
|
||||
assert.deepEqual( event.originalEvent.type, "mouseover" );
|
||||
} );
|
||||
element.trigger( "mouseover" );
|
||||
|
||||
element.on( "tooltipclose", function( event ) {
|
||||
assert.deepEqual( event.originalEvent.type, "mouseleave" );
|
||||
} );
|
||||
element.trigger( "focusout" );
|
||||
element.trigger( "mouseleave" );
|
||||
} );
|
||||
|
||||
QUnit.test( "focus events", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var element = $( "#tooltipped1" ).tooltip();
|
||||
|
||||
element.on( "tooltipopen", function( event ) {
|
||||
assert.deepEqual( event.originalEvent.type, "focusin" );
|
||||
} );
|
||||
element.trigger( "focusin" );
|
||||
|
||||
element.on( "tooltipclose", function( event ) {
|
||||
assert.deepEqual( event.originalEvent.type, "focusout" );
|
||||
} );
|
||||
element.trigger( "mouseleave" );
|
||||
element.trigger( "focusout" );
|
||||
} );
|
||||
|
||||
} );
|
159
jquery-ui/tests/unit/tooltip/methods.js
vendored
159
jquery-ui/tests/unit/tooltip/methods.js
vendored
|
@ -1,159 +0,0 @@
|
|||
define( [
|
||||
"qunit",
|
||||
"jquery",
|
||||
"ui/widgets/tooltip"
|
||||
], function( QUnit, $ ) {
|
||||
|
||||
QUnit.module( "tooltip: methods" );
|
||||
|
||||
QUnit.test( "destroy", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
var element = $( "#tooltipped1" );
|
||||
|
||||
assert.domEqual( "#tooltipped1", function() {
|
||||
element.tooltip().tooltip( "destroy" );
|
||||
} );
|
||||
|
||||
// Make sure that open tooltips are removed on destroy
|
||||
assert.domEqual( "#tooltipped1", function() {
|
||||
element
|
||||
.tooltip()
|
||||
.tooltip( "open", $.Event( "mouseover", { target: element[ 0 ] } ) )
|
||||
.tooltip( "destroy" );
|
||||
} );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0 );
|
||||
} );
|
||||
|
||||
QUnit.test( "open/close", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
$.fx.off = true;
|
||||
var tooltip,
|
||||
element = $( "#tooltipped1" ).tooltip();
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
|
||||
assert.ok( tooltip.is( ":visible" ) );
|
||||
|
||||
element.tooltip( "close" );
|
||||
assert.ok( tooltip.is( ":hidden" ) );
|
||||
$.fx.off = false;
|
||||
} );
|
||||
|
||||
// #8626 - Calling open() without an event
|
||||
QUnit.test( "open/close with tracking", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
$.fx.off = true;
|
||||
var tooltip,
|
||||
element = $( "#tooltipped1" ).tooltip( { track: true } );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
|
||||
assert.ok( tooltip.is( ":visible" ) );
|
||||
|
||||
element.tooltip( "close" );
|
||||
assert.ok( tooltip.is( ":hidden" ) );
|
||||
$.fx.off = false;
|
||||
} );
|
||||
|
||||
QUnit.test( "enable/disable", function( assert ) {
|
||||
assert.expect( 11 );
|
||||
$.fx.off = true;
|
||||
var tooltip,
|
||||
element = $( "#tooltipped1" ).tooltip();
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
|
||||
assert.ok( tooltip.is( ":visible" ) );
|
||||
|
||||
element.tooltip( "disable" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" );
|
||||
|
||||
assert.lacksClasses( element.tooltip( "widget" ), "ui-state-disabled" );
|
||||
assert.ok( !element.tooltip( "widget" ).attr( "aria-disabled" ), "element doesn't get aria-disabled" );
|
||||
assert.lacksClasses( element.tooltip( "widget" ), "ui-tooltip-disabled" );
|
||||
assert.equal( tooltip.attr( "title" ), null, "title removed on disable" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" );
|
||||
|
||||
element.tooltip( "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" );
|
||||
assert.equal( element.attr( "title" ), "anchortitle", "title restored on enable after being disabled twice" );
|
||||
|
||||
element.tooltip( "open" );
|
||||
tooltip = $( "#" + element.data( "ui-tooltip-id" ) );
|
||||
assert.ok( tooltip.is( ":visible" ) );
|
||||
$.fx.off = false;
|
||||
} );
|
||||
|
||||
QUnit.test( "enable/disable delegated", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var element = $( "#qunit-fixture" ).tooltip();
|
||||
var tooltipped = $( "#tooltipped1" );
|
||||
|
||||
element.tooltip( "disable" );
|
||||
element.tooltip( "enable" );
|
||||
|
||||
tooltipped.trigger( "mouseover" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 1, "open" );
|
||||
|
||||
element.tooltip( "destroy" );
|
||||
} );
|
||||
|
||||
QUnit.test( "widget", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var element = $( "#tooltipped1" ).tooltip(),
|
||||
widgetElement = element.tooltip( "widget" );
|
||||
assert.equal( widgetElement.length, 1, "one element" );
|
||||
assert.strictEqual( widgetElement[ 0 ], element[ 0 ], "same element" );
|
||||
} );
|
||||
|
||||
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",
|
||||
tests = [];
|
||||
|
||||
// 1. Changes to title attribute are preserved on close()
|
||||
tests[ 0 ] = { title: changed, expected: changed, method: "close" };
|
||||
|
||||
// 2. Changes to title attribute are preserved on destroy()
|
||||
tests[ 1 ] = { title: changed, expected: changed, method: "destroy" };
|
||||
|
||||
// 3. Changes to title attribute are NOT preserved when set to empty string on close()
|
||||
tests[ 2 ] = { title: "", expected: original, method: "close" };
|
||||
|
||||
// 4. Changes to title attribute are NOT preserved when set to empty string on destroy()
|
||||
tests[ 3 ] = { title: "", expected: original, method: "destroy" };
|
||||
|
||||
// 5. Changes to title attribute NOT preserved when attribute has been removed on close()
|
||||
tests[ 4 ] = { expected: original, method: "close" };
|
||||
|
||||
// 6. Changes to title attribute NOT preserved when attribute has been removed on destroy()
|
||||
tests[ 5 ] = { expected: original, method: "destroy" };
|
||||
|
||||
$.each( tests, function( index, test ) {
|
||||
|
||||
element.attr( "title", original ).tooltip()
|
||||
.tooltip( "open", $.Event( "mouseover", { target: element[ 0 ] } ) );
|
||||
if ( test.title ) {
|
||||
element.attr( "title", test.title );
|
||||
} else {
|
||||
element.removeAttr( "title" );
|
||||
}
|
||||
element.tooltip( test.method );
|
||||
assert.equal( $( "#tooltipped1" ).attr( "title" ), test.expected );
|
||||
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
226
jquery-ui/tests/unit/tooltip/options.js
vendored
226
jquery-ui/tests/unit/tooltip/options.js
vendored
|
@ -1,226 +0,0 @@
|
|||
define( [
|
||||
"qunit",
|
||||
"jquery",
|
||||
"ui/widgets/tooltip"
|
||||
], function( QUnit, $ ) {
|
||||
|
||||
QUnit.module( "tooltip: options" );
|
||||
|
||||
QUnit.test( "disabled: true", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
$( "#tooltipped1" ).tooltip( {
|
||||
disabled: true
|
||||
} ).tooltip( "open" );
|
||||
assert.equal( $( ".ui-tooltip" ).length, 0 );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: default", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var element = $( "#tooltipped1" ).tooltip().tooltip( "open" );
|
||||
assert.deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "anchortitle" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: default; HTML escaping", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var scriptText = "<script>$.ui.tooltip.hacked = true;</script>",
|
||||
element = $( "#tooltipped1" );
|
||||
|
||||
$.ui.tooltip.hacked = false;
|
||||
element.attr( "title", scriptText )
|
||||
.tooltip()
|
||||
.tooltip( "open" );
|
||||
assert.equal( $.ui.tooltip.hacked, false, "script did not execute" );
|
||||
assert.deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), scriptText,
|
||||
"correct tooltip text" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: return string", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
content: function() {
|
||||
return "customstring";
|
||||
}
|
||||
} ).tooltip( "open" );
|
||||
assert.deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "customstring" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: return jQuery", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
content: function() {
|
||||
return $( "<div id='unique'>" ).html( "cu<b id='bold'>s</b>tomstring" );
|
||||
}
|
||||
} ).tooltip( "open" ),
|
||||
liveRegion = element.tooltip( "instance" ).liveRegion;
|
||||
assert.deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "customstring" );
|
||||
assert.equal( liveRegion.children().last().html().toLowerCase(), "<div>cu<b>s</b>tomstring</div>",
|
||||
"The accessibility live region will strip the ids but keep the structure" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: sync + async callback", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 2 );
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
content: function( response ) {
|
||||
setTimeout( function() {
|
||||
assert.deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "loading..." );
|
||||
|
||||
response( "customstring2" );
|
||||
setTimeout( function() {
|
||||
assert.deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "customstring2" );
|
||||
ready();
|
||||
}, 13 );
|
||||
}, 13 );
|
||||
return "loading...";
|
||||
}
|
||||
} ).tooltip( "open" );
|
||||
} );
|
||||
|
||||
// http://bugs.jqueryui.com/ticket/8740
|
||||
QUnit.test( "content: async callback loses focus before load", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 1 );
|
||||
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
content: function( response ) {
|
||||
setTimeout( function() {
|
||||
element.trigger( "mouseleave" );
|
||||
setTimeout( function() {
|
||||
response( "sometext" );
|
||||
setTimeout( function() {
|
||||
assert.ok( !$( "#" + element.data( "ui-tooltip-id" ) ).is( ":visible" ),
|
||||
"Tooltip should not display" );
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
element.trigger( "mouseover" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: change while open", function( assert ) {
|
||||
assert.expect( 2 ) ;
|
||||
var element = $( "#tooltipped1" ).tooltip( {
|
||||
content: function() {
|
||||
return "old";
|
||||
}
|
||||
} );
|
||||
|
||||
element.one( "tooltipopen", function( event, ui ) {
|
||||
assert.equal( ui.tooltip.text(), "old", "original content" );
|
||||
element.tooltip( "option", "content", function() {
|
||||
return "new";
|
||||
} );
|
||||
assert.equal( ui.tooltip.text(), "new", "updated content" );
|
||||
} );
|
||||
|
||||
element.tooltip( "open" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: string", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
$( "#tooltipped1" ).tooltip( {
|
||||
content: "just a string",
|
||||
open: function( event, ui ) {
|
||||
assert.equal( ui.tooltip.text(), "just a string" );
|
||||
}
|
||||
} ).tooltip( "open" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: element", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var content = "<p>this is a <i>test</i> of the emergency broadcast system.</p>",
|
||||
element = $( content )[ 0 ];
|
||||
$( "#tooltipped1" ).tooltip( {
|
||||
content: element,
|
||||
open: function( event, ui ) {
|
||||
assert.equal( ui.tooltip.children().html().toLowerCase(), content );
|
||||
}
|
||||
} ).tooltip( "open" );
|
||||
} );
|
||||
|
||||
QUnit.test( "content: jQuery", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var content = "<p>this is a <i>test</i> of the emergency broadcast system.</p>",
|
||||
element = $( content );
|
||||
$( "#tooltipped1" ).tooltip( {
|
||||
content: element,
|
||||
open: function( event, ui ) {
|
||||
assert.equal( ui.tooltip.children().html().toLowerCase(), content );
|
||||
}
|
||||
} ).tooltip( "open" );
|
||||
} );
|
||||
|
||||
QUnit.test( "items", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var event,
|
||||
element = $( "#qunit-fixture" ).tooltip( {
|
||||
items: "#fixture-span"
|
||||
} );
|
||||
|
||||
event = $.Event( "mouseenter" );
|
||||
event.target = $( "#fixture-span" )[ 0 ];
|
||||
element.tooltip( "open", event );
|
||||
assert.deepEqual( $( "#" + $( "#fixture-span" ).data( "ui-tooltip-id" ) ).text(), "title-text" );
|
||||
|
||||
// Make sure default [title] doesn't get used
|
||||
event.target = $( "#tooltipped1" )[ 0 ];
|
||||
element.tooltip( "open", event );
|
||||
assert.deepEqual( $( "#tooltipped1" ).data( "ui-tooltip-id" ), undefined );
|
||||
|
||||
element.tooltip( "destroy" );
|
||||
} );
|
||||
|
||||
QUnit.test( "track + show delay", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var event,
|
||||
leftVal = 314,
|
||||
topVal = 159,
|
||||
offsetVal = 26,
|
||||
element = $( "#tooltipped1" ).tooltip( {
|
||||
track: true,
|
||||
show: {
|
||||
delay: 1
|
||||
},
|
||||
position: {
|
||||
my: "left+" + offsetVal + " top+" + offsetVal,
|
||||
at: "right bottom"
|
||||
}
|
||||
} );
|
||||
|
||||
event = $.Event( "mouseover" );
|
||||
event.target = $( "#tooltipped1" )[ 0 ];
|
||||
event.originalEvent = { type: "mouseover" };
|
||||
event.pageX = leftVal;
|
||||
event.pageY = topVal;
|
||||
element.trigger( event );
|
||||
|
||||
event = $.Event( "mousemove" );
|
||||
event.target = $( "#tooltipped1" )[ 0 ];
|
||||
event.originalEvent = { type: "mousemove" };
|
||||
event.pageX = leftVal;
|
||||
event.pageY = topVal;
|
||||
element.trigger( event );
|
||||
|
||||
assert.close(
|
||||
parseFloat( $( ".ui-tooltip" ).css( "left" ) ),
|
||||
leftVal + offsetVal, 0.5,
|
||||
"left position"
|
||||
);
|
||||
assert.close(
|
||||
parseFloat( $( ".ui-tooltip" ).css( "top" ) ),
|
||||
topVal + offsetVal, 0.5,
|
||||
"top position"
|
||||
);
|
||||
} );
|
||||
|
||||
QUnit.test( "track and programmatic focus", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
$( "#qunit-fixture div input" ).tooltip( {
|
||||
track: true
|
||||
} ).trigger( "focus" );
|
||||
assert.equal( "inputtitle", $( ".ui-tooltip" ).text() );
|
||||
} );
|
||||
|
||||
} );
|
|
@ -1,30 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jQuery UI Tooltip Test Suite</title>
|
||||
|
||||
<script src="../../../external/requirejs/require.js"></script>
|
||||
<script src="../../lib/css.js" data-modules="core tooltip"></script>
|
||||
<script src="../../lib/bootstrap.js" data-widget="tooltip" data-no-back-compat="true"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture">
|
||||
|
||||
<div>
|
||||
<a id="tooltipped1" href="#" title="anchortitle">anchor</a>
|
||||
<input title="inputtitle">
|
||||
<span id="multiple-describedby" aria-describedby="fixture-span" title="...">aria-describedby</span>
|
||||
<span id="fixture-span" title="title-text">span</span>
|
||||
<span id="contains-tooltipped" title="parent"><span id="contained-tooltipped" title="child">baz</span></span>
|
||||
</div>
|
||||
|
||||
<form id="tooltip-form">
|
||||
<input name="title" title="attroperties">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue