Merge branch 'master' into selectmenu

This commit is contained in:
Felix Nagel 2012-07-12 23:57:55 +02:00
commit 5092d0296a
141 changed files with 4176 additions and 2232 deletions

View File

@ -42,7 +42,7 @@ Adam Sontag <ajpiano@ajpiano.com>
Carl Fürstenberg <carl@excito.com>
Kevin Dalman <development@allpro.net>
Alberto Fernández Capel <afcapel@gmail.com>
Jacek Jędrzejewski <jacek.jedrzejewski@gmail.com>
Jacek Jędrzejewski (http://jacek.jedrzejewski.name)
Ting Kuei <ting@kuei.com>
Samuel Cormier-Iijima <sam@chide.it>
Jon Palmer <jonspalmer@gmail.com>
@ -170,7 +170,7 @@ Ian Simpson <spoonlikesham@gmail.com>
Lev Kitsis <spam4lev@gmail.com>
TJ VanToll <tj.vantoll@gmail.com>
Justin Domnitz <jdomnitz@gmail.com>
Douglas Cerna <replaceafill@system76.(none)>
Douglas Cerna <douglascerna@yahoo.com>
Bert ter Heide <bertjh@hotmail.com>
Jasvir Nagra <jasvir@gmail.com>
Petr Hromadko <yuriy@tokyoscale.com>
@ -187,3 +187,10 @@ Jason Moon <jmoon@socialcast.com>
Martin Frost <martinf55@hotmail.com>
Eneko Illarramendi <eneko@illarra.com>
EungJun Yi <semtlenori@gmail.com>
Courtland Allen <courtlandallen@gmail.com>
Viktar Varvanovich <non4eg@gmail.com>
Danny Trunk <dtrunk90@googlemail.com>
Pavel Stetina <pavel.stetina@nangu.tv>
Mike Stay <metaweta@gmail.com>
Steven Roussey <sroussey@gmail.com>
Mike Hollis <hollis21@gmail.com>

View File

@ -1,4 +1,5 @@
Copyright (c) 2012 Paul Bakaus, http://jqueryui.com/
Copyright 2012 jQuery Foundation and other contributors,
http://jqueryui.com/
This software consists of voluntary contributions made by many
individuals (AUTHORS.txt, http://jqueryui.com/about) For exact

188
build/tasks/build.js Normal file
View File

@ -0,0 +1,188 @@
module.exports = function( grunt ) {
var path = require( "path" );
grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() {
function replaceVersion( source ) {
return source.replace( /@VERSION/g, grunt.config( "pkg.version" ) );
}
function copyFile( src, dest ) {
if ( /(js|css)$/.test( src ) ) {
grunt.file.copy( src, dest, {
process: replaceVersion
});
} else {
grunt.file.copy( src, dest );
}
}
var files = grunt.file.expandFiles( this.file.src ),
target = this.file.dest + "/",
strip = this.data.strip,
renameCount = 0,
fileName;
if ( typeof strip === "string" ) {
strip = new RegExp( "^" + grunt.template.process( strip, grunt.config() ).replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ) );
}
files.forEach(function( fileName ) {
var targetFile = strip ? fileName.replace( strip, "" ) : fileName;
copyFile( fileName, target + targetFile );
});
grunt.log.writeln( "Copied " + files.length + " files." );
for ( fileName in this.data.renames ) {
renameCount += 1;
copyFile( fileName, target + grunt.template.process( this.data.renames[ fileName ], grunt.config() ) );
}
if ( renameCount ) {
grunt.log.writeln( "Renamed " + renameCount + " files." );
}
});
grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
// TODO switch back to adm-zip for better cross-platform compability once it actually works
// 0.1.3 works, but result can't be unzipped
// its also a lot slower then zip program, probably due to how its used...
// var files = grunt.file.expandFiles( "dist/" + this.file.src + "/**/*" );
// grunt.log.writeln( "Creating zip file " + this.file.dest );
//var AdmZip = require( "adm-zip" );
//var zip = new AdmZip();
//files.forEach(function( file ) {
// grunt.verbose.writeln( "Zipping " + file );
// // rewrite file names from dist folder (created by build), drop the /dist part
// zip.addFile(file.replace(/^dist/, "" ), fs.readFileSync( file ) );
//});
//zip.writeZip( "dist/" + this.file.dest );
//grunt.log.writeln( "Wrote " + files.length + " files to " + this.file.dest );
var done = this.async(),
dest = this.file.dest,
src = grunt.template.process( this.file.src, grunt.config() );
grunt.utils.spawn({
cmd: "zip",
args: [ "-r", dest, src ],
opts: {
cwd: 'dist'
}
}, function( err, result ) {
if ( err ) {
grunt.log.error( err );
done();
return;
}
grunt.log.writeln( "Zipped " + dest );
done();
});
});
grunt.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", function() {
// remove dest file before creating it, to make sure itself is not included
if ( path.existsSync( this.file.dest ) ) {
fs.unlinkSync( this.file.dest );
}
var crypto = require( "crypto" ),
dir = this.file.src + "/",
hashes = [];
grunt.file.expandFiles( dir + "**/*" ).forEach(function( fileName ) {
var hash = crypto.createHash( "md5" );
hash.update( grunt.file.read( fileName, "ascii" ) );
hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) );
});
grunt.file.write( this.file.dest, hashes.join( "\n" ) + "\n" );
grunt.log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" );
});
// only needed for 1.8
grunt.registerTask( "download_docs", function() {
function capitalize(value) {
return value[0].toUpperCase() + value.slice(1);
}
// should be grunt.config("pkg.version")?
var version = "1.8",
docsDir = "dist/docs",
files = "draggable droppable resizable selectable sortable accordion autocomplete button datepicker dialog progressbar slider tabs position"
.split(" ").map(function(widget) {
return {
url: "http://docs.jquery.com/action/render/UI/API/" + version + "/" + capitalize(widget),
dest: docsDir + '/' + widget + '.html'
};
});
files = files.concat("animate addClass effect hide removeClass show switchClass toggle toggleClass".split(" ").map(function(widget) {
return {
url: "http://docs.jquery.com/action/render/UI/Effects/" + widget,
dest: docsDir + '/' + widget + '.html'
};
}));
files = files.concat("Blind Clip Drop Explode Fade Fold Puff Slide Scale Bounce Highlight Pulsate Shake Size Transfer".split(" ").map(function(widget) {
return {
url: "http://docs.jquery.com/action/render/UI/Effects/" + widget,
dest: docsDir + '/effect-' + widget.toLowerCase() + '.html'
};
}));
grunt.file.mkdir( "dist/docs" );
grunt.utils.async.forEach( files, function( file, done ) {
var out = fs.createWriteStream( file.dest );
out.on( "close", done );
request( file.url ).pipe( out );
}, this.async() );
});
grunt.registerTask( "download_themes", function() {
// var AdmZip = require('adm-zip');
var done = this.async(),
themes = grunt.file.read( "build/themes" ).split(","),
requests = 0;
grunt.file.mkdir( "dist/tmp" );
themes.forEach(function( theme, index ) {
requests += 1;
grunt.file.mkdir( "dist/tmp/" + index );
var zipFileName = "dist/tmp/" + index + ".zip",
out = fs.createWriteStream( zipFileName );
out.on( "close", function() {
grunt.log.writeln( "done downloading " + zipFileName );
// TODO AdmZip produces "crc32 checksum failed", need to figure out why
// var zip = new AdmZip(zipFileName);
// zip.extractAllTo('dist/tmp/' + index + '/');
// until then, using cli unzip...
grunt.utils.spawn({
cmd: "unzip",
args: [ "-d", "dist/tmp/" + index, zipFileName ]
}, function( err, result ) {
grunt.log.writeln( "Unzipped " + zipFileName + ", deleting it now" );
fs.unlinkSync( zipFileName );
requests -= 1;
if (requests === 0) {
done();
}
});
});
request( "http://ui-dev.jquery.com/download/?" + theme ).pipe( out );
});
});
grunt.registerTask( "copy_themes", function() {
// each package includes the base theme, ignore that
var filter = /themes\/base/,
files = grunt.file.expandFiles( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) {
return !filter.test( file );
}),
// TODO the grunt.template.process call shouldn't be necessary
target = "dist/" + grunt.template.process( grunt.config( "files.themes" ), grunt.config() ) + "/",
distFolder = "dist/" + grunt.template.process( grunt.config( "files.dist" ), grunt.config() );
files.forEach(function( fileName ) {
var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui" );
grunt.file.copy( fileName, target + targetFile );
});
// copy minified base theme from regular release
files = grunt.file.expandFiles( distFolder + "/themes/base/**/*" );
files.forEach(function( fileName ) {
grunt.file.copy( fileName, target + fileName.replace( distFolder, "" ) );
});
});
grunt.registerTask( "clean", function() {
require( "rimraf" ).sync( "dist" );
});
};

74
build/tasks/testswarm.js Normal file
View File

@ -0,0 +1,74 @@
/*jshint node: true */
module.exports = function( grunt ) {
var tests = {
"Accordion": "accordion/accordion.html",
"Accordion_deprecated": "accordion/accordion_deprecated.html",
"Autocomplete": "autocomplete/autocomplete.html",
"Button": "button/button.html",
"Core": "core/core.html",
//"datepicker/datepicker.html",
//"dialog/dialog.html",
//"draggable/draggable.html",
//"droppable/droppable.html",
"Effects": "effects/effects.html",
"Menu": "menu/menu.html",
"Position": "position/position.html",
"Position_deprecated": "position/position_deprecated.html",
"Progressbar": "progressbar/progressbar.html",
//"resizable/resizable.html",
//"selectable/selectable.html",
//"slider/slider.html",
//"sortable/sortable.html",
"Spinner": "spinner/spinner.html",
"Tabs": "tabs/tabs.html",
"Tabs_deprecated": "tabs/tabs_deprecated.html",
"Tooltip": "tooltip/tooltip.html",
"Widget": "widget/widget.html"
};
function submit( commit, tests, configFile, done ) {
var test,
testswarm = require( "testswarm" ),
config = grunt.file.readJSON( configFile ).jqueryui,
testBase = config.testUrl + commit + "/tests/unit/",
testUrls = [];
for ( test in tests ) {
testUrls.push( testBase + tests[ test ] );
}
testswarm({
url: config.swarmUrl,
pollInterval: 10000,
timeout: 1000 * 60 * 30,
done: done
}, {
authUsername: config.authUsername,
authToken: config.authToken,
jobName: 'jQuery UI commit #<a href="https://github.com/jquery/jquery-ui/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
runMax: config.runMax,
"runNames[]": Object.keys(tests),
"runUrls[]": testUrls,
"browserSets[]": ["popular"]
});
}
grunt.registerTask( "testswarm", function( commit, configFile ) {
var test,
latestTests = {};
for ( test in tests ) {
latestTests[ test ] = tests[ test ] + "?nojshint=true";
}
submit( commit, latestTests, configFile, this.async() );
});
grunt.registerTask( "testswarm-multi-jquery", function( commit, configFile ) {
var allTests = {};
"1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.7 1.7.1 1.7.2 git".split(" ").forEach(function( version ) {
for ( var test in tests ) {
allTests[ test + "-" + version ] = tests[ test ] + "?nojshint=true&jquery=" + version;
}
});
submit( commit, allTests, configFile, this.async() );
});
};

View File

@ -5,7 +5,7 @@
<title>jQuery UI Effects - addClass demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }

View File

@ -5,7 +5,7 @@
<title>jQuery UI Effects - Animate demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }

View File

@ -7,13 +7,13 @@
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.bounce.js"></script>
<script src="../../ui/jquery.effects.clip.js"></script>
<script src="../../ui/jquery.effects.drop.js"></script>
<script src="../../ui/jquery.effects.fold.js"></script>
<script src="../../ui/jquery.effects.slide.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../ui/jquery.ui.effect-clip.js"></script>
<script src="../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../ui/jquery.ui.effect-fold.js"></script>
<script src="../../ui/jquery.ui.effect-slide.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>

View File

@ -13,9 +13,9 @@
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.resizable.js"></script>
<script src="../../ui/jquery.ui.dialog.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.explode.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../ui/jquery.ui.effect-explode.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
// increase the default animation speed to exaggerate the effect

View File

@ -14,7 +14,7 @@
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.resizable.js"></script>
<script src="../../ui/jquery.ui.dialog.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
body { font-size: 62.5%; }

View File

@ -16,7 +16,7 @@
<style>
h1 { padding: .2em; margin: 0; }
#products { float:left; width: 500px; margin-right: 2em; }
#cart { width: 200px; float: left; }
#cart { width: 200px; float: left; margin-top: 1em; }
/* style the list to maximize the droppable hitarea */
#cart ol { margin: 0; padding: 1em 0 1em 3em; }
</style>
@ -49,11 +49,11 @@
<body>
<div class="demo">
<div id="products">
<h1 class="ui-widget-header">Products</h1>
<h1 class="ui-widget-header">Products</h1>
<div id="catalog">
<h3><a href="#">T-Shirts</a></h3>
<h2><a href="#">T-Shirts</a></h2>
<div>
<ul>
<li>Lolcat Shirt</li>
@ -61,7 +61,7 @@
<li>Buckit Shirt</li>
</ul>
</div>
<h3><a href="#">Bags</a></h3>
<h2><a href="#">Bags</a></h2>
<div>
<ul>
<li>Zebra Striped</li>
@ -69,7 +69,7 @@
<li>Alligator Leather</li>
</ul>
</div>
<h3><a href="#">Gadgets</a></h3>
<h2><a href="#">Gadgets</a></h2>
<div>
<ul>
<li>iPhone</li>

View File

@ -5,20 +5,20 @@
<title>jQuery UI Effects - Effect demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.bounce.js"></script>
<script src="../../ui/jquery.effects.clip.js"></script>
<script src="../../ui/jquery.effects.drop.js"></script>
<script src="../../ui/jquery.effects.explode.js"></script>
<script src="../../ui/jquery.effects.fade.js"></script>
<script src="../../ui/jquery.effects.fold.js"></script>
<script src="../../ui/jquery.effects.highlight.js"></script>
<script src="../../ui/jquery.effects.pulsate.js"></script>
<script src="../../ui/jquery.effects.scale.js"></script>
<script src="../../ui/jquery.effects.shake.js"></script>
<script src="../../ui/jquery.effects.slide.js"></script>
<script src="../../ui/jquery.effects.transfer.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../ui/jquery.ui.effect-clip.js"></script>
<script src="../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../ui/jquery.ui.effect-explode.js"></script>
<script src="../../ui/jquery.ui.effect-fade.js"></script>
<script src="../../ui/jquery.ui.effect-fold.js"></script>
<script src="../../ui/jquery.ui.effect-highlight.js"></script>
<script src="../../ui/jquery.ui.effect-pulsate.js"></script>
<script src="../../ui/jquery.ui.effect-scale.js"></script>
<script src="../../ui/jquery.ui.effect-shake.js"></script>
<script src="../../ui/jquery.ui.effect-slide.js"></script>
<script src="../../ui/jquery.ui.effect-transfer.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }

View File

@ -5,7 +5,7 @@
<title>jQuery UI Effects - Easing demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.graph {

View File

@ -5,18 +5,18 @@
<title>jQuery UI Effects - Hide Demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.bounce.js"></script>
<script src="../../ui/jquery.effects.clip.js"></script>
<script src="../../ui/jquery.effects.drop.js"></script>
<script src="../../ui/jquery.effects.explode.js"></script>
<script src="../../ui/jquery.effects.fold.js"></script>
<script src="../../ui/jquery.effects.highlight.js"></script>
<script src="../../ui/jquery.effects.pulsate.js"></script>
<script src="../../ui/jquery.effects.scale.js"></script>
<script src="../../ui/jquery.effects.shake.js"></script>
<script src="../../ui/jquery.effects.slide.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../ui/jquery.ui.effect-clip.js"></script>
<script src="../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../ui/jquery.ui.effect-explode.js"></script>
<script src="../../ui/jquery.ui.effect-fold.js"></script>
<script src="../../ui/jquery.ui.effect-highlight.js"></script>
<script src="../../ui/jquery.ui.effect-pulsate.js"></script>
<script src="../../ui/jquery.ui.effect-scale.js"></script>
<script src="../../ui/jquery.ui.effect-shake.js"></script>
<script src="../../ui/jquery.ui.effect-slide.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; }

View File

@ -29,19 +29,19 @@
<script src="../ui/jquery.ui.spinner.js"></script>
<script src="../ui/jquery.ui.tabs.js"></script>
<script src="../ui/jquery.ui.tooltip.js"></script>
<script src="../ui/jquery.effects.core.js"></script>
<script src="../ui/jquery.effects.blind.js"></script>
<script src="../ui/jquery.effects.bounce.js"></script>
<script src="../ui/jquery.effects.clip.js"></script>
<script src="../ui/jquery.effects.drop.js"></script>
<script src="../ui/jquery.effects.explode.js"></script>
<script src="../ui/jquery.effects.fold.js"></script>
<script src="../ui/jquery.effects.highlight.js"></script>
<script src="../ui/jquery.effects.pulsate.js"></script>
<script src="../ui/jquery.effects.scale.js"></script>
<script src="../ui/jquery.effects.shake.js"></script>
<script src="../ui/jquery.effects.slide.js"></script>
<script src="../ui/jquery.effects.transfer.js"></script>
<script src="../ui/jquery.ui.effect.js"></script>
<script src="../ui/jquery.ui.effect-blind.js"></script>
<script src="../ui/jquery.ui.effect-bounce.js"></script>
<script src="../ui/jquery.ui.effect-clip.js"></script>
<script src="../ui/jquery.ui.effect-drop.js"></script>
<script src="../ui/jquery.ui.effect-explode.js"></script>
<script src="../ui/jquery.ui.effect-fold.js"></script>
<script src="../ui/jquery.ui.effect-highlight.js"></script>
<script src="../ui/jquery.ui.effect-pulsate.js"></script>
<script src="../ui/jquery.ui.effect-scale.js"></script>
<script src="../ui/jquery.ui.effect-shake.js"></script>
<script src="../ui/jquery.ui.effect-slide.js"></script>
<script src="../ui/jquery.ui.effect-transfer.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-af.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-ar.js"></script>
<script src="../ui/i18n/jquery.ui.datepicker-ar-DZ.js"></script>

View File

@ -1,28 +1,25 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Menu - Default demo</title>
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<title>jQuery UI Menu - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<link href="../demos.css" rel="stylesheet" />
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$(".demo ul").menu();
$( "#menu" ).menu();
});
</script>
<style>
</style>
</head>
<body>
<div class="demo">
<ul>
<ul id="menu">
<li><a href="#Aberdeen">Aberdeen</a></li>
<li><a href="#Ada">Ada</a></li>
<li><a href="#Adamsville">Adamsville</a></li>
@ -44,11 +41,9 @@
<div class="demo-description">
<p>A menu with the default configuration. A list is transformed, adding themeing, mouse and keyboard navigation support. Try to tab to the menu and use the cursor keys to navigate.</p>
<p>A menu with the default configuration. A list is transformed, adding theming, mouse and keyboard navigation support. Try to tab to the menu then use the cursor keys to navigate.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -1,9 +1,9 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta charset="utf-8">
<title>jQuery UI Menu Demos</title>
<link href="../demos.css" rel="stylesheet" />
<link rel="stylesheet" href="../demos.css">
</head>
<body>
<div class="demos-nav">

View File

@ -1,18 +1,18 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Menu - Navigation Menu demo</title>
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<title>jQuery UI Menu - Navigation Menu</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<link href="../demos.css" rel="stylesheet" />
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$("#navMenu").menu({
$( "#menu" ).menu({
select: function( event, ui ) {
var link = ui.item.children( "a:first" );
if ( link.attr( "target" ) || event.metaKey || event.shiftKey || event.ctrlKey ) {
@ -24,15 +24,14 @@
});
</script>
<style>
body { font-size:62.5%; }
.ui-menu { width: 200px; margin-bottom: 2em; }
.ui-menu { width: 200px; margin-bottom: 2em; }
</style>
</head>
<body>
<div class="demo">
<ul id="navMenu">
<ul id="menu">
<li><a href="?Aberdeen">Aberdeen</a></li>
<li><a href="?Ada">Ada</a></li>
<li><a href="?Adamsville">Adamsville</a></li>
@ -74,11 +73,9 @@
<div class="demo-description">
<p>A navigation menu. A list is transformed, adding themeing, mouse and keyboard navigation support. Try to tab to the menu and use the cursor keys to navigate.</p>
<p>A navigation menu. A list is transformed, adding theming, mouse and keyboard navigation support. Try to tab to the menu then use the cursor keys to navigate.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -3,8 +3,8 @@
<head>
<meta charset="utf-8">
<title>Menu Demo: Top-aligned Menu</title>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<link rel="stylesheet" href="../demos.css">
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
@ -12,18 +12,21 @@
<script src="../../ui/jquery.ui.menu.js"></script>
<script>
$(function() {
$("#topMenu").menu({
position: { of: "ul:has(a.ui-state-focus):last" }
$( "#menu" ).menu({
position: { of: "ul:has(a.ui-state-focus):last" },
icons: {
submenu: "ui-icon-carat-1-e"
}
});
});
</script>
<style>
.ui-menu { width: 200px; margin-bottom: 2em; }
.ui-menu { width: 200px; margin-bottom: 2em; }
</style>
</head>
<body>
<ul id="topMenu">
<ul id="menu">
<li><a href="#">Aberdeen</a></li>
<li><a href="#">Ada</a></li>
<li><a href="#">Adamsville</a></li>

View File

@ -5,7 +5,7 @@
<title>jQuery UI Effects - removeClass Demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }

View File

@ -5,18 +5,18 @@
<title>jQuery UI Effects - Show Demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.bounce.js"></script>
<script src="../../ui/jquery.effects.clip.js"></script>
<script src="../../ui/jquery.effects.drop.js"></script>
<script src="../../ui/jquery.effects.explode.js"></script>
<script src="../../ui/jquery.effects.fold.js"></script>
<script src="../../ui/jquery.effects.highlight.js"></script>
<script src="../../ui/jquery.effects.pulsate.js"></script>
<script src="../../ui/jquery.effects.scale.js"></script>
<script src="../../ui/jquery.effects.shake.js"></script>
<script src="../../ui/jquery.effects.slide.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../ui/jquery.ui.effect-clip.js"></script>
<script src="../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../ui/jquery.ui.effect-explode.js"></script>
<script src="../../ui/jquery.ui.effect-fold.js"></script>
<script src="../../ui/jquery.ui.effect-highlight.js"></script>
<script src="../../ui/jquery.ui.effect-pulsate.js"></script>
<script src="../../ui/jquery.ui.effect-scale.js"></script>
<script src="../../ui/jquery.ui.effect-shake.js"></script>
<script src="../../ui/jquery.ui.effect-slide.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; }

View File

@ -5,7 +5,7 @@
<title>jQuery UI Spinner - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.mousewheel.js"></script>
<script src="../../external/globalize.js"></script>
<script src="../../external/globalize.culture.de-DE.js"></script>
<script src="../../external/globalize.culture.ja-JP.js"></script>

View File

@ -5,7 +5,7 @@
<title>jQuery UI Spinner - Decimal</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.mousewheel.js"></script>
<script src="../../external/globalize.js"></script>
<script src="../../external/globalize.culture.de-DE.js"></script>
<script src="../../external/globalize.culture.ja-JP.js"></script>

View File

@ -5,7 +5,7 @@
<title>jQuery UI Spinner - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.mousewheel.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>

View File

@ -6,7 +6,7 @@
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.mousewheel.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>

View File

@ -5,7 +5,7 @@
<title>jQuery UI Spinner - Overflow</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.mousewheel.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>

View File

@ -5,7 +5,7 @@
<title>jQuery UI Spinner - Time</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.mousewheel.js"></script>
<script src="../../external/globalize.js"></script>
<script src="../../external/globalize.culture.de-DE.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>

View File

@ -5,7 +5,7 @@
<title>jQuery UI Effects - switchClass Demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }

View File

@ -1,57 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Tabs - Default functionality</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../external/jquery.cookie.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.tabs.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#tabs" ).tabs({
cookie: {
// store cookie for a day, without, it would be a session cookie
expires: 1
}
});
});
</script>
</head>
<body>
<div class="demo">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Nunc tincidunt</a></li>
<li><a href="#tabs-2">Proin dolor</a></li>
<li><a href="#tabs-3">Aenean lacinia</a></li>
</ul>
<div id="tabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div id="tabs-2">
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
</div>
<div id="tabs-3">
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>Looks the same as the default demo, but uses cookie to store the selected tab, and restore it when the page (re)loads.
The cookie is stored for a day, so tabs will be restored even after closing the browser. Use cookie: {} for using cookies with default options.</p>
<p>The cookie option requires the cookie plugin, which can be found in the development-bundle > external folder from the download builder.</p>
</div><!-- End demo-description -->
</body>
</html>

View File

@ -17,7 +17,6 @@
<li><a href="sortable.html">Sortable</a></li>
<li><a href="manipulation.html">Simple manipulation</a></li>
<li><a href="bottom.html">Tabs below content</a></li>
<li><a href="cookie.html">Cookie persistence</a></li>
</ul>
</div>

View File

@ -5,18 +5,18 @@
<title>jQuery UI Effects - Toggle Demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.effects.bounce.js"></script>
<script src="../../ui/jquery.effects.clip.js"></script>
<script src="../../ui/jquery.effects.drop.js"></script>
<script src="../../ui/jquery.effects.explode.js"></script>
<script src="../../ui/jquery.effects.fold.js"></script>
<script src="../../ui/jquery.effects.highlight.js"></script>
<script src="../../ui/jquery.effects.pulsate.js"></script>
<script src="../../ui/jquery.effects.scale.js"></script>
<script src="../../ui/jquery.effects.shake.js"></script>
<script src="../../ui/jquery.effects.slide.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../ui/jquery.ui.effect-clip.js"></script>
<script src="../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../ui/jquery.ui.effect-explode.js"></script>
<script src="../../ui/jquery.ui.effect-fold.js"></script>
<script src="../../ui/jquery.ui.effect-highlight.js"></script>
<script src="../../ui/jquery.ui.effect-pulsate.js"></script>
<script src="../../ui/jquery.ui.effect-scale.js"></script>
<script src="../../ui/jquery.ui.effect-shake.js"></script>
<script src="../../ui/jquery.ui.effect-slide.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler {

View File

@ -5,7 +5,7 @@
<title>jQuery UI Effects - toggleClass Demo</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.7.2.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.toggler { width: 500px; height: 200px; position: relative; }

View File

@ -9,8 +9,8 @@
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.position.js"></script>
<script src="../../ui/jquery.ui.tooltip.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.explode.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-explode.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {

View File

@ -19,24 +19,7 @@
<script>
$(function() {
$( ".demo" ).tooltip({
position: {
my: "left+25 center",
at: "center"
},
open: function( event ) {
var tooltip = $( ".ui-tooltip" ),
positionOption = $( this ).tooltip( "option", "position" );
function position( event ) {
positionOption.of = event;
tooltip.position( positionOption );
}
$( document ).bind( "mousemove.tooltip-position", position );
// trigger once to override element-relative positioning
position( event );
},
close: function() {
$( document ).unbind( "mousemove.tooltip-position" );
}
track: true
});
});
</script>

View File

@ -11,8 +11,8 @@
<script src="../../ui/jquery.ui.tooltip.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
<script src="../../ui/jquery.ui.menu.js"></script>
<script src="../../ui/jquery.effects.core.js"></script>
<script src="../../ui/jquery.effects.blind.js"></script>
<script src="../../ui/jquery.ui.effect.js"></script>
<script src="../../ui/jquery.ui.effect-blind.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
.player {

View File

@ -56,8 +56,8 @@
.button();
// bind click events on the changer button to the random method
this._bind( this.changer, {
// _bind won't call random when widget is disabled
this._on( this.changer, {
// _on won't call random when widget is disabled
click: "random"
});
this._refresh();
@ -90,7 +90,7 @@
}
},
// events bound via _bind are removed automatically
// events bound via _on are removed automatically
// revert other modifications here
_destroy: function() {
// remove generated elements

View File

@ -1,12 +1,12 @@
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.4
*
* Version: 3.0.6
*
* Requires: 1.2.2+
*/
@ -14,6 +14,12 @@
var types = ['DOMMouseScroll', 'mousewheel'];
if ($.event.fixHooks) {
for ( var i=types.length; i; ) {
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
}
}
$.event.special.mousewheel = {
setup: function() {
if ( this.addEventListener ) {
@ -24,7 +30,7 @@ $.event.special.mousewheel = {
this.onmousewheel = handler;
}
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i=types.length; i; ) {
@ -40,7 +46,7 @@ $.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
},
unmousewheel: function(fn) {
return this.unbind("mousewheel", fn);
}
@ -51,28 +57,28 @@ function handler(event) {
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
event = $.event.fix(orgEvent);
event.type = "mousewheel";
// Old school scrollwheel delta
if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
if ( event.detail ) { delta = -event.detail/3; }
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
// New school multidimensional scroll (touchpads) deltas
deltaY = delta;
// Gecko
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaY = 0;
deltaX = -1*delta;
}
// Webkit
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
return $.event.handle.apply(this, args);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
})(jQuery);

41
external/qunit.css vendored
View File

@ -1,5 +1,5 @@
/**
* QUnit v1.6.0 - A JavaScript Unit Testing Framework
* QUnit v1.9.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
@ -38,10 +38,10 @@
line-height: 1em;
font-weight: normal;
border-radius: 15px 15px 0 0;
-moz-border-radius: 15px 15px 0 0;
-webkit-border-top-right-radius: 15px;
-webkit-border-top-left-radius: 15px;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
}
#qunit-header a {
@ -54,9 +54,9 @@
color: #fff;
}
#qunit-header label {
#qunit-testrunner-toolbar label {
display: inline-block;
padding-left: 0.5em;
padding: 0 .5em 0 .1em;
}
#qunit-banner {
@ -113,13 +113,9 @@
background-color: #fff;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
box-shadow: inset 0px 2px 13px #999;
-moz-box-shadow: inset 0px 2px 13px #999;
-webkit-box-shadow: inset 0px 2px 13px #999;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
#qunit-tests table {
@ -162,8 +158,7 @@
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
margin: 0.5em;
padding: 0.4em 0.5em 0.4em 0.5em;
padding: 5px;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
@ -172,9 +167,9 @@
/*** Passing Styles */
#qunit-tests li li.pass {
color: #5E740B;
color: #3c510c;
background-color: #fff;
border-left: 26px solid #C6E746;
border-left: 10px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
@ -190,15 +185,15 @@
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 26px solid #EE5757;
border-left: 10px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 15px 15px;
-moz-border-radius: 0 0 15px 15px;
-webkit-border-bottom-right-radius: 15px;
-webkit-border-bottom-left-radius: 15px;
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }

525
external/qunit.js vendored
View File

@ -1,5 +1,5 @@
/**
* QUnit v1.6.0 - A JavaScript Unit Testing Framework
* QUnit v1.9.0 - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
@ -12,7 +12,9 @@
var QUnit,
config,
onErrorFnPrev,
testId = 0,
fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
defined = {
@ -29,26 +31,31 @@ var QUnit,
}())
};
function Test( name, testName, expected, async, callback ) {
this.name = name;
this.testName = testName;
this.expected = expected;
this.async = async;
this.callback = callback;
function Test( settings ) {
extend( this, settings );
this.assertions = [];
this.testNumber = ++Test.count;
}
Test.count = 0;
Test.prototype = {
init: function() {
var b, li,
var a, b, li,
tests = id( "qunit-tests" );
if ( tests ) {
b = document.createElement( "strong" );
b.innerHTML = "Running " + this.name;
b.innerHTML = this.name;
// `a` initialized at top of scope
a = document.createElement( "a" );
a.innerHTML = "Rerun";
a.href = QUnit.url({ testNumber: this.testNumber });
li = document.createElement( "li" );
li.appendChild( b );
li.appendChild( a );
li.className = "running";
li.id = this.id = "qunit-test-output" + testId++;
@ -119,14 +126,14 @@ Test.prototype = {
}
if ( config.notrycatch ) {
this.callback.call( this.testEnvironment );
this.callback.call( this.testEnvironment, QUnit.assert );
return;
}
try {
this.callback.call( this.testEnvironment );
this.callback.call( this.testEnvironment, QUnit.assert );
} catch( e ) {
QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + ": " + e.message, extractStacktrace( e, 1 ) );
QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + e.message, extractStacktrace( e, 0 ) );
// else next test will carry the responsibility
saveGlobal();
@ -152,13 +159,16 @@ Test.prototype = {
},
finish: function() {
config.current = this;
if ( this.expected != null && this.expected != this.assertions.length ) {
if ( config.requireExpects && this.expected == null ) {
QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
} else if ( this.expected != null && this.expected != this.assertions.length ) {
QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );
} else if ( this.expected == null && !this.assertions.length ) {
QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack );
}
var assertion, a, b, i, li, ol,
test = this,
good = 0,
bad = 0,
tests = id( "qunit-tests" );
@ -203,11 +213,6 @@ Test.prototype = {
b = document.createElement( "strong" );
b.innerHTML = this.name + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
// `a` initialized at top of scope
a = document.createElement( "a" );
a.innerHTML = "Rerun";
a.href = QUnit.url({ filter: getText([b]).replace( /\([^)]+\)$/, "" ).replace( /(^\s*|\s*$)/g, "" ) });
addEvent(b, "click", function() {
var next = b.nextSibling.nextSibling,
display = next.style.display;
@ -220,9 +225,7 @@ Test.prototype = {
target = target.parentNode;
}
if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
window.location = QUnit.url({
filter: getText([target]).replace( /\([^)]+\)$/, "" ).replace( /(^\s*|\s*$)/g, "" )
});
window.location = QUnit.url({ testNumber: test.testNumber });
}
});
@ -230,8 +233,9 @@ Test.prototype = {
li = id( this.id );
li.className = bad ? "fail" : "pass";
li.removeChild( li.firstChild );
a = li.firstChild;
li.appendChild( b );
li.appendChild( a );
li.appendChild ( a );
li.appendChild( ol );
} else {
@ -253,6 +257,8 @@ Test.prototype = {
});
QUnit.reset();
config.current = undefined;
},
queue: function() {
@ -291,6 +297,7 @@ Test.prototype = {
}
};
// Root QUnit object.
// `QUnit` initialized at top of scope
QUnit = {
@ -322,14 +329,21 @@ QUnit = {
name = "<span class='module-name'>" + config.currentModule + "</span>: " + name;
}
if ( !validTest(config.currentModule + ": " + testName) ) {
test = new Test({
name: name,
testName: testName,
expected: expected,
async: async,
callback: callback,
module: config.currentModule,
moduleTestEnvironment: config.currentModuleTestEnviroment,
stack: sourceFromStacktrace( 2 )
});
if ( !validTest( test ) ) {
return;
}
test = new Test( name, testName, expected, async, callback );
test.module = config.currentModule;
test.moduleTestEnvironment = config.currentModuleTestEnviroment;
test.stack = sourceFromStacktrace( 2 );
test.queue();
},
@ -338,97 +352,6 @@ QUnit = {
config.current.expected = asserts;
},
// Asserts true.
// @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
ok: function( result, msg ) {
if ( !config.current ) {
throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
}
result = !!result;
var source,
details = {
result: result,
message: msg
};
msg = escapeInnerText( msg || (result ? "okay" : "failed" ) );
msg = "<span class='test-message'>" + msg + "</span>";
if ( !result ) {
source = sourceFromStacktrace( 2 );
if ( source ) {
details.source = source;
msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr></table>";
}
}
runLoggingCallbacks( "log", QUnit, details );
config.current.assertions.push({
result: result,
message: msg
});
},
// Checks that the first two arguments are equal, with an optional message. Prints out both actual and expected values.
// @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes." );
equal: function( actual, expected, message ) {
QUnit.push( expected == actual, actual, expected, message );
},
notEqual: function( actual, expected, message ) {
QUnit.push( expected != actual, actual, expected, message );
},
deepEqual: function( actual, expected, message ) {
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
},
notDeepEqual: function( actual, expected, message ) {
QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
},
strictEqual: function( actual, expected, message ) {
QUnit.push( expected === actual, actual, expected, message );
},
notStrictEqual: function( actual, expected, message ) {
QUnit.push( expected !== actual, actual, expected, message );
},
raises: function( block, expected, message ) {
var actual,
ok = false;
if ( typeof expected === "string" ) {
message = expected;
expected = null;
}
try {
block.call( config.current.testEnvironment );
} catch (e) {
actual = e;
}
if ( actual ) {
// we don't want to validate thrown error
if ( !expected ) {
ok = true;
// expected is a regexp
} else if ( QUnit.objectType( expected ) === "regexp" ) {
ok = expected.test( actual );
// expected is a constructor
} else if ( actual instanceof expected ) {
ok = true;
// expected is a validation function which returns true is validation passed
} else if ( expected.call( {}, actual ) === true ) {
ok = true;
}
}
QUnit.ok( ok, message );
},
start: function( count ) {
config.semaphore -= count || 1;
// don't start until equal number of stop-calls
@ -473,6 +396,160 @@ QUnit = {
}
};
// Asssert helpers
// All of these must call either QUnit.push() or manually do:
// - runLoggingCallbacks( "log", .. );
// - config.current.assertions.push({ .. });
QUnit.assert = {
/**
* Asserts rough true-ish result.
* @name ok
* @function
* @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
*/
ok: function( result, msg ) {
if ( !config.current ) {
throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
}
result = !!result;
var source,
details = {
result: result,
message: msg
};
msg = escapeInnerText( msg || (result ? "okay" : "failed" ) );
msg = "<span class='test-message'>" + msg + "</span>";
if ( !result ) {
source = sourceFromStacktrace( 2 );
if ( source ) {
details.source = source;
msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr></table>";
}
}
runLoggingCallbacks( "log", QUnit, details );
config.current.assertions.push({
result: result,
message: msg
});
},
/**
* Assert that the first two arguments are equal, with an optional message.
* Prints out both actual and expected values.
* @name equal
* @function
* @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
*/
equal: function( actual, expected, message ) {
QUnit.push( expected == actual, actual, expected, message );
},
/**
* @name notEqual
* @function
*/
notEqual: function( actual, expected, message ) {
QUnit.push( expected != actual, actual, expected, message );
},
/**
* @name deepEqual
* @function
*/
deepEqual: function( actual, expected, message ) {
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
},
/**
* @name notDeepEqual
* @function
*/
notDeepEqual: function( actual, expected, message ) {
QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
},
/**
* @name strictEqual
* @function
*/
strictEqual: function( actual, expected, message ) {
QUnit.push( expected === actual, actual, expected, message );
},
/**
* @name notStrictEqual
* @function
*/
notStrictEqual: function( actual, expected, message ) {
QUnit.push( expected !== actual, actual, expected, message );
},
throws: function( block, expected, message ) {
var actual,
ok = false;
// 'expected' is optional
if ( typeof expected === "string" ) {
message = expected;
expected = null;
}
config.current.ignoreGlobalErrors = true;
try {
block.call( config.current.testEnvironment );
} catch (e) {
actual = e;
}
config.current.ignoreGlobalErrors = false;
if ( actual ) {
// we don't want to validate thrown error
if ( !expected ) {
ok = true;
// expected is a regexp
} else if ( QUnit.objectType( expected ) === "regexp" ) {
ok = expected.test( actual );
// expected is a constructor
} else if ( actual instanceof expected ) {
ok = true;
// expected is a validation function which returns true is validation passed
} else if ( expected.call( {}, actual ) === true ) {
ok = true;
}
QUnit.push( ok, actual, null, message );
} else {
QUnit.pushFailure( message, null, 'No exception was thrown.' );
}
}
};
/**
* @deprecate since 1.8.0
* Kept assertion helpers in root for backwards compatibility
*/
extend( QUnit, QUnit.assert );
/**
* @deprecated since 1.9.0
* Kept global "raises()" for backwards compatibility
*/
QUnit.raises = QUnit.assert.throws;
/**
* @deprecated since 1.0.0, replaced with error pushes since 1.3.0
* Kept to avoid TypeErrors for undefined methods.
*/
QUnit.equals = function() {
QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
};
QUnit.same = function() {
QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
};
// We want access to the constructor's prototype
(function() {
function F() {}
@ -482,17 +559,11 @@ QUnit = {
QUnit.constructor = F;
}());
// deprecated; still export them to window to provide clear error messages
// next step: remove entirely
QUnit.equals = function() {
QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
};
QUnit.same = function() {
QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
};
// Maintain internal state
// `config` initialized at top of scope
/**
* Config object: Maintain internal state
* Later exposed as QUnit.config
* `config` initialized at top of scope
*/
config = {
// The queue of tests to run
queue: [],
@ -511,7 +582,23 @@ config = {
// by default, modify document.title when suite is done
altertitle: true,
urlConfig: [ "noglobals", "notrycatch" ],
// when enabled, all tests must call expect()
requireExpects: false,
// add checkboxes that are persisted in the query-string
// when enabled, the id is set to `true` as a `QUnit.config` property
urlConfig: [
{
id: "noglobals",
label: "Check for Globals",
tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
},
{
id: "notrycatch",
label: "No try-catch",
tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
}
],
// logging callback queues
begin: [],
@ -523,7 +610,7 @@ config = {
moduleDone: []
};
// Load paramaters
// Initialize more QUnit.config and QUnit.urlParams
(function() {
var i,
location = window.location || { search: "", protocol: "file:" },
@ -543,20 +630,30 @@ config = {
}
QUnit.urlParams = urlParams;
// String search anywhere in moduleName+testName
config.filter = urlParams.filter;
// Exact match of the module name
config.module = urlParams.module;
config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;
// Figure out if we're running the tests from a server or not
QUnit.isLocal = location.protocol === "file:";
}());
// Expose the API as global variables, unless an 'exports' object exists,
// in that case we assume we're in CommonJS - export everything at the end
// Export global variables, unless an 'exports' object exists,
// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
if ( typeof exports === "undefined" ) {
extend( window, QUnit );
// Expose QUnit object
window.QUnit = QUnit;
}
// define these after exposing globals to keep them in these QUnit namespace only
// Extend QUnit object,
// these after set here because they should not be exposed as global functions
extend( QUnit, {
config: config,
@ -722,22 +819,34 @@ extend( QUnit, {
});
},
pushFailure: function( message, source ) {
pushFailure: function( message, source, actual ) {
if ( !config.current ) {
throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
}
var output,
details = {
result: false,
message: message
};
message = escapeInnerText(message ) || "error";
message = escapeInnerText( message ) || "error";
message = "<span class='test-message'>" + message + "</span>";
output = message;
output += "<table>";
if ( actual ) {
output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeInnerText( actual ) + "</pre></td></tr>";
}
if ( source ) {
details.source = source;
output += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr></table>";
output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeInnerText( source ) + "</pre></td></tr>";
}
output += "</table>";
runLoggingCallbacks( "log", QUnit, details );
config.current.assertions.push({
@ -764,25 +873,37 @@ extend( QUnit, {
extend: extend,
id: id,
addEvent: addEvent
// load, equiv, jsDump, diff: Attached later
});
// QUnit.constructor is set to the empty F() above so that we can add to it's prototype later
// Doing this allows us to tell if the following methods have been overwritten on the actual
// QUnit object, which is a deprecated way of using the callbacks.
/**
* @deprecated: Created for backwards compatibility with test runner that set the hook function
* into QUnit.{hook}, instead of invoking it and passing the hook function.
* QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
* Doing this allows us to tell if the following methods have been overwritten on the actual
* QUnit object.
*/
extend( QUnit.constructor.prototype, {
// Logging callbacks; all receive a single argument with the listed properties
// run test/logs.html for any related changes
begin: registerLoggingCallback( "begin" ),
// done: { failed, passed, total, runtime }
done: registerLoggingCallback( "done" ),
// log: { result, actual, expected, message }
log: registerLoggingCallback( "log" ),
// testStart: { name }
testStart: registerLoggingCallback( "testStart" ),
// testDone: { name, failed, passed, total }
testDone: registerLoggingCallback( "testDone" ),
// moduleStart: { name }
moduleStart: registerLoggingCallback( "moduleStart" ),
// moduleDone: { name, failed, passed, total }
moduleDone: registerLoggingCallback( "moduleDone" )
});
@ -795,7 +916,7 @@ QUnit.load = function() {
runLoggingCallbacks( "begin", QUnit, {} );
// Initialize the config, saving the execution queue
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val,
var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, urlConfigCheckboxes,
urlConfigHtml = "",
oldconfig = extend( {}, config );
@ -808,8 +929,15 @@ QUnit.load = function() {
for ( i = 0; i < len; i++ ) {
val = config.urlConfig[i];
config[val] = QUnit.urlParams[val];
urlConfigHtml += "<label><input name='" + val + "' type='checkbox'" + ( config[val] ? " checked='checked'" : "" ) + ">" + val + "</label>";
if ( typeof val === "string" ) {
val = {
id: val,
label: val,
tooltip: "[no tooltip available]"
};
}
config[ val.id ] = QUnit.urlParams[ val.id ];
urlConfigHtml += "<input id='qunit-urlconfig-" + val.id + "' name='" + val.id + "' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) + " title='" + val.tooltip + "'><label for='qunit-urlconfig-" + val.id + "' title='" + val.tooltip + "'>" + val.label + "</label>";
}
// `userAgent` initialized at top of scope
@ -821,12 +949,7 @@ QUnit.load = function() {
// `banner` initialized at top of scope
banner = id( "qunit-header" );
if ( banner ) {
banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined }) + "'>" + banner.innerHTML + "</a> " + urlConfigHtml;
addEvent( banner, "change", function( event ) {
var params = {};
params[ event.target.name ] = event.target.checked ? true : undefined;
window.location = QUnit.url( params );
});
banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
}
// `toolbar` initialized at top of scope
@ -867,8 +990,18 @@ QUnit.load = function() {
// `label` initialized at top of scope
label = document.createElement( "label" );
label.setAttribute( "for", "qunit-filter-pass" );
label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." );
label.innerHTML = "Hide passed tests";
toolbar.appendChild( label );
urlConfigCheckboxes = document.createElement( 'span' );
urlConfigCheckboxes.innerHTML = urlConfigHtml;
addEvent( urlConfigCheckboxes, "change", function( event ) {
var params = {};
params[ event.target.name ] = event.target.checked ? true : undefined;
window.location = QUnit.url( params );
});
toolbar.appendChild( urlConfigCheckboxes );
}
// `main` initialized at top of scope
@ -884,15 +1017,36 @@ QUnit.load = function() {
addEvent( window, "load", QUnit.load );
// addEvent(window, "error" ) gives us a useless event object
window.onerror = function( message, file, line ) {
if ( QUnit.config.current ) {
QUnit.pushFailure( message, file + ":" + line );
} else {
QUnit.test( "global failure", function() {
QUnit.pushFailure( message, file + ":" + line );
});
// `onErrorFnPrev` initialized at top of scope
// Preserve other handlers
onErrorFnPrev = window.onerror;
// Cover uncaught exceptions
// Returning true will surpress the default browser handler,
// returning false will let it run.
window.onerror = function ( error, filePath, linerNr ) {
var ret = false;
if ( onErrorFnPrev ) {
ret = onErrorFnPrev( error, filePath, linerNr );
}
// Treat return value as window.onerror itself does,
// Only do our handling if not surpressed.
if ( ret !== true ) {
if ( QUnit.config.current ) {
if ( QUnit.config.current.ignoreGlobalErrors ) {
return true;
}
QUnit.pushFailure( error, filePath + ":" + linerNr );
} else {
QUnit.test( "global failure", function() {
QUnit.pushFailure( error, filePath + ":" + linerNr );
});
}
return false;
}
return ret;
};
function done() {
@ -962,39 +1116,46 @@ function done() {
});
}
function validTest( name ) {
var not,
filter = config.filter,
run = false;
/** @return Boolean: true if this test should be ran */
function validTest( test ) {
var include,
filter = config.filter && config.filter.toLowerCase(),
module = config.module && config.module.toLowerCase(),
fullName = (test.module + ": " + test.testName).toLowerCase();
if ( config.testNumber ) {
return test.testNumber === config.testNumber;
}
if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
return false;
}
if ( !filter ) {
return true;
}
not = filter.charAt( 0 ) === "!";
if ( not ) {
include = filter.charAt( 0 ) !== "!";
if ( !include ) {
filter = filter.slice( 1 );
}
if ( name.indexOf( filter ) !== -1 ) {
return !not;
// If the filter matches, we need to honour include
if ( fullName.indexOf( filter ) !== -1 ) {
return include;
}
if ( not ) {
run = true;
}
return run;
// Otherwise, do the opposite
return !include;
}
// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)
// Later Safari and IE10 are supposed to support error.stack as well
// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
function extractStacktrace( e, offset ) {
offset = offset || 3;
offset = offset === undefined ? 3 : offset;
var stack;
var stack, include, i, regex;
if ( e.stacktrace ) {
// Opera
@ -1005,6 +1166,18 @@ function extractStacktrace( e, offset ) {
if (/^error$/i.test( stack[0] ) ) {
stack.shift();
}
if ( fileName ) {
include = [];
for ( i = offset; i < stack.length; i++ ) {
if ( stack[ i ].indexOf( fileName ) != -1 ) {
break;
}
include.push( stack[ i ] );
}
if ( include.length ) {
return include.join( "\n" );
}
}
return stack[ offset ];
} else if ( e.sourceURL ) {
// Safari, PhantomJS
@ -1419,11 +1592,11 @@ QUnit.jsDump = (function() {
type = "null";
} else if ( typeof obj === "undefined" ) {
type = "undefined";
} else if ( QUnit.is( "RegExp", obj) ) {
} else if ( QUnit.is( "regexp", obj) ) {
type = "regexp";
} else if ( QUnit.is( "Date", obj) ) {
} else if ( QUnit.is( "date", obj) ) {
type = "date";
} else if ( QUnit.is( "Function", obj) ) {
} else if ( QUnit.is( "function", obj) ) {
type = "function";
} else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {
type = "window";

270
grunt.js
View File

@ -16,7 +16,7 @@ var // modules
"jquery.ui.resizable.js",
"jquery.ui.selectable.js",
"jquery.ui.sortable.js",
"jquery.effects.core.js"
"jquery.ui.effect.js"
],
uiFiles = coreFiles.map(function( file ) {
@ -80,12 +80,14 @@ uiFiles.forEach(function( file ) {
compareFiles[ file ] = [ file, mapMinFile( file ) ];
});
// csslint and cssmin tasks
// grunt plugins
grunt.loadNpmTasks( "grunt-css" );
// file size comparison tasks
grunt.loadNpmTasks( "grunt-compare-size" );
// html validation task
grunt.loadNpmTasks( "grunt-html" );
grunt.loadNpmTasks( "grunt-compare-size" );
grunt.loadNpmTasks( "grunt-junit" );
grunt.loadNpmTasks( "grunt-git-authors" );
// local testswarm and build tasks
grunt.loadTasks( "build/tasks" );
grunt.registerHelper( "strip_all_banners", function( filepath ) {
return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" );
@ -291,7 +293,7 @@ grunt.initConfig({
// TODO remove items from this list once rewritten
return !( /(mouse|datepicker|draggable|droppable|resizable|selectable|sortable)\.js$/ ).test( file );
}),
grunt: "grunt.js",
grunt: [ "grunt.js", "build/tasks/*.js" ],
tests: "tests/unit/**/*.js"
},
csslint: {
@ -340,262 +342,6 @@ grunt.initConfig({
})()
});
grunt.registerTask( "testswarm", function( commit, configFile ) {
var test,
testswarm = require( "testswarm" ),
testBase = "http://swarm.jquery.org/git/jquery-ui/" + commit + "/tests/unit/",
testUrls = [],
tests = {
"Accordion": "accordion/accordion.html",
"Accordion_deprecated": "accordion/accordion_deprecated.html",
"Autocomplete": "autocomplete/autocomplete.html",
"Button": "button/button.html",
"Core": "core/core.html",
//"datepicker/datepicker.html",
//"dialog/dialog.html",
//"draggable/draggable.html",
//"droppable/droppable.html",
"Effects": "effects/effects.html",
"Menu": "menu/menu.html",
"Position": "position/position.html",
"Position_deprecated": "position/position_deprecated.html",
"Progressbar": "progressbar/progressbar.html",
//"resizable/resizable.html",
//"selectable/selectable.html",
//"slider/slider.html",
//"sortable/sortable.html",
"Spinner": "spinner/spinner.html",
"Tabs": "tabs/tabs.html",
"Tabs_deprecated": "tabs/tabs_deprecated.html",
"Tooltip": "tooltip/tooltip.html",
"Widget": "widget/widget.html"
};
for ( test in tests ) {
testUrls.push( testBase + tests[ test ] + "?nojshint=true" );
}
testswarm({
url: "http://swarm.jquery.org/",
pollInterval: 10000,
timeout: 1000 * 60 * 30,
done: this.async()
}, {
authUsername: "jqueryui",
authToken: grunt.file.readJSON( configFile ).jqueryui.authToken,
jobName: 'jQuery UI commit #<a href="https://github.com/jquery/jquery-ui/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
runMax: 3,
"runNames[]": Object.keys(tests),
"runUrls[]": testUrls,
"browserSets[]": ["popular"]
});
});
grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() {
function replaceVersion( source ) {
return source.replace( /@VERSION/g, grunt.config( "pkg.version" ) );
}
function copyFile( src, dest ) {
if ( /(js|css)$/.test( src ) ) {
grunt.file.copy( src, dest, {
process: replaceVersion
});
} else {
grunt.file.copy( src, dest );
}
}
var files = grunt.file.expandFiles( this.file.src ),
target = this.file.dest + "/",
strip = this.data.strip,
renameCount = 0,
fileName;
if ( typeof strip === "string" ) {
strip = new RegExp( "^" + grunt.template.process( strip, grunt.config() ).replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ) );
}
files.forEach(function( fileName ) {
var targetFile = strip ? fileName.replace( strip, "" ) : fileName;
copyFile( fileName, target + targetFile );
});
grunt.log.writeln( "Copied " + files.length + " files." );
for ( fileName in this.data.renames ) {
renameCount += 1;
copyFile( fileName, target + grunt.template.process( this.data.renames[ fileName ], grunt.config() ) );
}
if ( renameCount ) {
grunt.log.writeln( "Renamed " + renameCount + " files." );
}
});
grunt.registerMultiTask( "zip", "Create a zip file for release", function() {
// TODO switch back to adm-zip for better cross-platform compability once it actually works
// 0.1.3 works, but result can't be unzipped
// its also a lot slower then zip program, probably due to how its used...
// var files = grunt.file.expandFiles( "dist/" + this.file.src + "/**/*" );
// grunt.log.writeln( "Creating zip file " + this.file.dest );
//var AdmZip = require( "adm-zip" );
//var zip = new AdmZip();
//files.forEach(function( file ) {
// grunt.verbose.writeln( "Zipping " + file );
// // rewrite file names from dist folder (created by build), drop the /dist part
// zip.addFile(file.replace(/^dist/, "" ), fs.readFileSync( file ) );
//});
//zip.writeZip( "dist/" + this.file.dest );
//grunt.log.writeln( "Wrote " + files.length + " files to " + this.file.dest );
var done = this.async(),
dest = this.file.dest,
src = grunt.template.process( this.file.src, grunt.config() );
grunt.utils.spawn({
cmd: "zip",
args: [ "-r", dest, src ],
opts: {
cwd: 'dist'
}
}, function( err, result ) {
if ( err ) {
grunt.log.error( err );
done();
return;
}
grunt.log.writeln( "Zipped " + dest );
done();
});
});
grunt.registerMultiTask( "md5", "Create list of md5 hashes for CDN uploads", function() {
// remove dest file before creating it, to make sure itself is not included
if ( path.existsSync( this.file.dest ) ) {
fs.unlinkSync( this.file.dest );
}
var crypto = require( "crypto" ),
dir = this.file.src + "/",
hashes = [];
grunt.file.expandFiles( dir + "**/*" ).forEach(function( fileName ) {
var hash = crypto.createHash( "md5" );
hash.update( grunt.file.read( fileName, "ascii" ) );
hashes.push( fileName.replace( dir, "" ) + " " + hash.digest( "hex" ) );
});
grunt.file.write( this.file.dest, hashes.join( "\n" ) + "\n" );
grunt.log.writeln( "Wrote " + this.file.dest + " with " + hashes.length + " hashes" );
});
// only needed for 1.8
grunt.registerTask( "download_docs", function() {
function capitalize(value) {
return value[0].toUpperCase() + value.slice(1);
}
// should be grunt.config("pkg.version")?
var version = "1.8",
docsDir = "dist/docs",
files = "draggable droppable resizable selectable sortable accordion autocomplete button datepicker dialog progressbar slider tabs position"
.split(" ").map(function(widget) {
return {
url: "http://docs.jquery.com/action/render/UI/API/" + version + "/" + capitalize(widget),
dest: docsDir + '/' + widget + '.html'
};
});
files = files.concat("animate addClass effect hide removeClass show switchClass toggle toggleClass".split(" ").map(function(widget) {
return {
url: "http://docs.jquery.com/action/render/UI/Effects/" + widget,
dest: docsDir + '/' + widget + '.html'
};
}));
files = files.concat("Blind Clip Drop Explode Fade Fold Puff Slide Scale Bounce Highlight Pulsate Shake Size Transfer".split(" ").map(function(widget) {
return {
url: "http://docs.jquery.com/action/render/UI/Effects/" + widget,
dest: docsDir + '/effect-' + widget.toLowerCase() + '.html'
};
}));
grunt.file.mkdir( "dist/docs" );
grunt.utils.async.forEach( files, function( file, done ) {
var out = fs.createWriteStream( file.dest );
out.on( "close", done );
request( file.url ).pipe( out );
}, this.async() );
});
grunt.registerTask( "download_themes", function() {
// var AdmZip = require('adm-zip');
var done = this.async(),
themes = grunt.file.read( "build/themes" ).split(","),
requests = 0;
grunt.file.mkdir( "dist/tmp" );
themes.forEach(function( theme, index ) {
requests += 1;
grunt.file.mkdir( "dist/tmp/" + index );
var zipFileName = "dist/tmp/" + index + ".zip",
out = fs.createWriteStream( zipFileName );
out.on( "close", function() {
grunt.log.writeln( "done downloading " + zipFileName );
// TODO AdmZip produces "crc32 checksum failed", need to figure out why
// var zip = new AdmZip(zipFileName);
// zip.extractAllTo('dist/tmp/' + index + '/');
// until then, using cli unzip...
grunt.utils.spawn({
cmd: "unzip",
args: [ "-d", "dist/tmp/" + index, zipFileName ]
}, function( err, result ) {
grunt.log.writeln( "Unzipped " + zipFileName + ", deleting it now" );
fs.unlinkSync( zipFileName );
requests -= 1;
if (requests === 0) {
done();
}
});
});
request( "http://ui-dev.jquery.com/download/?" + theme ).pipe( out );
});
});
grunt.registerTask( "copy_themes", function() {
// each package includes the base theme, ignore that
var filter = /themes\/base/,
files = grunt.file.expandFiles( "dist/tmp/*/development-bundle/themes/**/*" ).filter(function( file ) {
return !filter.test( file );
}),
// TODO the grunt.template.process call shouldn't be necessary
target = "dist/" + grunt.template.process( grunt.config( "files.themes" ), grunt.config() ) + "/",
distFolder = "dist/" + grunt.template.process( grunt.config( "files.dist" ), grunt.config() );
files.forEach(function( fileName ) {
var targetFile = fileName.replace( /dist\/tmp\/\d+\/development-bundle\//, "" ).replace( "jquery-ui-.custom", "jquery-ui" );
grunt.file.copy( fileName, target + targetFile );
});
// copy minified base theme from regular release
files = grunt.file.expandFiles( distFolder + "/themes/base/**/*" );
files.forEach(function( fileName ) {
grunt.file.copy( fileName, target + fileName.replace( distFolder, "" ) );
});
});
grunt.registerTask( "clean", function() {
require( "rimraf" ).sync( "dist" );
});
grunt.registerTask( "authors", function() {
var done = this.async();
grunt.utils.spawn({
cmd: "git",
args: [ "log", "--pretty=%an <%ae>" ]
}, function( err, result ) {
if ( err ) {
grunt.log.error( err );
return done( false );
}
var authors,
tracked = {};
authors = result.split( "\n" ).reverse().filter(function( author ) {
var first = !tracked[ author ];
tracked[ author ] = true;
return first;
}).join( "\n" );
grunt.log.writeln( authors );
done();
});
});
grunt.registerTask( "default", "lint csslint htmllint qunit" );
grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size:all" );
grunt.registerTask( "sizer_all", "concat:ui min compare_size" );

View File

@ -3,17 +3,43 @@
"title": "jQuery UI",
"description": "Abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.",
"version": "1.9.0pre",
"homepage": "https://github.com/jquery/jquery-ui",
"homepage": "http://jqueryui.com",
"author": {
"name": "AUTHORS.txt"
"name": "jQuery Foundation and other contributors",
"url": "http://jqueryui.com"
},
"maintainers": [
{
"name": "Scott González",
"email": "scott.gonzalez@gmail.com",
"url": "http://scottgonzalez.com"
},
{
"name": "Jörn Zaefferer",
"email": "joern.zaefferer@gmail.com",
"url": "http://bassistance.de"
},
{
"name": "Richard D. Worth",
"email": "rdworth@gmail.com",
"url": "http://rdworth.org"
},
{
"name": "Kris Borchers",
"email": "kris.borchers@gmail.com",
"url": "http://krisborchers.com"
},
{
"name": "Corey Frang",
"email": "gnarf37@gmail.com",
"url": "http://gnarf.net"
}
],
"repository": {
"type": "git",
"url": "git://github.com/jquery/jquery-ui.git"
},
"bugs": {
"url": "http://bugs.jqueryui.com/"
},
"bugs": "http://bugs.jqueryui.com/",
"licenses": [
{
"type": "MIT",
@ -26,13 +52,15 @@
],
"dependencies": {},
"devDependencies": {
"grunt": "0.3.9",
"grunt": "~0.3.9",
"grunt-css": "0.2.0",
"grunt-compare-size": "0.1.4",
"grunt-html": "0.1.1",
"grunt-junit": "0.1.4",
"grunt-git-authors": "1.0.0",
"request": "2.9.153",
"rimraf": "2.0.1",
"testswarm": "0.2.2"
"testswarm": "0.2.3"
},
"keywords": []
}

View File

@ -1,7 +1,8 @@
/*
* jquery.simulate - simulate browser mouse and keyboard events
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/

View File

@ -48,31 +48,31 @@ test( "accessibility", function () {
equal( headers.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" );
equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "true", "active tabpanel has aria-expanded=true" );
equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" );
equal( headers.eq( 0 ).attr( "tabindex" ), -1, "active header has tabindex=-1" );
equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" );
equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" );
equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" );
equal( headers.eq( 2 ).attr( "tabindex" ), -1, "active header has tabindex=-1" );
equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" );
equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" );
equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" );
equal( headers.eq( 0 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" );
equal( headers.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "false", "inactive tabpanel has aria-expanded=false" );
equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" );
equal( headers.eq( 2 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" );
equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "inactive tabpanel has aria-expanded=false" );
equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" );
element.accordion( "option", "active", 0 );
equal( headers.eq( 0 ).attr( "tabindex" ), 0, "active header has tabindex=0" );
equal( headers.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" );
equal( headers.eq( 0 ).next().attr( "aria-expanded" ), "true", "active tabpanel has aria-expanded=true" );
equal( headers.eq( 0 ).next().attr( "aria-hidden" ), "false", "active tabpanel has aria-hidden=false" );
equal( headers.eq( 1 ).attr( "tabindex" ), -1, "active header has tabindex=-1" );
equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" );
equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" );
equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" );
equal( headers.eq( 2 ).attr( "tabindex" ), -1, "active header has tabindex=-1" );
equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "active tab has aria-selected=false" );
equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "active tabpanel has aria-expanded=false" );
equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "active tabpanel has aria-hidden=true" );
equal( headers.eq( 1 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" );
equal( headers.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( headers.eq( 1 ).next().attr( "aria-expanded" ), "false", "inactive tabpanel has aria-expanded=false" );
equal( headers.eq( 1 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" );
equal( headers.eq( 2 ).attr( "tabindex" ), -1, "inactive header has tabindex=-1" );
equal( headers.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( headers.eq( 2 ).next().attr( "aria-expanded" ), "false", "inactive tabpanel has aria-expanded=false" );
equal( headers.eq( 2 ).next().attr( "aria-hidden" ), "true", "inactive tabpanel has aria-hidden=true" );
});
asyncTest( "keybaord support", function() {
asyncTest( "keyboard support", function() {
expect( 13 );
var element = $( "#list1" ).accordion(),
headers = element.find( ".ui-accordion-header" ),

View File

@ -8,6 +8,7 @@
module("button: core");
test("checkbox", function() {
expect( 4 );
var input = $("#check"),
label = $("label[for=check]");
ok( input.is(":visible") );
@ -18,6 +19,7 @@ test("checkbox", function() {
});
test("radios", function() {
expect( 4 );
var inputs = $("#radio0 input"),
labels = $("#radio0 label");
ok( inputs.is(":visible") );
@ -34,6 +36,7 @@ function assert(noForm, form1, form2) {
}
test("radio groups", function() {
expect( 12 );
$("input[type=radio]").button();
assert(":eq(0)", ":eq(1)", ":eq(2)");
@ -51,6 +54,7 @@ test("radio groups", function() {
});
test("input type submit, don't create child elements", function() {
expect( 2 );
var input = $("#submit");
deepEqual( input.children().length, 0 );
input.button();
@ -58,6 +62,7 @@ test("input type submit, don't create child elements", function() {
});
test("buttonset", function() {
expect( 6 );
var set = $("#radio1").buttonset();
ok( set.is(".ui-buttonset") );
deepEqual( set.children(".ui-button").length, 3 );
@ -68,6 +73,7 @@ test("buttonset", function() {
});
test("buttonset (rtl)", function() {
expect( 6 );
var set,
parent = $("#radio1").parent();
// Set to rtl

View File

@ -7,13 +7,10 @@
module("button: methods");
test("destroy", function() {
var beforeHtml = $("#button").parent().html(),
afterHtml = $("#button").button().button("destroy").parent().html();
// Opera 9 outputs role="" instead of removing the attribute like everyone else
if ($.browser.opera) {
afterHtml = afterHtml.replace(/ role=""/g, "");
}
equal( afterHtml, beforeHtml );
expect( 1 );
domEqual( "#button", function() {
$( "#button" ).button().button( "destroy" );
});
});
})(jQuery);

View File

@ -6,6 +6,7 @@
module("button: options");
test("disabled, explicit value", function() {
expect( 4 );
$("#radio01").button({ disabled: false });
deepEqual(false, $("#radio01").button("option", "disabled"),
"disabled option set to false");
@ -18,6 +19,7 @@ test("disabled, explicit value", function() {
});
test("disabled, null", function() {
expect( 4 );
$("#radio01").button({ disabled: null });
deepEqual(false, $("#radio01").button("option", "disabled"),
"disabled option set to false");
@ -30,6 +32,7 @@ test("disabled, null", function() {
});
test("text false without icon", function() {
expect( 1 );
$("#button").button({
text: false
});
@ -39,6 +42,7 @@ test("text false without icon", function() {
});
test("text false with icon", function() {
expect( 1 );
$("#button").button({
text: false,
icons: {
@ -51,6 +55,7 @@ test("text false with icon", function() {
});
test("label, default", function() {
expect( 2 );
$("#button").button();
deepEqual( $("#button").text(), "Label" );
deepEqual( $( "#button").button( "option", "label" ), "Label" );
@ -59,6 +64,7 @@ test("label, default", function() {
});
test("label", function() {
expect( 2 );
$("#button").button({
label: "xxx"
});
@ -69,11 +75,13 @@ test("label", function() {
});
test("label default with input type submit", function() {
expect( 2 );
deepEqual( $("#submit").button().val(), "Label" );
deepEqual( $("#submit").button( "option", "label" ), "Label" );
});
test("label with input type submit", function() {
expect( 2 );
var label = $("#submit").button({
label: "xxx"
}).val();
@ -82,6 +90,7 @@ test("label with input type submit", function() {
});
test("icons", function() {
expect( 1 );
$("#button").button({
text: false,
icons: {

View File

@ -6,6 +6,7 @@
module( "button: tickets" );
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
expect( 2 );
$( "#radio01" ).next().andSelf().hide();
var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
@ -13,6 +14,7 @@ test( "#5946 - buttonset should ignore buttons that are not :visible", function(
});
test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
expect( 3 );
$( "#radio0" ).hide();
var set = $( "#radio0" ).buttonset();
ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
@ -21,6 +23,7 @@ test( "#6262 - buttonset not applying ui-corner to invisible elements", function
});
test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
expect( 2 );
var check = $( "#check" ).button(),
label = $( "label[for='check']" );
ok( !label.is( ".ui-state-focus" ) );
@ -29,6 +32,7 @@ test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard
});
test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
expect( 5 );
var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
group.find( "input[type=checkbox]" ).button();
ok( group.find( "label" ).is( ".ui-button" ) );
@ -51,6 +55,7 @@ test( "#7092 - button creation that requires a matching label does not find labe
});
test( "#7534 - Button label selector works for ids with \":\"", function() {
expect( 1 );
var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" );
group.find( "input" ).button();
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );

View File

@ -2,7 +2,7 @@
module( "core - jQuery extensions" );
TestHelpers.testJshint( "ui.core" );
TestHelpers.testJshint( "core" );
test( "focus - original functionality", function() {
expect( 1 );
@ -28,6 +28,7 @@ asyncTest( "focus", function() {
});
test( "zIndex", function() {
expect( 7 );
var el = $( "#zIndexAutoWithParent" ),
parent = el.parent();
equal( el.zIndex(), 100, "zIndex traverses up to find value" );
@ -46,6 +47,7 @@ test( "zIndex", function() {
});
test( "innerWidth - getter", function() {
expect( 2 );
var el = $( "#dimensions" );
equal( el.innerWidth(), 122, "getter passthru" );
@ -54,6 +56,7 @@ test( "innerWidth - getter", function() {
});
test( "innerWidth - setter", function() {
expect( 2 );
var el = $( "#dimensions" );
el.innerWidth( 120 );
@ -64,6 +67,7 @@ test( "innerWidth - setter", function() {
});
test( "innerHeight - getter", function() {
expect( 2 );
var el = $( "#dimensions" );
equal( el.innerHeight(), 70, "getter passthru" );
@ -72,6 +76,7 @@ test( "innerHeight - getter", function() {
});
test( "innerHeight - setter", function() {
expect( 2 );
var el = $( "#dimensions" );
el.innerHeight( 60 );
@ -82,6 +87,7 @@ test( "innerHeight - setter", function() {
});
test( "outerWidth - getter", function() {
expect( 2 );
var el = $( "#dimensions" );
equal( el.outerWidth(), 140, "getter passthru" );
@ -90,6 +96,7 @@ test( "outerWidth - getter", function() {
});
test( "outerWidth - setter", function() {
expect( 2 );
var el = $( "#dimensions" );
el.outerWidth( 130 );
@ -100,6 +107,7 @@ test( "outerWidth - setter", function() {
});
test( "outerWidth(true) - getter", function() {
expect( 2 );
var el = $( "#dimensions" );
equal( el.outerWidth(true), 154, "getter passthru w/ margin" );
@ -108,6 +116,7 @@ test( "outerWidth(true) - getter", function() {
});
test( "outerWidth(true) - setter", function() {
expect( 2 );
var el = $( "#dimensions" );
el.outerWidth( 130, true );
@ -118,6 +127,7 @@ test( "outerWidth(true) - setter", function() {
});
test( "outerHeight - getter", function() {
expect( 2 );
var el = $( "#dimensions" );
equal( el.outerHeight(), 86, "getter passthru" );
@ -126,6 +136,7 @@ test( "outerHeight - getter", function() {
});
test( "outerHeight - setter", function() {
expect( 2 );
var el = $( "#dimensions" );
el.outerHeight( 80 );
@ -136,6 +147,7 @@ test( "outerHeight - setter", function() {
});
test( "outerHeight(true) - getter", function() {
expect( 2 );
var el = $( "#dimensions" );
equal( el.outerHeight(true), 98, "getter passthru w/ margin" );
@ -144,6 +156,7 @@ test( "outerHeight(true) - getter", function() {
});
test( "outerHeight(true) - setter", function() {
expect( 2 );
var el = $( "#dimensions" );
el.outerHeight( 90, true );
@ -154,13 +167,20 @@ test( "outerHeight(true) - setter", function() {
});
test( "uniqueId / removeUniqueId", function() {
expect( 3 );
var el = $( "img" ).eq( 0 );
equal( el.attr( "id" ), undefined, "element has no initial id" );
// support: jQuery <1.6.2
// support: IE <8
// We should use strictEqual( id, undefined ) when dropping jQuery 1.6.1 support (or IE6/7)
ok( !el.attr( "id" ), "element has no initial id" );
el.uniqueId();
ok( /ui-id-\d+$/.test( el.attr( "id" ) ), "element has generated id" );
el.removeUniqueId();
equal( el.attr( "id" ), undefined, "unique id has been removed from element" );
// support: jQuery <1.6.2
// support: IE <8
// see above
ok( !el.attr( "id" ), "unique id has been removed from element" );
});
})( jQuery );

View File

@ -150,6 +150,8 @@ test("focusable - not natively focusable with various tabindex", function() {
});
test("focusable - area elements", function() {
expect( 3 );
isFocusable('#areaCoordsHref', 'coords and href');
isFocusable('#areaNoCoordsHref', 'href but no coords');
isNotFocusable('#areaNoImg', 'not associated with an image');
@ -227,6 +229,8 @@ test("tabbable - not natively tabbable with various tabindex", function() {
});
test("tabbable - area elements", function() {
expect( 3 );
isTabbable('#areaCoordsHref', 'coords and href');
isTabbable('#areaNoCoordsHref', 'href but no coords');
isNotTabbable('#areaNoImg', 'not associated with an image');

View File

@ -43,16 +43,19 @@ var PROP_NAME = 'datepicker';
module("datepicker: core");
test( "widget method - empty collection", function() {
expect( 1 );
$( "#nonExist" ).datepicker(); // should create nothing
ok( !$( "#ui-datepicker-div" ).length, "Non init on empty collection" );
});
test("widget method", function() {
expect( 1 );
var actual = $("#inp").datepicker().datepicker("widget")[0];
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
});
test('baseStructure', function() {
expect( 59 );
var header, title, table, thead, week, panel, inl, child,
inp = init('#inp').focus(),
dp = $('#ui-datepicker-div'),
@ -176,6 +179,7 @@ test('baseStructure', function() {
});
test('customStructure', function() {
expect( 20 );
var iframe, header, panel, title, thead,
dp = $('#ui-datepicker-div'),
// Check right-to-left localisation
@ -233,6 +237,7 @@ test('customStructure', function() {
});
test('keystrokes', function() {
expect( 26 );
var inp = init('#inp'),
date = new Date();
inp.val('').datepicker('show').
@ -367,6 +372,7 @@ test('keystrokes', function() {
});
test('mouse', function() {
expect( 15 );
var inl,
inp = init('#inp'),
dp = $('#ui-datepicker-div'),

View File

@ -22,6 +22,7 @@ function callback2(year, month, inst) {
}
test('events', function() {
expect( 26 );
var dateStr, newMonthYear, inp2,
inp = init('#inp', {onSelect: callback}),
date = new Date();

View File

@ -6,6 +6,7 @@
module("datepicker: methods");
test('destroy', function() {
expect( 33 );
var inl,
inp = init('#inp');
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
@ -63,6 +64,7 @@ test('destroy', function() {
});
test('enableDisable', function() {
expect( 33 );
var inl, dp,
inp = init('#inp');
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');

View File

@ -7,6 +7,7 @@
module("datepicker: options");
test('setDefaults', function() {
expect( 3 );
var inp = init('#inp');
equal($.datepicker._defaults.showOn, 'focus', 'Initial showOn');
$.datepicker.setDefaults({showOn: 'button'});
@ -16,6 +17,7 @@ test('setDefaults', function() {
});
test('option', function() {
expect( 17 );
var inp = init('#inp'),
inst = $.data(inp[0], PROP_NAME);
// Set option
@ -47,6 +49,7 @@ test('option', function() {
});
test('change', function() {
expect( 12 );
var inp = init('#inp'),
inst = $.data(inp[0], PROP_NAME);
equal(inst.settings.showOn, null, 'Initial setting showOn');
@ -67,6 +70,7 @@ test('change', function() {
});
test('invocation', function() {
expect( 29 );
var button, image,
inp = init('#inp'),
dp = $('#ui-datepicker-div'),
@ -138,6 +142,7 @@ test('invocation', function() {
});
test('otherMonths', function() {
expect( 8 );
var inp = init('#inp'),
pop = $('#ui-datepicker-div');
inp.val('06/01/2009').datepicker('show');
@ -159,6 +164,7 @@ test('otherMonths', function() {
});
test('defaultDate', function() {
expect( 17 );
var inp = init('#inp'),
date = new Date();
inp.val('').datepicker('show').
@ -253,6 +259,7 @@ test('defaultDate', function() {
});
test('miscellaneous', function() {
expect( 19 );
var curYear, longNames, shortNames, date,
dp = $('#ui-datepicker-div'),
inp = init('#inp');
@ -314,6 +321,7 @@ test('miscellaneous', function() {
});
test('minMax', function() {
expect( 17 );
var date,
inp = init('#inp'),
lastYear = new Date(2007, 6 - 1, 4),
@ -398,6 +406,7 @@ test('minMax', function() {
});
test('setDate', function() {
expect( 24 );
var inl, alt, minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
inp = init('#inp'),
date1 = new Date(2008, 6 - 1, 4),
@ -477,6 +486,7 @@ test('setDate', function() {
});
test('altField', function() {
expect( 10 );
var inp = init('#inp'),
alt = $('#alt');
// No alternate field set
@ -515,6 +525,7 @@ test('altField', function() {
});
test('autoSize', function() {
expect( 15 );
var inp = init('#inp');
equal(inp.prop('size'), 20, 'Auto size - default');
inp.datepicker('option', 'autoSize', true);
@ -550,6 +561,7 @@ test('autoSize', function() {
});
test('daylightSaving', function() {
expect( 25 );
var inp = init('#inp'),
dp = $('#ui-datepicker-div');
ok(true, 'Daylight saving - ' + new Date());
@ -664,6 +676,7 @@ function calcWeek(date) {
}
test('callbacks', function() {
expect( 13 );
// Before show
var dp, day20, day21,
inp = init('#inp', {beforeShow: beforeAll}),
@ -693,6 +706,7 @@ test('callbacks', function() {
});
test('localisation', function() {
expect( 24 );
var dp, month, day, date,
inp = init('#inp', $.datepicker.regional.fr);
inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show');
@ -722,6 +736,7 @@ test('localisation', function() {
});
test('noWeekends', function() {
expect( 31 );
var i, date;
for (i = 1; i <= 31; i++) {
date = new Date(2001, 1 - 1, i);
@ -731,6 +746,7 @@ test('noWeekends', function() {
});
test('iso8601Week', function() {
expect( 12 );
var date = new Date(2000, 12 - 1, 31);
equal($.datepicker.iso8601Week(date), 52, 'ISO 8601 week ' + date);
date = new Date(2001, 1 - 1, 1);
@ -758,6 +774,7 @@ test('iso8601Week', function() {
});
test('parseDate', function() {
expect( 26 );
init('#inp');
var currentYear, gmtDate, fr, settings, zh;
ok($.datepicker.parseDate('d m y', '') == null, 'Parse date empty');
@ -822,6 +839,7 @@ test('parseDate', function() {
});
test('parseDateErrors', function() {
expect( 17 );
init('#inp');
var fr, settings;
function expectError(expr, value, error) {
@ -874,6 +892,7 @@ test('parseDateErrors', function() {
});
test('formatDate', function() {
expect( 16 );
init('#inp');
var gmtDate, fr, settings;
equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)),

View File

@ -7,6 +7,7 @@ module("datepicker: tickets");
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
test('beforeShowDay-getDate', function() {
expect( 3 );
var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show');
@ -25,6 +26,7 @@ test('beforeShowDay-getDate', function() {
});
test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler', function(){
expect( 3 );
var inp = init('#inp',{
beforeShow: function(){
return false;
@ -58,11 +60,13 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler'
});
test('Ticket 6827: formatDate day of year calculation is wrong during day lights savings time', function(){
expect( 1 );
var time = $.datepicker.formatDate("oo", new Date("2010/03/30 12:00:00 CDT"));
equal(time, "089");
});
test('Ticket #7244: date parser does not fail when too many numbers are passed into the date function', function() {
expect( 4 );
var date;
try{
date = $.datepicker.parseDate('dd/mm/yy', '18/04/19881');

View File

@ -116,6 +116,7 @@ test("ARIA", function() {
});
test("widget method", function() {
expect( 1 );
var dialog = $("<div>").appendTo("#main").dialog();
deepEqual(dialog.parent()[0], dialog.dialog("widget")[0]);
});

View File

@ -34,6 +34,8 @@ test("init", function() {
});
test("destroy", function() {
expect( 4 );
$("<div></div>").appendTo('body').dialog().dialog("destroy").remove();
ok(true, '.dialog("destroy") called on element');
@ -49,6 +51,8 @@ test("destroy", function() {
});
test("enable", function() {
expect( 3 );
var expected = $('<div></div>').dialog(),
actual = expected.dialog('enable');
equal(actual, expected, 'enable is chainable');
@ -60,6 +64,8 @@ test("enable", function() {
});
test("disable", function() {
expect( 3 );
var expected = $('<div></div>').dialog(),
actual = expected.dialog('disable');
equal(actual, expected, 'disable is chainable');
@ -71,6 +77,8 @@ test("disable", function() {
});
test("close", function() {
expect( 3 );
var expected = $('<div></div>').dialog(),
actual = expected.dialog('close');
equal(actual, expected, 'close is chainable');
@ -98,6 +106,8 @@ test("isOpen", function() {
});
test("moveToTop", function() {
expect( 3 );
var d1, d2, dlg1, dlg2,
expected = $('<div></div>').dialog(),
actual = expected.dialog('moveToTop');
@ -117,6 +127,7 @@ test("moveToTop", function() {
});
test("open", function() {
expect( 3 );
var expected = $('<div></div>').dialog(),
actual = expected.dialog('open');
equal(actual, expected, 'open is chainable');

View File

@ -106,6 +106,7 @@ test("buttons - advanced", function() {
});
test("closeOnEscape", function() {
expect( 6 );
el = $('<div></div>').dialog({ closeOnEscape: false });
ok(true, 'closeOnEscape: false');
ok(dlg().is(':visible') && !dlg().is(':hidden'), 'dialog is open before ESC');
@ -276,6 +277,7 @@ test("minWidth", function() {
});
test("position, default center on window", function() {
expect( 2 );
var el = $('<div></div>').dialog(),
dialog = el.dialog('widget'),
offset = dialog.offset();
@ -285,6 +287,7 @@ test("position, default center on window", function() {
});
test("position, top on window", function() {
expect( 2 );
var el = $('<div></div>').dialog({ position: "top" }),
dialog = el.dialog('widget'),
offset = dialog.offset();
@ -294,6 +297,7 @@ test("position, top on window", function() {
});
test("position, left on window", function() {
expect( 2 );
var el = $('<div></div>').dialog({ position: "left" }),
dialog = el.dialog('widget'),
offset = dialog.offset();
@ -303,6 +307,7 @@ test("position, left on window", function() {
});
test("position, right bottom on window", function() {
expect( 2 );
var el = $('<div></div>').dialog({ position: "right bottom" }),
dialog = el.dialog('widget'),
offset = dialog.offset();
@ -312,6 +317,7 @@ test("position, right bottom on window", function() {
});
test("position, right bottom on window w/array", function() {
expect( 2 );
var el = $('<div></div>').dialog({ position: ["right", "bottom"] }),
dialog = el.dialog('widget'),
offset = dialog.offset();
@ -321,6 +327,7 @@ test("position, right bottom on window w/array", function() {
});
test("position, offset from top left w/array", function() {
expect( 2 );
var el = $('<div></div>').dialog({ position: [10, 10] }),
dialog = el.dialog('widget'),
offset = dialog.offset();
@ -330,6 +337,7 @@ test("position, offset from top left w/array", function() {
});
test("position, right bottom at right bottom via ui.position args", function() {
expect( 2 );
var el = $('<div></div>').dialog({
position: {
my: "right bottom",
@ -345,6 +353,7 @@ test("position, right bottom at right bottom via ui.position args", function() {
});
test("position, at another element", function() {
expect( 4 );
var parent = $('<div></div>').css({
position: 'absolute',
top: 400,

View File

@ -71,6 +71,7 @@ test("#5184: isOpen in dialogclose event is true", function() {
});
test("#5531: dialog width should be at least minWidth on creation", function () {
expect( 4 );
el = $('<div></div>').dialog({
width: 200,
minWidth: 300
@ -192,6 +193,7 @@ test("#6966: Escape key closes all dialogs, not the top one", function(){
});
test("#4980: Destroy should place element back in original DOM position", function(){
expect( 2 );
container = $('<div id="container"><div id="modal">Content</div></div>');
modal = container.find('#modal');
modal.dialog();

View File

@ -15,20 +15,20 @@
<script>
TestHelpers.loadResources({
js: [
"ui/jquery.effects.core.js",
"ui/jquery.effects.blind.js",
"ui/jquery.effects.bounce.js",
"ui/jquery.effects.clip.js",
"ui/jquery.effects.drop.js",
"ui/jquery.effects.explode.js",
"ui/jquery.effects.fade.js",
"ui/jquery.effects.fold.js",
"ui/jquery.effects.highlight.js",
"ui/jquery.effects.pulsate.js",
"ui/jquery.effects.scale.js",
"ui/jquery.effects.shake.js",
"ui/jquery.effects.slide.js",
"ui/jquery.effects.transfer.js"
"ui/jquery.ui.effect.js",
"ui/jquery.ui.effect-blind.js",
"ui/jquery.ui.effect-bounce.js",
"ui/jquery.ui.effect-clip.js",
"ui/jquery.ui.effect-drop.js",
"ui/jquery.ui.effect-explode.js",
"ui/jquery.ui.effect-fade.js",
"ui/jquery.ui.effect-fold.js",
"ui/jquery.ui.effect-highlight.js",
"ui/jquery.ui.effect-pulsate.js",
"ui/jquery.ui.effect-scale.js",
"ui/jquery.ui.effect-shake.js",
"ui/jquery.ui.effect-slide.js",
"ui/jquery.ui.effect-transfer.js"
]
});
</script>

View File

@ -90,16 +90,16 @@ asyncTest( "animateClass works with colors", function() {
});
asyncTest( "animateClass calls step option", 1, function() {
var test = jQuery("div.animateClass"),
done = function() {
done = jQuery.noop;
var test = jQuery( "div.animateClass" ),
step = function( fx ) {
ok( true, "Step Function Called" );
test.stop();
start();
step = $.noop;
};
test.toggleClass( "testChangeBackground", {
step: function( fx ) {
ok( true, "Step Function Called" );
setTimeout( done, 0 );
step: function() {
step();
}
});
});
@ -153,6 +153,7 @@ asyncTest( "animateClass clears style properties when stopped", function() {
});
asyncTest( "animateClass: css and class changes during animation are not lost (#7106)", function() {
expect( 2 );
var test = $( "div.ticket7106" );
// ensure the class stays and that the css property stays
@ -174,7 +175,7 @@ $.each( $.effects.effect, function( effect ) {
// puff and size are defined inside scale
if ( effect !== "puff" && effect !== "size" ) {
TestHelpers.testJshint( "effects." + effect );
TestHelpers.testJshint( "effect-" + effect );
}
if ( effect === "transfer" ) {

View File

@ -4,6 +4,7 @@ module( "effect.scale: Scale" );
function run( position, v, h, vo, ho ) {
var desc = "End Position Correct: " + position + " (" + v + "," + h + ") - origin: (" + vo + "," + ho + ")";
asyncTest( desc, function() {
expect( 2 );
function complete() {
equal( parseInt( test.css( h ), 10 ), target[ h ], "Horizontal Position Correct " + desc );
equal( parseInt( test.css( v ), 10 ), target[ v ], "Vertical Position Correct " + desc );
@ -53,13 +54,13 @@ function suite( position ) {
$(function() {
suite( "absolute" );
suite( "relative" );
var fixed = $.support.fixedPosition;
// jQuery < 1.7 uses $.offset.supportsFixedPosition
if ( fixed === undefined ) {
$.offset.initialize();
fixed = $.offset.supportsFixedPosition;
}
if ( fixed ) {
var fixedElem = $( "<div>" )
.css({
position: "fixed",
top: 10
})
.appendTo( "body" );
if ( fixedElem.offset().top === 10 ) {
suite( "fixed" );
}
});

View File

@ -44,11 +44,7 @@
</head>
<body>
<h1 id="qunit-header">jQuery UI Menu Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit">jQuery UI Menu Test Suite</div>
<div id="qunit-fixture">
<ul class="foo" id="menu1">
@ -268,8 +264,6 @@
<li class="foo"><a class="foo" href="#">Saarland</a></li>
</ul>
<div id="log"></div>
</div>
</body>
</html>

View File

@ -1,6 +1,9 @@
TestHelpers.commonWidgetTests( "menu", {
defaults: {
disabled: false,
icons: {
submenu: "ui-icon-carat-1-e"
},
menus: "ul",
position: {
my: "left top",

View File

@ -1,29 +1,30 @@
/*
* menu_core.js
*/
(function( $ ) {
module( "menu: core" );
(function($) {
module("menu: core");
test("accessibility", function () {
expect(5);
var item,
menu = $('#menu1').menu(),
item0 = $("li:eq(0) a");
ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
equal( menu.attr("role"), "menu", "main role");
ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active");
item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
menu.menu( "focus", $.Event(), item );
equal( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom");
item = menu.find( "li:last" );
menu.menu( "focus", $.Event(), item );
ok( /^ui-id-\d+$/.test( menu.attr( "aria-activedescendant" ) ), "aria attribute, generated id");
test( "markup structure", function() {
expect( 6 );
var element = $( "#menu1" ).menu();
ok( element.hasClass( "ui-menu" ), "main element is .ui-menu" );
element.children().each(function( index ) {
ok( $( this ).hasClass( "ui-menu-item" ), "child " + index + " is .ui-menu-item" );
});
});
})(jQuery);
test( "accessibility", function () {
expect( 4 );
var element = $( "#menu1" ).menu();
equal( element.attr( "role" ), "menu", "main role" );
ok( !element.attr( "aria-activedescendant" ), "aria-activedescendant not set" );
element.menu( "focus", $.Event(), element.children().eq( -2 ) );
equal( element.attr( "aria-activedescendant" ), "testID1", "aria-activedescendant from existing id" );
element.menu( "focus", $.Event(), element.children().eq( 0 ) );
ok( /^ui-id-\d+$/.test( element.attr( "aria-activedescendant" ) ), "aria-activedescendant from generated id" );
// Item roles are tested in the role option tests
});
})( jQuery );

View File

@ -1,50 +1,52 @@
/*
* menu_events.js
*/
(function($) {
(function( $ ) {
var log = TestHelpers.menu.log,
logOutput = TestHelpers.menu.logOutput,
click = TestHelpers.menu.click;
module("menu: events");
module( "menu: events", {
setup: function() {
TestHelpers.menu.clearLog();
}
});
test("handle click on menu", function() {
expect(1);
var menu = $('#menu1').menu({
select: function(event, ui) {
test( "handle click on menu", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
select: function( event, ui ) {
log();
}
});
log("click",true);
click($('#menu1'),"1");
log("afterclick");
click( menu,"2");
click($('#menu1'),"3");
click( menu,"1");
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
log( "click", true );
click( $( "#menu1" ), "1" );
log( "afterclick" );
click( element, "2" );
click( $( "#menu1" ), "3" );
click( element, "1" );
equal( logOutput(), "click,1,afterclick,2,3,1", "Click order not valid." );
});
test("handle click on custom item menu", function() {
expect(1);
var menu = $('#menu5').menu({
select: function(event, ui) {
test( "handle click on custom item menu", function() {
expect( 1 );
var element = $( "#menu5" ).menu({
select: function( event, ui ) {
log();
},
menus: "div"
});
log("click",true);
click($('#menu5'),"1");
log("afterclick");
click( menu,"2");
click($('#menu5'),"3");
click( menu,"1");
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
log( "click", true );
click( $( "#menu5" ), "1" );
log( "afterclick" );
click( element, "2" );
click( $( "#menu5" ), "3" );
click( element, "1" );
equal( logOutput(), "click,1,afterclick,2,3,1", "Click order not valid." );
});
asyncTest( "handle blur", function() {
expect( 1 );
var blurHandled = false,
$menu = $( "#menu1" ).menu({
element = $( "#menu1" ).menu({
blur: function( event, ui ) {
// Ignore duplicate blur event fired by IE
if ( !blurHandled ) {
@ -54,17 +56,17 @@ asyncTest( "handle blur", function() {
}
});
click( $menu, "1" );
click( element, "1" );
setTimeout( function() {
$menu.blur();
element.blur();
start();
}, 350);
}, 350 );
});
asyncTest( "handle blur on click", function() {
expect( 1 );
var blurHandled = false,
$menu = $( "#menu1" ).menu({
element = $( "#menu1" ).menu({
blur: function( event, ui ) {
// Ignore duplicate blur event fired by IE
if ( !blurHandled ) {
@ -74,12 +76,11 @@ asyncTest( "handle blur on click", function() {
}
});
click( $menu, "1" );
click( element, "1" );
setTimeout( function() {
$( "<a>", { id: "remove"} ).appendTo("body").trigger( "click" );
$("#remove").remove();
$( "<a>", { id: "remove"} ).appendTo( "body" ).trigger( "click" );
start();
}, 350);
}, 350 );
});
test( "handle focus of menu with active item", function() {
@ -95,226 +96,225 @@ test( "handle focus of menu with active item", function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.focus();
equal( $("#log").html(), "2,2,1,0,focus,", "current active item remains active");
equal( logOutput(), "focus,0,1,2,2", "current active item remains active" );
});
asyncTest( "handle submenu auto collapse: mouseleave", function() {
expect( 4 );
var $menu = $( "#menu2" ).menu(),
var element = $( "#menu2" ).menu(),
event = $.Event( "mouseenter" );
function menumouseleave1() {
equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
$menu.menu( "focus", event, $menu.find( "li:nth-child(7) li:first" ) );
equal( element.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
element.menu( "focus", event, element.find( "li:nth-child(7) li:first" ) );
setTimeout( menumouseleave2, 350 );
}
function menumouseleave2() {
equal( $menu.find( "ul[aria-expanded='true']" ).length, 2, "second submenu expanded" );
$menu.find( "ul[aria-expanded='true']:first" ).trigger( "mouseleave" );
equal( element.find( "ul[aria-expanded='true']" ).length, 2, "second submenu expanded" );
element.find( "ul[aria-expanded='true']:first" ).trigger( "mouseleave" );
setTimeout( menumouseleave3, 350 );
}
function menumouseleave3() {
equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
$menu.trigger( "mouseleave" );
equal( element.find( "ul[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
element.trigger( "mouseleave" );
setTimeout( menumouseleave4, 350 );
}
function menumouseleave4() {
equal( $menu.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
equal( element.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
start();
}
$menu.find( "li:nth-child(7)" ).trigger( "mouseenter" );
element.find( "li:nth-child(7)" ).trigger( "mouseenter" );
setTimeout( menumouseleave1, 350 );
});
asyncTest( "handle submenu auto collapse: mouseleave", function() {
expect( 4 );
var $menu = $( "#menu5" ).menu( { menus: "div" } ),
var element = $( "#menu5" ).menu({ menus: "div" }),
event = $.Event( "mouseenter" );
function menumouseleave1() {
equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
$menu.menu( "focus", event, $menu.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ) );
equal( element.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
element.menu( "focus", event, element.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ) );
setTimeout( menumouseleave2, 350 );
}
function menumouseleave2() {
equal( $menu.find( "div[aria-expanded='true']" ).length, 2, "second submenu expanded" );
$menu.find( "div[aria-expanded='true']:first" ).trigger( "mouseleave" );
equal( element.find( "div[aria-expanded='true']" ).length, 2, "second submenu expanded" );
element.find( "div[aria-expanded='true']:first" ).trigger( "mouseleave" );
setTimeout( menumouseleave3, 350 );
}
function menumouseleave3() {
equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
$menu.trigger( "mouseleave" );
equal( element.find( "div[aria-expanded='true']" ).length, 1, "second submenu collapsed" );
element.trigger( "mouseleave" );
setTimeout( menumouseleave4, 350 );
}
function menumouseleave4() {
equal( $menu.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
equal( element.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
start();
}
$menu.find( ":nth-child(7)" ).trigger( "mouseenter" );
element.find( ":nth-child(7)" ).trigger( "mouseenter" );
setTimeout( menumouseleave1, 350 );
});
test("handle keyboard navigation on menu without scroll and without submenus", function() {
expect(12);
var element = $('#menu1').menu({
select: function(event, ui) {
log($(ui.item[0]).text());
test( "handle keyboard navigation on menu without scroll and without submenus", function() {
expect( 12 );
var element = $( "#menu1" ).menu({
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
focus: function( event, ui ) {
log($(event.target).find(".ui-state-focus").parent().index());
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
log("keydown",true);
log( "keydown", true );
element.focus();
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
equal( logOutput(), "keydown,0,1,2", "Keydown DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "1,keydown,", "Keydown UP");
equal( logOutput(), "keydown,1", "Keydown UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
equal( logOutput(), "keydown", "Keydown RIGHT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN");
equal( logOutput(), "keydown,4", "Keydown PAGE_DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
equal( logOutput(), "keydown", "Keydown PAGE_DOWN (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
equal( logOutput(), "keydown", "Keydown PAGE_UP (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "4,keydown,", "Keydown END");
equal( logOutput(), "keydown,4", "Keydown END" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
equal( logOutput(), "keydown,0", "Keydown HOME" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
equal( logOutput(), "keydown", "Keydown ESCAPE (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
equal( logOutput(), "keydown,Aberdeen", "Keydown ENTER" );
});
asyncTest("handle keyboard navigation on menu without scroll and with submenus", function() {
expect(16);
var element = $('#menu2').menu({
select: function(event, ui) {
log($(ui.item[0]).text());
asyncTest( "handle keyboard navigation on menu without scroll and with submenus", function() {
expect( 16 );
var element = $( "#menu2" ).menu({
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
focus: function( event, ui ) {
log($(event.target).find(".ui-state-focus").parent().index());
log( $( event.target ).find( ".ui-state-focus" ).parent().index() );
}
});
log("keydown",true);
log( "keydown", true );
element.one( "menufocus", function( event, ui ) {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "2,1,keydown,", "Keydown DOWN");
equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
setTimeout( menukeyboard1, 50 );
});
element.focus();
function menukeyboard1() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
equal( logOutput(), "keydown,1,0", "Keydown UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
setTimeout( function() {
equal( $("#log").html(), "0,4,3,2,1,keydown,", "Keydown RIGHT (open submenu)");
}, 50);
setTimeout( menukeyboard2, 50 );
setTimeout(function() {
equal( logOutput(), "keydown,1,2,3,4,0", "Keydown RIGHT (open submenu)" );
setTimeout( menukeyboard2, 50 );
}, 50 );
}
function menukeyboard2() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)");
equal( logOutput(), "keydown,4", "Keydown LEFT (close submenu)" );
//re-open submenu
// re-open submenu
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
setTimeout( menukeyboard3, 50 );
}
function menukeyboard3() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN");
equal( logOutput(), "keydown,2", "Keydown PAGE_DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
equal( logOutput(), "keydown", "Keydown PAGE_DOWN (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
equal( logOutput(), "keydown", "Keydown PAGE_UP (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "2,keydown,", "Keydown END");
equal( logOutput(), "keydown,2", "Keydown END" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
equal( logOutput(), "keydown,0", "Keydown HOME" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)");
equal( logOutput(), "keydown,4", "Keydown ESCAPE (close submenu)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.SPACE } );
setTimeout( menukeyboard4, 50 );
}
function menukeyboard4() {
equal( $("#log").html(), "0,keydown,", "Keydown SPACE (open submenu)");
equal( logOutput(), "keydown,0", "Keydown SPACE (open submenu)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)");
equal( logOutput(), "keydown,4", "Keydown ESCAPE (close submenu)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
@ -325,9 +325,9 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "0,4,2,0,1,0,6,5,keydown,", "Keydown skip dividers and items without anchors");
equal( logOutput(), "keydown,5,6,0,1,0,2,4,0", "Keydown skip dividers and items without anchors" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
setTimeout( menukeyboard6, 50 );
}, 50 );
@ -335,232 +335,229 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
}
function menukeyboard6() {
equal( $("#log").html(), "Ada,keydown,", "Keydown ENTER (open submenu)");
equal( logOutput(), "keydown,Ada", "Keydown ENTER (open submenu)" );
start();
}
});
test("handle keyboard navigation on menu with scroll and without submenus", function() {
expect(14);
var element = $('#menu3').menu({
select: function(event, ui) {
log($(ui.item[0]).text());
test( "handle keyboard navigation on menu with scroll and without submenus", function() {
expect( 14 );
var element = $( "#menu3" ).menu({
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
focus: function( event, ui ) {
log($(event.target).find(".ui-state-focus").parent().index());
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log("keydown",true);
log( "keydown", true );
element.focus();
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
equal( logOutput(), "keydown,0,1,2", "Keydown DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
equal( logOutput(), "keydown,1,0", "Keydown UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
equal( logOutput(), "keydown", "Keydown RIGHT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
equal( logOutput(), "keydown,10", "Keydown PAGE_DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
equal( logOutput(), "keydown,20", "Keydown PAGE_DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
equal( logOutput(), "keydown,10", "Keydown PAGE_UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
equal( logOutput(), "keydown", "Keydown PAGE_UP (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "37,keydown,", "Keydown END");
equal( logOutput(), "keydown,37", "Keydown END" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
equal( logOutput(), "keydown", "Keydown PAGE_DOWN (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
equal( logOutput(), "keydown,0", "Keydown HOME" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
equal( logOutput(), "keydown", "Keydown ESCAPE (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
equal( logOutput(), "keydown,Aberdeen", "Keydown ENTER" );
});
asyncTest("handle keyboard navigation on menu with scroll and with submenus", function() {
expect(14);
var element = $('#menu4').menu({
select: function(event, ui) {
log($(ui.item[0]).text());
asyncTest( "handle keyboard navigation on menu with scroll and with submenus", function() {
expect( 14 );
var element = $( "#menu4" ).menu({
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
focus: function( event, ui ) {
log($(event.target).find(".ui-state-focus").parent().index());
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log("keydown",true);
log( "keydown", true );
element.one( "menufocus", function( event, ui ) {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "2,1,keydown,", "Keydown DOWN");
equal( logOutput(), "keydown,1,2", "Keydown DOWN" );
setTimeout( menukeyboard1, 50 );
});
element.focus();
function menukeyboard1() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
equal( logOutput(), "keydown,1,0", "Keydown UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
setTimeout( function() {
equal( $("#log").html(), "0,1,keydown,", "Keydown RIGHT (open submenu)");
}, 50);
equal( logOutput(), "keydown,1,0", "Keydown RIGHT (open submenu)" );
}, 50 );
setTimeout( menukeyboard2, 50 );
}
function menukeyboard2() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)");
equal( logOutput(), "keydown,1", "Keydown LEFT (close submenu)" );
//re-open submenu
// re-open submenu
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
setTimeout( menukeyboard3, 50 );
}
function menukeyboard3() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
equal( logOutput(), "keydown,10", "Keydown PAGE_DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
equal( logOutput(), "keydown,20", "Keydown PAGE_DOWN" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
equal( logOutput(), "keydown,10", "Keydown PAGE_UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
equal( logOutput(), "keydown,0", "Keydown PAGE_UP" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
equal( $("#log").html(), "27,keydown,", "Keydown END");
equal( logOutput(), "keydown,27", "Keydown END" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
equal( logOutput(), "keydown,0", "Keydown HOME" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
equal( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)");
equal( logOutput(), "keydown,1", "Keydown ESCAPE (close submenu)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
setTimeout( menukeyboard4, 50 );
}
function menukeyboard4() {
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
equal( logOutput(), "keydown,0", "Keydown ENTER (open submenu)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)");
equal( logOutput(), "keydown,Aberdeen", "Keydown ENTER (select item)" );
start();
}
});
asyncTest("handle keyboard navigation and mouse click on menu with disabled items", function() {
expect(6);
var element = $('#menu6').menu({
select: function(event, ui) {
log($(ui.item[0]).text());
asyncTest( "handle keyboard navigation and mouse click on menu with disabled items", function() {
expect( 6 );
var element = $( "#menu6" ).menu({
select: function( event, ui ) {
log( $( ui.item[0] ).text() );
},
focus: function( event, ui ) {
log($(event.target).find(".ui-state-focus").parent().index());
log( $( event.target ).find( ".ui-state-focus" ).parent().index());
}
});
log("keydown",true);
log( "keydown", true );
element.one( "menufocus", function( event, ui ) {
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
equal( $("#log").html(), "1,keydown,", "Keydown focus but not select disabled item");
equal( logOutput(), "keydown,1", "Keydown focus but not select disabled item" );
setTimeout( menukeyboard1, 50 );
});
element.focus();
function menukeyboard1() {
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
equal( $("#log").html(), "4,3,2,keydown,", "Keydown focus disabled item with submenu");
equal( logOutput(), "keydown,2,3,4", "Keydown focus disabled item with submenu" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
equal( logOutput(), "keydown", "Keydown LEFT (no effect)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
setTimeout( function() {
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect on disabled sub-menu)");
equal( logOutput(), "keydown", "Keydown RIGHT (no effect on disabled sub-menu)" );
log("keydown",true);
log( "keydown", true );
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
setTimeout( function() {
equal( $("#log").html(), "keydown,", "Keydown ENTER (no effect on disabled sub-menu)");
log("click",true);
equal( logOutput(), "keydown", "Keydown ENTER (no effect on disabled sub-menu)" );
log( "click", true );
click( element, "1" );
equal( $("#log").html(), "click,", "Click disabled item (no effect)");
equal( logOutput(), "click", "Click disabled item (no effect)" );
start();
}, 50);
}, 50);
}, 50 );
}, 50 );
}
});
test("handle keyboard navigation with spelling of menu items", function() {
test( "handle keyboard navigation with spelling of menu items", function() {
expect( 2 );
var element = $( "#menu2" ).menu({
focus: function( event, ui ) {
@ -573,14 +570,14 @@ test("handle keyboard navigation with spelling of menu items", function() {
element.simulate( "keydown", { keyCode: 65 } );
element.simulate( "keydown", { keyCode: 68 } );
element.simulate( "keydown", { keyCode: 68 } );
equal( $("#log").html(), "3,1,0,keydown,", "Keydown focus Addyston by spelling the first 3 letters");
equal( logOutput(), "keydown,0,1,3", "Keydown focus Addyston by spelling the first 3 letters" );
element.simulate( "keydown", { keyCode: 68 } );
equal( $("#log").html(), "4,3,1,0,keydown,", "Keydown focus Delphi by repeating the 'd' again");
equal( logOutput(), "keydown,0,1,3,4", "Keydown focus Delphi by repeating the 'd' again" );
});
element.focus();
});
asyncTest("handle page up and page down before the menu has focus", function() {
asyncTest( "handle page up and page down before the menu has focus", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
focus: function( event, ui ) {
@ -593,9 +590,9 @@ asyncTest("handle page up and page down before the menu has focus", function() {
element.blur();
setTimeout( function() {
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
equal( $("#log").html(), "0,0,keydown,", "Page Up and Page Down bring initial focus to first item");
equal( logOutput(), "keydown,0,0", "Page Up and Page Down bring initial focus to first item" );
start();
}, 500);
}, 500 );
});
})(jQuery);
})( jQuery );

View File

@ -1,58 +1,87 @@
/*
* menu_methods.js
*/
(function($) {
(function( $ ) {
var log = TestHelpers.menu.log,
logOutput = TestHelpers.menu.logOutput,
click = TestHelpers.menu.click;
module("menu: methods");
module( "menu: methods", {
setup: function() {
TestHelpers.menu.clearLog();
}
});
test( "enable/disable", function() {
expect( 3 );
var menu = $( "#menu1" ).menu({
select: function(event, ui) {
var element = $( "#menu1" ).menu({
select: function( event, ui ) {
log();
}
});
menu.menu("disable");
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
log("click",true);
click(menu,"1");
log("afterclick");
menu.menu("enable");
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
log("click");
click(menu,"1");
log("afterclick");
equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid.");
element.menu( "disable" );
ok( element.is( ".ui-state-disabled" ), "Missing ui-state-disabled class" );
log( "click", true );
click( element, "1" );
log( "afterclick" );
element.menu( "enable" );
ok( element.not( ".ui-state-disabled" ), "Has ui-state-disabled class" );
log( "click" );
click( element, "1" );
log( "afterclick" );
equal( logOutput(), "click,afterclick,click,1,afterclick", "Click order not valid." );
});
test( "refresh", function() {
expect( 5 );
var menu = $( "#menu1" ).menu();
equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
menu.append("<li><a href='#'>test item</a></li>").menu("refresh");
equal(menu.find(".ui-menu-item").length,6,"Incorrect number of menu items");
menu.find(".ui-menu-item:last").remove().end().menu("refresh");
equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
menu.append("<li>---</li>").menu("refresh");
equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
menu.children(":last").remove().end().menu("refresh");
equal(menu.find(".ui-menu-item").length,5,"Incorrect number of menu items");
var element = $( "#menu1" ).menu();
equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
element.append( "<li><a href='#'>test item</a></li>" ).menu( "refresh" );
equal( element.find( ".ui-menu-item" ).length, 6, "Incorrect number of menu items" );
element.find( ".ui-menu-item:last" ).remove().end().menu( "refresh" );
equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
element.append( "<li>---</li>" ).menu( "refresh" );
equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
element.children( ":last" ).remove().end().menu( "refresh" );
equal( element.find( ".ui-menu-item" ).length, 5, "Incorrect number of menu items" );
});
test("destroy", function() {
domEqual("#menu1", function() {
$("#menu1").menu().menu("destroy");
// TODO: test focus method
// TODO: test blur method
// TODO: test collapseAll method
// TODO: test collapse method
// TODO: test expand method
// TODO: test next method
// TODO: test prev method
// TODO: test isFirstItem method
// TODO: test isLastItem method
// TODO: test nextPage method
// TODO: test prevPage method
// TODO: test select method
test( "destroy", function() {
expect( 4 );
domEqual( "#menu1", function() {
$( "#menu1" ).menu().menu( "destroy" );
});
domEqual("#menu5", function() {
$("#menu5").menu().menu("destroy");
domEqual( "#menu2", function() {
$( "#menu2" ).menu().menu( "destroy" );
});
domEqual("#menu6", function() {
$("#menu6").menu().menu("destroy");
domEqual( "#menu5", function() {
$( "#menu5").menu().menu( "destroy" );
});
domEqual( "#menu6", function() {
$( "#menu6" ).menu().menu( "destroy" );
});
});
})(jQuery);
})( jQuery );

View File

@ -1,67 +1,112 @@
/*
* menu_options.js
*/
(function($) {
(function( $ ) {
var log = TestHelpers.menu.log,
logOutput = TestHelpers.menu.logOutput,
click = TestHelpers.menu.click;
module("menu: options");
module( "menu: options", {
setup: function() {
TestHelpers.menu.clearLog();
}
});
test( "{ disabled: true }", function() {
expect( 2 );
var menu = $( "#menu1" ).menu({
var element = $( "#menu1" ).menu({
disabled: true,
select: function(event, ui) {
log();
}
});
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
log("click",true);
click(menu,"1");
log("afterclick");
equal( $("#log").html(), "afterclick,click,", "Click order not valid.");
ok( element.hasClass( "ui-state-disabled" ), "Missing ui-state-disabled class" );
log( "click", true );
click( element, "1" );
log( "afterclick" );
equal( logOutput(), "click,afterclick", "Click order not valid." );
});
test( "{ disabled: false }", function() {
expect( 2 );
var menu = $( "#menu1" ).menu({
var element = $( "#menu1" ).menu({
disabled: false,
select: function(event, ui) {
select: function( event, ui ) {
log();
}
});
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
log("click",true);
click(menu,"1");
log("afterclick");
equal( $("#log").html(), "afterclick,1,click,", "Click order not valid.");
ok( !element.hasClass( "ui-state-disabled" ), "Has ui-state-disabled class" );
log( "click", true );
click( element, "1" );
log( "afterclick" );
equal( logOutput(), "click,1,afterclick", "Click order not valid." );
});
test("{ role: 'menu' } ", function () {
var menu = $('#menu1').menu();
expect(2 + 5 * $("li", menu).length);
equal( menu.attr( "role" ), "menu" );
ok( $("li", menu).length > 0, "number of menu items");
$("li", menu).each(function(item) {
ok( $(this).hasClass("ui-menu-item"), "menu item ("+ item + ") class for item");
equal( $(this).attr("role"), "presentation", "menu item ("+ item + ") role");
equal( $("a", this).attr("role"), "menuitem", "menu item ("+ item + ") role");
ok( $("a",this).hasClass("ui-corner-all"), "a element class for menu item ("+ item + ") ");
equal( $("a",this).attr("tabindex"), "-1", "a element tabindex for menu item ("+ item + ") ");
test( "{ icons: default }", function() {
expect( 1 );
var element = $( "#menu2" ).menu();
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon ui-icon-carat-1-e" );
});
test( "{ icons: { submenu: 'custom' } }", function() {
expect( 1 );
var element = $( "#menu2" ).menu({
icons: {
submenu: "custom-class"
}
});
equal( element.find( ".ui-menu-icon" ).attr( "class" ), "ui-menu-icon ui-icon custom-class" );
});
// TODO: test menus option
// TODO: test position option
test( "{ role: 'menu' } ", function() {
var element = $( "#menu1" ).menu(),
items = element.find( "li" );
expect( 2 + 5 * items.length );
equal( element.attr( "role" ), "menu" );
ok( items.length > 0, "number of menu items" );
items.each(function( item ) {
ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" );
equal( $( "a", this ).attr( "role" ), "menuitem", "menu item ("+ item + ") role" );
ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" );
equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" );
});
});
test("{ role: 'listbox' } ", function () {
var menu = $('#menu1').menu({
role: "listbox"
});
expect(2 + $("li", menu).length);
equal( menu.attr( "role" ), "listbox" );
ok( ($("li", menu).length > 0 ), "number of menu items");
$("li", menu).each(function(item) {
equal( $("a", this).attr("role"), "option", "menu item ("+ item + ") role");
test( "{ role: 'listbox' } ", function() {
var element = $( "#menu1" ).menu({
role: "listbox"
}),
items = element.find( "li" );
expect( 2 + 5 * items.length );
equal( element.attr( "role" ), "listbox" );
ok( items.length > 0, "number of menu items" );
items.each(function( item ) {
ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" );
equal( $( "a", this ).attr( "role" ), "option", "menu item ("+ item + ") role" );
ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" );
equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" );
});
});
})(jQuery);
test( "{ role: null }", function() {
var element = $( "#menu1" ).menu({
role: null
}),
items = element.find( "li" );
expect( 2 + 5 * items.length );
strictEqual( element.attr( "role" ), undefined );
ok( items.length > 0, "number of menu items" );
items.each(function( item ) {
ok( $( this ).hasClass( "ui-menu-item" ), "menu item ("+ item + ") class for item" );
equal( $( this ).attr( "role" ), "presentation", "menu item ("+ item + ") role" );
equal( $( "a", this ).attr( "role" ), undefined, "menu item ("+ item + ") role" );
ok( $( "a", this ).hasClass( "ui-corner-all" ), "a element class for menu item ("+ item + ")" );
equal( $( "a", this ).attr( "tabindex" ), "-1", "a element tabindex for menu item ("+ item + ")" );
});
});
})( jQuery );

View File

@ -1,16 +1,31 @@
(function() {
var lastItem,
log = [];
TestHelpers.menu = {
log: function( message, clear ) {
if ( clear ) {
$( "#log" ).empty();
log.length = 0;
}
if ( message === undefined ) {
message = $( "#log" ).data( "lastItem" );
message = lastItem;
}
$( "#log" ).prepend( $.trim( message ) + "," );
log.push( $.trim( message ) );
},
logOutput: function() {
return log.join( "," );
},
clearLog: function() {
log.length = 0;
},
click: function( menu, item ) {
$( "#log" ).data( "lastItem", item );
lastItem = item;
menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
}
};
};
})();

View File

@ -16,7 +16,7 @@ module( "position", {
}
});
TestHelpers.testJshint( "ui.position" );
TestHelpers.testJshint( "position" );
test( "my, at, of", function() {
expect( 4 );

View File

@ -1,6 +1,7 @@
(function( $ ) {
test( "offset", function() {
expect( 3 );
$( "#elx" ).position({
my: "left top",
at: "left bottom",

View File

@ -1,6 +1,7 @@
module( "progressbar: options" );
test( "{ value : 0 }, default", function() {
expect( 1 );
$( "#progressbar" ).progressbar();
equal( 0, $( "#progressbar" ).progressbar( "value" ) );
});
@ -28,6 +29,7 @@ test( "value: visibility of valueDiv", function() {
});
test( "{ value : 5 }", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: 5
});
@ -35,6 +37,7 @@ test( "{ value : 5 }", function() {
});
test( "{ value : -5 }", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: -5
});
@ -42,6 +45,7 @@ test( "{ value : -5 }", function() {
});
test( "{ value : 105 }", function() {
expect( 1 );
$( "#progressbar" ).progressbar({
value: 105
});
@ -49,6 +53,7 @@ test( "{ value : 105 }", function() {
});
test( "{ max : 5, value : 10 }", function() {
expect( 1 );
$("#progressbar").progressbar({
max: 5,
value: 10

View File

@ -5,7 +5,7 @@
<title>jQuery UI Spinner Test Suite</title>
<script src="../../jquery.js"></script>
<script src="../../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../../external/jquery.mousewheel.js"></script>
<script src="../../../external/globalize.js"></script>
<script src="../../../external/globalize.culture.ja-JP.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css">

View File

@ -2,6 +2,10 @@ TestHelpers.commonWidgetTests( "spinner", {
defaults: {
culture: null,
disabled: false,
icons: {
down: "ui-icon-triangle-1-s",
up: "ui-icon-triangle-1-n"
},
incremental: true,
max: null,
min: null,

View File

@ -220,6 +220,7 @@ asyncTest( "change", function() {
shouldChange( false, "min, value not changed" );
element.spinner( "option", "min", 200 );
shouldChange( true, "cleanup" );
start();
});
});

View File

@ -6,6 +6,25 @@ module( "spinner: options" );
// culture is tested after numberFormat, since it depends on numberFormat
test( "icons: default ", function() {
expect( 2 );
var element = $( "#spin" ).val( 0 ).spinner().spinner( "widget" );
equal( element.find( ".ui-icon:first" ).attr( "class" ), "ui-icon ui-icon-triangle-1-n" );
equal( element.find( ".ui-icon:last" ).attr( "class" ), "ui-icon ui-icon-triangle-1-s" );
});
test( "icons: custom ", function() {
expect( 2 );
var element = $( "#spin" ).val( 0 ).spinner({
icons: {
down: "custom-down",
up: "custom-up"
}
}).spinner( "widget" );
equal( element.find( ".ui-icon:first" ).attr( "class" ), "ui-icon custom-up" );
equal( element.find( ".ui-icon:last" ).attr( "class" ), "ui-icon custom-down" );
});
test( "incremental, false", function() {
expect( 100 );

View File

@ -63,8 +63,529 @@ test( "aria-controls", function() {
});
test( "accessibility", function() {
// TODO: add tests
expect( 0 );
expect( 49 );
var element = $( "#tabs1" ).tabs({
active: 1,
disabled: [ 2 ]
}),
tabs = element.find( ".ui-tabs-nav li" ),
anchors = tabs.find( ".ui-tabs-anchor" ),
panels = element.find( ".ui-tabs-panel" );
equal( element.find( ".ui-tabs-nav" ).attr( "role" ), "tablist", "tablist role" );
tabs.each(function( index ) {
var tab = tabs.eq( index ),
anchor = anchors.eq( index ),
anchorId = anchor.attr( "id" ),
panel = panels.eq( index );
equal( tab.attr( "role" ), "tab", "tab " + index + " role" );
equal( tab.attr( "aria-labelledby" ), anchorId, "tab " + index + " aria-labelledby" );
equal( anchor.attr( "role" ), "presentation", "anchor " + index + " role" );
equal( anchor.attr( "tabindex" ), -1, "anchor " + index + " tabindex" );
equal( panel.attr( "role" ), "tabpanel", "panel " + index + " role" );
equal( panel.attr( "aria-labelledby" ), anchorId, "panel " + index + " aria-labelledby" );
});
equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" );
equal( tabs.eq( 1 ).attr( "tabindex" ), 0, "active tab has tabindex=0" );
equal( tabs.eq( 1 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "true", "active panel has aria-expanded=true" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "false", "active panel has aria-hidden=false" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( tabs.eq( 0 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );
equal( tabs.eq( 0 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( tabs.eq( 2 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );
equal( tabs.eq( 2 ).attr( "aria-disabled" ), "true", "disabled tab has aria-disabled=true" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );
element.tabs( "option", "active", 0 );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "active tab has aria-selected=true" );
equal( tabs.eq( 0 ).attr( "tabindex" ), 0, "active tab has tabindex=0" );
equal( tabs.eq( 0 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "active panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "active panel has aria-hidden=false" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( tabs.eq( 1 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );
equal( tabs.eq( 1 ).attr( "aria-disabled" ), null, "enabled tab does not have aria-disabled" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "inactive tab has aria-selected=false" );
equal( tabs.eq( 2 ).attr( "tabindex" ), -1, "inactive tab has tabindex=-1" );
equal( tabs.eq( 2 ).attr( "aria-disabled" ), "true", "disabled tab has aria-disabled=true" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "inactive panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "inactive panel has aria-hidden=true" );
});
asyncTest( "accessibility - ajax", function() {
expect( 4 );
var element = $( "#tabs2" ).tabs(),
tab = element.find( ".ui-tabs-nav li" ).eq( 3 ),
panel = $( "#custom-id" );
equal( panel.attr( "aria-live" ), "polite", "remote panel has aria-live" );
equal( panel.attr( "aria-busy" ), null, "does not have aria-busy on init" );
element.tabs( "option", "active", 3 );
equal( panel.attr( "aria-busy" ), "true", "panel has aria-busy during load" );
element.one( "tabsload", function() {
setTimeout(function() {
equal( panel.attr( "aria-busy" ), null, "panel does not have aria-busy after load" );
start();
}, 1 );
});
});
asyncTest( "keyboard support - LEFT, RIGHT, UP, DOWN, HOME, END, SPACE, ENTER", function() {
expect( 92 );
var element = $( "#tabs1" ).tabs({
collapsible: true
}),
tabs = element.find( ".ui-tabs-nav li" ),
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;
element.data( "tabs" ).delay = 50;
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
tabs.eq( 0 ).simulate( "focus" );
// down, right, down (wrap), up (wrap)
function step1() {
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab has focus" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN } );
ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next tab" );
ok( !tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab is no longer focused" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT } );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN } );
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first tab" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP } );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step2, 100 );
}
// left, home, space
function step2() {
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT } );
ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous tab" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is still visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME } );
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first tab" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel is still hidden" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is still visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
// SPACE activates, cancels delay
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.SPACE } );
setTimeout( step3, 1 );
}
// end, enter
function step3() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END } );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
// ENTER activates, cancels delay
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.ENTER } );
setTimeout( step4, 1 );
}
// enter (collapse)
function step4() {
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
// ENTER collapses if active
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.ENTER } );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
// support: Firefox 12
// Firefox <13 passes arguments so we can't use setTimeout( start, 1 )
setTimeout(function() {
start();
}, 1 );
}
setTimeout( step1, 1 );
});
asyncTest( "keyboard support - CTRL navigation", function() {
expect( 115 );
var element = $( "#tabs1" ).tabs(),
tabs = element.find( ".ui-tabs-nav li" ),
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;
element.data( "tabs" ).delay = 50;
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
tabs.eq( 0 ).simulate( "focus" );
// down
function step1() {
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab has focus" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.DOWN, ctrlKey: true } );
ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "DOWN moves focus to next tab" );
ok( !tabs.eq( 0 ).is( ".ui-state-focus" ), "first tab is no longer focused" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step2, 100 );
}
// right
function step2() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.RIGHT, ctrlKey: true } );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "RIGHT moves focus to next tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step3, 100 );
}
// down (wrap)
function step3() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.DOWN, ctrlKey: true } );
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "DOWN wraps focus to first tab" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step4, 100 );
}
// up (wrap)
function step4() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "UP wraps focus to last tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step5, 100 );
}
// left
function step5() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.LEFT, ctrlKey: true } );
ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "LEFT moves focus to previous tab" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step6, 100 );
}
// home
function step6() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.HOME, ctrlKey: true } );
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "HOME moves focus to first tab" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "false", "second tab has aria-selected=false" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is still hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step7, 100 );
}
// end
function step7() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
tabs.eq( 0 ).simulate( "keydown", { keyCode: keyCode.END, ctrlKey: true } );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "END moves focus to last tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "false", "third tab has aria-selected=false" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is still hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is still visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
setTimeout( step8, 100 );
}
// space
function step8() {
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.SPACE } );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "false", "first tab has aria-selected=false" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
// support: Firefox 12
// Firefox <13 passes arguments so we can't use setTimeout( start, 1 )
setTimeout(function() {
start();
}, 1 );
}
setTimeout( step1, 1 );
});
asyncTest( "keyboard support - CTRL+UP, ALT+PAGE_DOWN, ALT+PAGE_UP", function() {
expect( 50 );
var element = $( "#tabs1" ).tabs(),
tabs = element.find( ".ui-tabs-nav li" ),
panels = element.find( ".ui-tabs-panel" ),
keyCode = $.ui.keyCode;
equal( tabs.filter( ".ui-state-focus" ).length, 0, "no tabs focused on init" );
panels.attr( "tabindex", -1 );
panels.eq( 0 ).simulate( "focus" );
function step1() {
strictEqual( document.activeElement, panels[ 0 ], "first panel is activeElement" );
panels.eq( 0 ).simulate( "keydown", { keyCode: keyCode.PAGE_DOWN, altKey: true } );
strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );
ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "ALT+PAGE_DOWN moves focus to next tab" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );
ok( panels.eq( 1 ).is( ":visible" ), "second panel is visible" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "true", "second panel has aria-expanded=true" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "false", "second panel has aria-hidden=false" );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
tabs.eq( 1 ).simulate( "keydown", { keyCode: keyCode.PAGE_DOWN, altKey: true } );
strictEqual( document.activeElement, tabs[ 2 ], "third tab is activeElement" );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "ALT+PAGE_DOWN moves focus to next tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
ok( panels.eq( 1 ).is( ":hidden" ), "second panel is hidden" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "false", "second panel has aria-expanded=false" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "true", "second panel has aria-hidden=true" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.PAGE_DOWN, altKey: true } );
strictEqual( document.activeElement, tabs[ 0 ], "first tab is activeElement" );
ok( tabs.eq( 0 ).is( ".ui-state-focus" ), "ALT+PAGE_DOWN wraps focus to first tab" );
equal( tabs.eq( 0 ).attr( "aria-selected" ), "true", "first tab has aria-selected=true" );
ok( panels.eq( 0 ).is( ":visible" ), "first panel is visible" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "true", "first panel has aria-expanded=true" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "false", "first panel has aria-hidden=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
panels.eq( 0 ).simulate( "focus" );
setTimeout( step2, 1 );
}
function step2() {
strictEqual( document.activeElement, panels[ 0 ], "first panel is activeElement" );
panels.eq( 0 ).simulate( "keydown", { keyCode: keyCode.PAGE_UP, altKey: true } );
strictEqual( document.activeElement, tabs[ 2 ], "third tab is activeElement" );
ok( tabs.eq( 2 ).is( ".ui-state-focus" ), "ALT+PAGE_UP wraps focus to last tab" );
equal( tabs.eq( 2 ).attr( "aria-selected" ), "true", "third tab has aria-selected=true" );
ok( panels.eq( 2 ).is( ":visible" ), "third panel is visible" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "true", "third panel has aria-expanded=true" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "false", "third panel has aria-hidden=false" );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel is hidden" );
equal( panels.eq( 0 ).attr( "aria-expanded" ), "false", "first panel has aria-expanded=false" );
equal( panels.eq( 0 ).attr( "aria-hidden" ), "true", "first panel has aria-hidden=true" );
tabs.eq( 2 ).simulate( "keydown", { keyCode: keyCode.PAGE_UP, altKey: true } );
strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );
ok( tabs.eq( 1 ).is( ".ui-state-focus" ), "ALT+PAGE_UP moves focus to previous tab" );
equal( tabs.eq( 1 ).attr( "aria-selected" ), "true", "second tab has aria-selected=true" );
ok( panels.eq( 1 ).is( ":visible" ), "second panel is visible" );
equal( panels.eq( 1 ).attr( "aria-expanded" ), "true", "second panel has aria-expanded=true" );
equal( panels.eq( 1 ).attr( "aria-hidden" ), "false", "second panel has aria-hidden=false" );
ok( panels.eq( 2 ).is( ":hidden" ), "third panel is hidden" );
equal( panels.eq( 2 ).attr( "aria-expanded" ), "false", "third panel has aria-expanded=false" );
equal( panels.eq( 2 ).attr( "aria-hidden" ), "true", "third panel has aria-hidden=true" );
panels.eq( 1 ).simulate( "focus" );
setTimeout( step3, 1 );
}
function step3() {
strictEqual( document.activeElement, panels[ 1 ], "second panel is activeElement" );
panels.eq( 1 ).simulate( "keydown", { keyCode: keyCode.UP, ctrlKey: true } );
strictEqual( document.activeElement, tabs[ 1 ], "second tab is activeElement" );
// support: Firefox 12
// Firefox <13 passes arguments so we can't use setTimeout( start, 1 )
setTimeout(function() {
start();
}, 1 );
}
setTimeout( step1, 1 );
});
test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {

View File

@ -6,6 +6,7 @@ var disabled = TestHelpers.tabs.disabled,
module( "tabs: methods" );
test( "destroy", function() {
expect( 1 );
domEqual( "#tabs1", function() {
$( "#tabs1" ).tabs().tabs( "destroy" );
});
@ -148,6 +149,26 @@ test( "refresh", function() {
disabled( element, false );
});
test( "refresh - looping", function() {
expect( 6 );
var element = $( "#tabs1" ).tabs({
disabled: [ 0 ],
active: 1
});
state( element, 0, 1, 0 );
disabled( element, [ 0 ] );
// remove active, jump to previous
// previous is disabled, just back one more
// reached first tab, move to end
// activate last tab
element.find( ".ui-tabs-nav li" ).eq( 2 ).remove();
element.tabs( "refresh" );
state( element, 0, 1 );
disabled( element, [ 0 ] );
});
asyncTest( "load", function() {
expect( 30 );

View File

@ -69,6 +69,8 @@ test( "{ active: Number }", function() {
if ( $.uiBackCompat === false ) {
test( "{ active: -Number }", function() {
expect( 8 );
var element = $( "#tabs1" ).tabs({
active: -1
});
@ -278,6 +280,54 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() {
equalHeight( element, 335 );
});
// TODO: add animation tests
test( "hide and show: false", function() {
expect( 3 );
var element = $( "#tabs1" ).tabs({
show: false,
hide: false
}),
widget = element.data( "tabs" ),
panels = element.find( ".ui-tabs-panel" );
widget._show = function() {
ok( false, "_show() called" );
};
widget._hide = function() {
ok( false, "_hide() called" );
};
ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" );
element.tabs( "option", "active", 1 );
ok( panels.eq( 0 ).is( ":hidden" ), "first panel hidden" );
ok( panels.eq( 1 ).is( ":visible" ), "second panel visible" );
});
asyncTest( "hide and show - animation", function() {
expect( 5 );
var element = $( "#tabs1" ).tabs({
show: "drop",
hide: 2000
}),
widget = element.data( "tabs" ),
panels = element.find( ".ui-tabs-panel" );
widget._show = function( element, options, callback ) {
strictEqual( element[ 0 ], panels[ 1 ], "correct element in _show()" );
equal( options, "drop", "correct options in _show()" );
setTimeout(function() {
callback();
}, 1 );
};
widget._hide = function( element, options, callback ) {
strictEqual( element[ 0 ], panels[ 0 ], "correct element in _hide()" );
equal( options, 2000, "correct options in _hide()" );
setTimeout(function() {
callback();
start();
}, 1 );
};
ok( panels.eq( 0 ).is( ":visible" ), "first panel visible" );
element.tabs( "option", "active", 1 );
});
}( jQuery ) );

View File

@ -10,7 +10,14 @@ function includeScript( url ) {
document.write( "<script src='../../../" + url + "'></script>" );
}
QUnit.config.urlConfig.push( "min" );
QUnit.config.requireExpects = true;
QUnit.config.urlConfig.push({
id: "min",
label: "Minified source",
tooltip: "Load minified source files instead of the regular unminified ones."
});
TestHelpers.loadResources = QUnit.urlParams.min ?
function() {
// TODO: proper include with theme images
@ -26,7 +33,12 @@ TestHelpers.loadResources = QUnit.urlParams.min ?
});
};
QUnit.config.urlConfig.push( "nojshint" );
QUnit.config.urlConfig.push({
id: "nojshint",
label: "Skip JSHint",
tooltip: "Skip running JSHint, e.g. within TestSwarm, where Jenkins runs it already"
});
var jshintLoaded = false;
TestHelpers.testJshint = function( module ) {
if ( QUnit.urlParams.nojshint ) {
@ -47,7 +59,7 @@ TestHelpers.testJshint = function( module ) {
dataType: "json"
}),
$.ajax({
url: "../../../ui/jquery." + module + ".js",
url: "../../../ui/jquery.ui." + module + ".js",
dataType: "text"
})
).done(function( hintArgs, srcArgs ) {
@ -76,7 +88,9 @@ function testWidgetDefaults( widget, defaults ) {
// ensure that all defaults have the correct value
test( "defined defaults", function() {
var count = 0;
$.each( defaults, function( key, val ) {
expect( ++count );
if ( $.isFunction( val ) ) {
ok( $.isFunction( pluginDefaults[ key ] ), key );
return;
@ -87,7 +101,9 @@ function testWidgetDefaults( widget, defaults ) {
// ensure that all defaults were tested
test( "tested defaults", function() {
var count = 0;
$.each( pluginDefaults, function( key, val ) {
expect( ++count );
ok( key in defaults, key );
});
});
@ -96,6 +112,7 @@ function testWidgetDefaults( widget, defaults ) {
function testWidgetOverrides( widget ) {
if ( $.uiBackCompat === false ) {
test( "$.widget overrides", function() {
expect( 4 );
$.each([
"_createWidget",
"destroy",
@ -111,6 +128,8 @@ function testWidgetOverrides( widget ) {
function testBasicUsage( widget ) {
test( "basic usage", function() {
expect( 3 );
var defaultElement = $.ui[ widget ].prototype.defaultElement;
$( defaultElement ).appendTo( "body" )[ widget ]().remove();
ok( true, "initialized on element" );
@ -126,11 +145,12 @@ function testBasicUsage( widget ) {
TestHelpers.commonWidgetTests = function( widget, settings ) {
module( widget + ": common widget" );
TestHelpers.testJshint( "ui." + widget );
TestHelpers.testJshint( widget );
testWidgetDefaults( widget, settings.defaults );
testWidgetOverrides( widget );
testBasicUsage( widget );
test( "version", function() {
expect( 1 );
ok( "version" in $.ui[ widget ].prototype, "version property exists" );
});
};
@ -188,6 +208,9 @@ window.domEqual = function( selector, modifier, message ) {
var value = elem.attr( attr );
result[ attr ] = value !== undefined ? value : "";
});
result.events = $._data( elem[ 0 ], "events" );
result.data = $.extend( {}, elem.data() );
delete result.data[ $.expando ];
children = elem.children();
if ( children.length ) {
result.children = elem.children().map(function( ind ) {

View File

@ -11,6 +11,7 @@ TestHelpers.commonWidgetTests( "tooltip", {
},
show: true,
tooltipClass: null,
track: false,
// callbacks
close: null,

View File

@ -34,7 +34,10 @@ test( "accessibility", function() {
equal( element.attr( "aria-describedby" ), "fixture-span " + tooltipId,
"multiple describedby when open" );
// strictEqual to distinguish between .removeAttr( "title" ) and .attr( "title", "" )
strictEqual( element.attr( "title" ), undefined, "no title when open" );
// support: jQuery <1.6.2
// support: IE <8
// We should use strictEqual( ..., undefined ) when dropping jQuery 1.6.1 support (or IE6/7)
ok( !element.attr( "title" ), "no title when open" );
element.tooltip( "close" );
equal( element.attr( "aria-describedby" ), "fixture-span",
"correct describedby when closed" );

View File

@ -42,7 +42,10 @@ test( "enable/disable", function() {
element.tooltip( "disable" );
equal( $( ".ui-tooltip" ).length, 0, "no tooltip when disabled" );
equal( tooltip.attr( "title" ), undefined, "title removed on disable" );
// support: jQuery <1.6.2
// support: IE <8
// We should use strictEqual( ..., undefined ) when dropping jQuery 1.6.1 support (or IE6/7)
ok( !tooltip.attr( "title" ), "title removed on disable" );
element.tooltip( "open" );
equal( $( ".ui-tooltip" ).length, 0, "open does nothing when disabled" );

View File

@ -3,11 +3,13 @@
module( "tooltip: options" );
test( "content: default", function() {
expect( 1 );
var element = $( "#tooltipped1" ).tooltip().tooltip( "open" );
deepEqual( $( "#" + element.data( "ui-tooltip-id" ) ).text(), "anchortitle" );
});
test( "content: return string", function() {
expect( 1 );
var element = $( "#tooltipped1" ).tooltip({
content: function() {
return "customstring";
@ -17,6 +19,7 @@ test( "content: return string", function() {
});
test( "content: return jQuery", function() {
expect( 1 );
var element = $( "#tooltipped1" ).tooltip({
content: function() {
return $( "<div>" ).html( "cu<b>s</b>tomstring" );

View File

@ -8,9 +8,10 @@ module( "widget factory", {
}
});
TestHelpers.testJshint( "ui.widget" );
TestHelpers.testJshint( "widget" );
test( "widget creation", function() {
expect( 5 );
var myPrototype = {
_create: function() {},
creationTest: function() {}
@ -78,10 +79,11 @@ test( "element normalization", function() {
});
test( "custom selector expression", function() {
expect( 1 );
var elem = $( "<div>" ).appendTo( "#qunit-fixture" );
$.widget( "ui.testWidget", {} );
elem.testWidget();
deepEqual( $( ":ui-testWidget" )[0], elem[0] );
deepEqual( $( ":ui-testwidget" )[0], elem[0] );
elem.testWidget( "destroy" );
});
@ -300,6 +302,7 @@ test( "._getCreateEventData()", function() {
});
test( "re-init", function() {
expect( 3 );
var div = $( "<div>" ),
actions = [];
@ -329,6 +332,7 @@ test( "re-init", function() {
});
test( "inheritance - options", function() {
expect( 4 );
// #5830 - Widget: Using inheritance overwrites the base classes options
$.widget( "ui.testWidgetBase", {
options: {
@ -441,6 +445,7 @@ test( "._superApply()", function() {
});
test( ".option() - getter", function() {
expect( 6 );
$.widget( "ui.testWidget", {
_create: function() {}
});
@ -472,6 +477,7 @@ test( ".option() - getter", function() {
});
test( ".option() - deep option getter", function() {
expect( 5 );
$.widget( "ui.testWidget", {} );
var div = $( "<div>" ).testWidget({
foo: {
@ -490,6 +496,7 @@ test( ".option() - deep option getter", function() {
});
test( ".option() - delegate to ._setOptions()", function() {
expect( 2 );
var div,
calls = [];
$.widget( "ui.testWidget", {
@ -514,6 +521,7 @@ test( ".option() - delegate to ._setOptions()", function() {
});
test( ".option() - delegate to ._setOption()", function() {
expect( 2 );
var div,
calls = [];
$.widget( "ui.testWidget", {
@ -544,6 +552,7 @@ test( ".option() - delegate to ._setOption()", function() {
});
test( ".option() - deep option setter", function() {
expect( 6 );
$.widget( "ui.testWidget", {} );
var div = $( "<div>" ).testWidget();
function deepOption( from, to, msg ) {
@ -592,6 +601,7 @@ test( ".disable()", function() {
});
test( ".widget() - base", function() {
expect( 1 );
$.widget( "ui.testWidget", {
_create: function() {}
});
@ -600,6 +610,7 @@ test( ".widget() - base", function() {
});
test( ".widget() - overriden", function() {
expect( 1 );
var wrapper = $( "<div>" );
$.widget( "ui.testWidget", {
_create: function() {},
@ -610,13 +621,13 @@ test( ".widget() - overriden", function() {
deepEqual( wrapper[0], $( "<div>" ).testWidget().testWidget( "widget" )[0] );
});
test( "._bind() to element (default)", function() {
test( "._on() to element (default)", function() {
expect( 12 );
var that, widget;
$.widget( "ui.testWidget", {
_create: function() {
that = this;
this._bind({
this._on({
keyup: this.keyup,
keydown: "keydown"
});
@ -650,13 +661,13 @@ test( "._bind() to element (default)", function() {
.trigger( "keydown" );
});
test( "._bind() to descendent", function() {
test( "._on() to descendent", function() {
expect( 12 );
var that, widget, descendant;
$.widget( "ui.testWidget", {
_create: function() {
that = this;
this._bind( this.element.find( "strong" ), {
this._on( this.element.find( "strong" ), {
keyup: this.keyup,
keydown: "keydown"
});
@ -707,13 +718,14 @@ test( "._bind() to descendent", function() {
.trigger( "keydown" );
});
test( "_bind() with delegate", function() {
test( "_on() with delegate", function() {
expect( 8 );
$.widget( "ui.testWidget", {
_create: function() {
var uuid = this.uuid;
this.element = {
bind: function( event, handler ) {
equal( event, "click.testWidget" );
equal( event, "click.testWidget" + uuid );
ok( $.isFunction(handler) );
},
trigger: $.noop
@ -722,12 +734,12 @@ test( "_bind() with delegate", function() {
return {
delegate: function( selector, event, handler ) {
equal( selector, "a" );
equal( event, "click.testWidget" );
equal( event, "click.testWidget" + uuid );
ok( $.isFunction(handler) );
}
};
};
this._bind({
this._on({
"click": "handler",
"click a": "handler"
});
@ -735,12 +747,12 @@ test( "_bind() with delegate", function() {
return {
delegate: function( selector, event, handler ) {
equal( selector, "form fieldset > input" );
equal( event, "change.testWidget" );
equal( event, "change.testWidget" + uuid );
ok( $.isFunction(handler) );
}
};
};
this._bind({
this._on({
"change form fieldset > input": "handler"
});
}
@ -748,7 +760,103 @@ test( "_bind() with delegate", function() {
$.ui.testWidget();
});
test( "_on() to common element", function() {
expect( 1 );
$.widget( "ui.testWidget", {
_create: function() {
this._on( this.document, {
"customevent": "_handler"
});
},
_handler: function() {
ok( true, "handler triggered" );
}
});
var widget = $( "#widget" ).testWidget().data( "testWidget" );
$( "#widget-wrapper" ).testWidget();
widget.destroy();
$( document ).trigger( "customevent" );
});
test( "_off() - single event", function() {
expect( 3 );
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget._on( element, { foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
}});
element.bind( "foo", function() {
ok( shouldTriggerOther, "foo called from bind" );
});
shouldTriggerWidget = true;
shouldTriggerOther = true;
element.trigger( "foo" );
shouldTriggerWidget = false;
widget._off( element, "foo" );
element.trigger( "foo" );
});
test( "_off() - multiple events", function() {
expect( 6 );
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget._on( element, {
foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
},
bar: function() {
ok( shouldTriggerWidget, "bar called from _on" );
}
});
element.bind( "foo bar", function( event ) {
ok( shouldTriggerOther, event.type + " called from bind" );
});
shouldTriggerWidget = true;
shouldTriggerOther = true;
element.trigger( "foo" );
element.trigger( "bar" );
shouldTriggerWidget = false;
widget._off( element, "foo bar" );
element.trigger( "foo" );
element.trigger( "bar" );
});
test( "_off() - all events", function() {
expect( 6 );
$.widget( "ui.testWidget", {} );
var shouldTriggerWidget, shouldTriggerOther,
element = $( "#widget" ),
widget = element.testWidget().data( "testWidget" );
widget._on( element, {
foo: function() {
ok( shouldTriggerWidget, "foo called from _on" );
},
bar: function() {
ok( shouldTriggerWidget, "bar called from _on" );
}
});
element.bind( "foo bar", function( event ) {
ok( shouldTriggerOther, event.type + " called from bind" );
});
shouldTriggerWidget = true;
shouldTriggerOther = true;
element.trigger( "foo" );
element.trigger( "bar" );
shouldTriggerWidget = false;
widget._off( element );
element.trigger( "foo" );
element.trigger( "bar" );
});
test( "._hoverable()", function() {
expect( 10 );
$.widget( "ui.testWidget", {
_create: function() {
this._hoverable( this.element.children() );
@ -780,10 +888,11 @@ test( "._hoverable()", function() {
});
test( "._focusable()", function() {
expect( 10 );
$.widget( "ui.testWidget", {
_create: function() {
this._focusable( this.element.children() );
}
this._focusable( this.element.children() );
}
});
var div = $( "#widget" ).testWidget().children();
@ -863,6 +972,7 @@ test( "._trigger() - cancelled event", function() {
});
test( "._trigger() - cancelled callback", function() {
expect( 1 );
$.widget( "ui.testWidget", {
_create: function() {}
});

View File

@ -5,7 +5,7 @@
<title>addClass Visual Test : Queue</title>
<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css">
<script src="../../../jquery-1.7.2.js"></script>
<script src="../../../ui/jquery.effects.core.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<style>
.box {
width: 100px;

View File

@ -5,20 +5,20 @@
<title>jQuery UI Effects Test Suite</title>
<link rel="stylesheet" href="effects.css">
<script src="../../../jquery-1.7.2.js"></script>
<script src="../../../ui/jquery.effects.core.js"></script>
<script src="../../../ui/jquery.effects.blind.js"></script>
<script src="../../../ui/jquery.effects.bounce.js"></script>
<script src="../../../ui/jquery.effects.clip.js"></script>
<script src="../../../ui/jquery.effects.drop.js"></script>
<script src="../../../ui/jquery.effects.explode.js"></script>
<script src="../../../ui/jquery.effects.fade.js"></script>
<script src="../../../ui/jquery.effects.fold.js"></script>
<script src="../../../ui/jquery.effects.highlight.js"></script>
<script src="../../../ui/jquery.effects.pulsate.js"></script>
<script src="../../../ui/jquery.effects.scale.js"></script>
<script src="../../../ui/jquery.effects.shake.js"></script>
<script src="../../../ui/jquery.effects.slide.js"></script>
<script src="../../../ui/jquery.effects.transfer.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<script src="../../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../../ui/jquery.ui.effect-clip.js"></script>
<script src="../../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../../ui/jquery.ui.effect-explode.js"></script>
<script src="../../../ui/jquery.ui.effect-fade.js"></script>
<script src="../../../ui/jquery.ui.effect-fold.js"></script>
<script src="../../../ui/jquery.ui.effect-highlight.js"></script>
<script src="../../../ui/jquery.ui.effect-pulsate.js"></script>
<script src="../../../ui/jquery.ui.effect-scale.js"></script>
<script src="../../../ui/jquery.ui.effect-shake.js"></script>
<script src="../../../ui/jquery.ui.effect-slide.js"></script>
<script src="../../../ui/jquery.ui.effect-transfer.js"></script>
<script src="effects.js"></script>
</head>
<body>

View File

@ -5,8 +5,8 @@
<title>jQuery UI Effects Test Suite</title>
<link rel="stylesheet" href="effects.css">
<script src="../../../jquery-1.7.2.js"></script>
<script src="../../../ui/jquery.effects.core.js"></script>
<script src="../../../ui/jquery.effects.scale.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<script src="../../../ui/jquery.ui.effect-scale.js"></script>
<script>
$(function() {
var test = $( "#testBox" ),

View File

@ -26,7 +26,8 @@
$( "#menu6" ).menu({
menus: ".menuElement",
select: logger
select: logger,
icon: "ui-icon-carat-1-s"
});
});
</script>
@ -212,7 +213,7 @@
</blockquote>
</div>
<h2>Menu with custom markup, multi-line items</h2>
<h2>Menu with custom markup, multi-line items and a custom submenu icon</h2>
<div class="menuElement" id="menu6">
<div class="address-item">
<a href="#">

View File

@ -9,11 +9,11 @@
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.position.js"></script>
<script src="../../../ui/jquery.ui.tooltip.js"></script>
<script src="../../../ui/jquery.effects.core.js"></script>
<script src="../../../ui/jquery.effects.blind.js"></script>
<script src="../../../ui/jquery.effects.bounce.js"></script>
<script src="../../../ui/jquery.effects.drop.js"></script>
<script src="../../../ui/jquery.effects.explode.js"></script>
<script src="../../../ui/jquery.ui.effect.js"></script>
<script src="../../../ui/jquery.ui.effect-blind.js"></script>
<script src="../../../ui/jquery.ui.effect-bounce.js"></script>
<script src="../../../ui/jquery.ui.effect-drop.js"></script>
<script src="../../../ui/jquery.ui.effect-explode.js"></script>
<style>
pre {
width: 250px;

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Accordion @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI CSS Framework @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Autocomplete @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI CSS Framework @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,13 +1,15 @@
/*!
* jQuery UI Button @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Button#theming
*/
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
.ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
.ui-button-icons-only { width: 3.4em; }

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI CSS Framework @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Datepicker @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
@ -56,8 +57,6 @@
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Dialog @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Menu @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Progressbar @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Resizable @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

View File

@ -1,7 +1,8 @@
/*!
* jQuery UI Selectable @VERSION
* http://jqueryui.com
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Copyright 2012 jQuery Foundation and other contributors
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*

Some files were not shown because too many files have changed in this diff Show More