mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Build: Migrate from JSHint & JSCS to ESLint
Fixes #15393 Closes gh-1958
This commit is contained in:
parent
a12c98574d
commit
70dae67b73
21
.eslintrc.json
Normal file
21
.eslintrc.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "jquery",
|
||||
|
||||
// Uncomment to find useless comment disable directives
|
||||
// "reportUnusedDisableDirectives": true,
|
||||
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"strict": [ "error", "global" ]
|
||||
}
|
||||
}
|
18
.jscsrc
18
.jscsrc
@ -1,18 +0,0 @@
|
||||
{
|
||||
"preset": "jquery",
|
||||
|
||||
// This is currently unenforcable see https://github.com/jscs-dev/node-jscs/issues/1686
|
||||
"requireCapitalizedComments": null,
|
||||
|
||||
// Until we drop IE8 this prevents things like warning on float keyword
|
||||
"es3": true,
|
||||
|
||||
// We want to output all errors
|
||||
"maxErrors": 1000000,
|
||||
|
||||
"excludeFiles": [
|
||||
"dist/**/*",
|
||||
"external/**/*",
|
||||
"ui/vendor/**/*"
|
||||
]
|
||||
}
|
16
.jshintrc
16
.jshintrc
@ -1,16 +0,0 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"smarttabs": true,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"node": true
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
demos
|
||||
tests
|
||||
.editorconfig
|
||||
.jscsrc
|
||||
.jshintrc
|
||||
.eslintrc.json
|
||||
.eslintignore
|
||||
.mailmap
|
||||
.travis.yml
|
||||
Gruntfile.js
|
||||
|
50
Gruntfile.js
50
Gruntfile.js
@ -1,7 +1,7 @@
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
var
|
||||
glob = require( "glob" ),
|
||||
|
||||
@ -177,25 +177,6 @@ grunt.initConfig( {
|
||||
}
|
||||
},
|
||||
|
||||
jscs: {
|
||||
ui: {
|
||||
options: {
|
||||
config: true
|
||||
},
|
||||
files: {
|
||||
src: [ "demos/**/*.js", "build/**/*.js", "ui/**/*.js" ]
|
||||
}
|
||||
},
|
||||
tests: {
|
||||
options: {
|
||||
config: true,
|
||||
maximumLineLength: null
|
||||
},
|
||||
files: {
|
||||
src: [ "tests/**/*.js" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
uglify: minify,
|
||||
htmllint: {
|
||||
good: {
|
||||
@ -203,7 +184,7 @@ grunt.initConfig( {
|
||||
ignore: [
|
||||
/The text content of element “script” was not in the required format: Expected space, tab, newline, or slash but found “.” instead/
|
||||
] },
|
||||
src: glob.sync("{demos,tests}/**/*.html", {
|
||||
src: glob.sync( "{demos,tests}/**/*.html", {
|
||||
ignore: htmllintBad
|
||||
} )
|
||||
},
|
||||
@ -242,12 +223,10 @@ grunt.initConfig( {
|
||||
}
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: true
|
||||
},
|
||||
eslint: {
|
||||
all: [
|
||||
"ui/*.js",
|
||||
"ui/**/*.js",
|
||||
"!ui/vendor/**/*.js",
|
||||
"Gruntfile.js",
|
||||
"build/**/*.js",
|
||||
"tests/unit/**/*.js",
|
||||
@ -287,10 +266,12 @@ grunt.initConfig( {
|
||||
"qunit/qunit.css": "qunit/qunit/qunit.css",
|
||||
"qunit/LICENSE.txt": "qunit/LICENSE.txt",
|
||||
|
||||
"qunit-assert-classes/qunit-assert-classes.js": "qunit-assert-classes/qunit-assert-classes.js",
|
||||
"qunit-assert-classes/qunit-assert-classes.js":
|
||||
"qunit-assert-classes/qunit-assert-classes.js",
|
||||
"qunit-assert-classes/LICENSE.txt": "qunit-assert-classes/LICENSE",
|
||||
|
||||
"qunit-assert-close/qunit-assert-close.js": "qunit-assert-close/qunit-assert-close.js",
|
||||
"qunit-assert-close/qunit-assert-close.js":
|
||||
"qunit-assert-close/qunit-assert-close.js",
|
||||
"qunit-assert-close/MIT-LICENSE.txt": "qunit-assert-close/MIT-LICENSE.txt",
|
||||
|
||||
"qunit-composite/qunit-composite.js": "qunit-composite/qunit-composite.js",
|
||||
@ -305,9 +286,6 @@ grunt.initConfig( {
|
||||
"jquery-simulate/jquery.simulate.js": "jquery-simulate/jquery.simulate.js",
|
||||
"jquery-simulate/LICENSE.txt": "jquery-simulate/LICENSE.txt",
|
||||
|
||||
"jshint/jshint.js": "jshint/dist/jshint.js",
|
||||
"jshint/LICENSE": "jshint/LICENSE",
|
||||
|
||||
"jquery/jquery.js": "jquery-1.x/dist/jquery.js",
|
||||
"jquery/LICENSE.txt": "jquery-1.x/LICENSE.txt",
|
||||
|
||||
@ -443,10 +421,12 @@ grunt.initConfig( {
|
||||
"jquery-3.6.0/jquery.js": "jquery-3.6.0/dist/jquery.js",
|
||||
"jquery-3.6.0/LICENSE.txt": "jquery-3.6.0/LICENSE.txt",
|
||||
|
||||
"jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.4.1/dist/jquery-migrate.js",
|
||||
"jquery-migrate-1.4.1/jquery-migrate.js":
|
||||
"jquery-migrate-1.4.1/dist/jquery-migrate.js",
|
||||
"jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt",
|
||||
|
||||
"jquery-migrate-3.3.2/jquery-migrate.js": "jquery-migrate-3.3.2/dist/jquery-migrate.js",
|
||||
"jquery-migrate-3.3.2/jquery-migrate.js":
|
||||
"jquery-migrate-3.3.2/dist/jquery-migrate.js",
|
||||
"jquery-migrate-3.3.2/LICENSE.txt": "jquery-migrate-3.3.2/LICENSE.txt"
|
||||
}
|
||||
}
|
||||
@ -512,7 +492,7 @@ grunt.registerTask( "update-authors", function() {
|
||||
|
||||
grunt.registerTask( "default", [ "lint", "requirejs", "test" ] );
|
||||
grunt.registerTask( "jenkins", [ "default", "concat" ] );
|
||||
grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ] );
|
||||
grunt.registerTask( "lint", [ "asciilint", "eslint", "csslint", "htmllint" ] );
|
||||
grunt.registerTask( "test", [ "qunit" ] );
|
||||
grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] );
|
||||
grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] );
|
||||
|
@ -15,7 +15,6 @@
|
||||
"jquery-color": "2.2.0",
|
||||
"jquery-mousewheel": "3.1.12",
|
||||
"jquery-simulate": "1.1.1",
|
||||
"jshint": "2.4.4",
|
||||
"qunit": "1.18.0",
|
||||
"qunit-assert-classes": "1.0.2",
|
||||
"qunit-assert-close": "JamesMGreene/qunit-assert-close#v1.1.1",
|
||||
|
@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var shell = require( "shelljs" );
|
||||
var Release = {
|
||||
define: function( props ) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function( Release ) {
|
||||
|
||||
var crypto = require( "crypto" );
|
||||
@ -35,7 +37,7 @@ function replaceAtVersion() {
|
||||
return matches;
|
||||
}
|
||||
|
||||
function removeExternals ( packager ) {
|
||||
function removeExternals( packager ) {
|
||||
Object.keys( packager.builtFiles ).forEach( function( filepath ) {
|
||||
if ( /^external\//.test( filepath ) ) {
|
||||
delete packager.builtFiles[ filepath ];
|
||||
|
@ -1,7 +1,7 @@
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
grunt.registerTask( "clean", function() {
|
||||
require( "rimraf" ).sync( "dist" );
|
||||
} );
|
||||
|
@ -1,7 +1,7 @@
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function( grunt ) {
|
||||
|
||||
var versions = {
|
||||
"git": "git",
|
||||
"3.x-git": "3.x-git",
|
||||
@ -95,7 +95,7 @@ grunt.registerTask( "testswarm", function( commit, configFile, browserSets ) {
|
||||
var test,
|
||||
latestTests = {};
|
||||
for ( test in tests ) {
|
||||
latestTests[ test ] = tests[ test ] + "?nojshint=true";
|
||||
latestTests[ test ] = tests[ test ];
|
||||
}
|
||||
submit( commit, latestTests, configFile, browserSets, "", this.async() );
|
||||
} );
|
||||
@ -104,7 +104,7 @@ grunt.registerTask( "testswarm-multi-jquery", function( commit, configFile, mino
|
||||
var allTests = {};
|
||||
versions[ minor ].split( " " ).forEach( function( version ) {
|
||||
for ( var test in tests ) {
|
||||
allTests[ test + "-" + version ] = tests[ test ] + "?nojshint=true&jquery=" + version;
|
||||
allTests[ test + "-" + version ] = tests[ test ] + "?jquery=" + version;
|
||||
}
|
||||
} );
|
||||
submit( commit, allTests, configFile, browserSets, "core " + minor, this.async() );
|
||||
|
5
demos/.eslintrc.json
Normal file
5
demos/.eslintrc.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "../ui/.eslintrc.json"
|
||||
}
|
1
demos/bootstrap.js
vendored
1
demos/bootstrap.js
vendored
@ -1,5 +1,6 @@
|
||||
/* globals window, document */
|
||||
( function() {
|
||||
"use strict";
|
||||
|
||||
// Find the script element
|
||||
var scripts = document.getElementsByTagName( "script" );
|
||||
|
20
external/jshint/LICENSE/LICENSE
vendored
20
external/jshint/LICENSE/LICENSE
vendored
@ -1,20 +0,0 @@
|
||||
Copyright 2012 Anton Kovalyov (http://jshint.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
60570
external/jshint/jshint.js
vendored
60570
external/jshint/jshint.js
vendored
File diff suppressed because it is too large
Load Diff
@ -50,6 +50,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"commitplease": "3.2.0",
|
||||
"eslint-config-jquery": "3.0.0",
|
||||
"glob": "7.1.6",
|
||||
"grunt": "1.3.0",
|
||||
"grunt-bowercopy": "1.2.5",
|
||||
@ -57,13 +58,12 @@
|
||||
"grunt-compare-size": "0.4.2",
|
||||
"grunt-contrib-concat": "1.0.1",
|
||||
"grunt-contrib-csslint": "2.0.0",
|
||||
"grunt-contrib-jshint": "0.12.0",
|
||||
"grunt-contrib-qunit": "4.0.0",
|
||||
"grunt-contrib-requirejs": "1.0.0",
|
||||
"grunt-contrib-uglify": "5.0.0",
|
||||
"grunt-eslint": "23.0.0",
|
||||
"grunt-git-authors": "3.2.0",
|
||||
"grunt-html": "14.2.0",
|
||||
"grunt-jscs": "2.1.0",
|
||||
"load-grunt-tasks": "5.1.0",
|
||||
"rimraf": "3.0.2",
|
||||
"testswarm": "1.1.2"
|
||||
|
26
tests/.eslintrc.json
Normal file
26
tests/.eslintrc.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 5
|
||||
},
|
||||
|
||||
"env": {
|
||||
"browser": true,
|
||||
"jquery": true,
|
||||
"node": false
|
||||
},
|
||||
|
||||
"rules": {
|
||||
// Too many violations:
|
||||
"max-len": "off",
|
||||
"no-unused-vars": "off",
|
||||
"strict": "off" // ideally, `[ "error", "function" ]`
|
||||
},
|
||||
|
||||
"globals": {
|
||||
"define": false,
|
||||
"Globalize": false,
|
||||
"QUnit": false,
|
||||
"require": true,
|
||||
"requirejs": true
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
{
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"expr": true,
|
||||
"immed": true,
|
||||
"noarg": true,
|
||||
"quotmark": "double",
|
||||
"smarttabs": true,
|
||||
"trailing": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
|
||||
"browser": true,
|
||||
"es3": true,
|
||||
"evil": true,
|
||||
"jquery": true,
|
||||
|
||||
"globals": {
|
||||
"define": false,
|
||||
"Globalize": false,
|
||||
"QUnit": false,
|
||||
"require": true,
|
||||
"requirejs": true,
|
||||
"JSHINT": false
|
||||
}
|
||||
}
|
4
tests/lib/bootstrap.js
vendored
4
tests/lib/bootstrap.js
vendored
@ -1,4 +1,5 @@
|
||||
( function() {
|
||||
"use strict";
|
||||
|
||||
var DEFAULT_JQUERY_VERSION = "1.12.4";
|
||||
|
||||
@ -9,7 +10,6 @@ requirejs.config( {
|
||||
"jquery": jqueryUrl(),
|
||||
"jquery-migrate": migrateUrl(),
|
||||
"jquery-simulate": "../../../external/jquery-simulate/jquery.simulate",
|
||||
"jshint": "../../../external/jshint/jshint",
|
||||
"lib": "../../lib",
|
||||
"phantom-bridge": "../../../node_modules/grunt-contrib-qunit/phantomjs/bridge",
|
||||
"qunit-assert-classes": "../../../external/qunit-assert-classes/qunit-assert-classes",
|
||||
@ -128,7 +128,7 @@ function migrateUrl() {
|
||||
url = "../../../external/jquery-migrate-1.4.1/jquery-migrate";
|
||||
} else if ( jqueryVersion === "custom" ) {
|
||||
if ( parseUrl().migrate ) {
|
||||
throw new Error ( "Migrate not currently supported for custom build" );
|
||||
throw new Error( "Migrate not currently supported for custom build" );
|
||||
}
|
||||
} else {
|
||||
throw new Error( "No migrate version known for jQuery " + jqueryVersion );
|
||||
|
@ -3,6 +3,7 @@ define( [
|
||||
"jquery",
|
||||
"lib/helper"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
var exports = {};
|
||||
|
||||
@ -69,7 +70,6 @@ function testBasicUsage( widget ) {
|
||||
exports.testWidget = function( widget, settings ) {
|
||||
QUnit.module( widget + ": common widget", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
exports.testJshint( "/widgets/" + widget );
|
||||
testWidgetDefaults( widget, settings.defaults );
|
||||
testWidgetOverrides( widget );
|
||||
if ( !settings.noDefaultElement ) {
|
||||
@ -81,58 +81,6 @@ exports.testWidget = function( widget, settings ) {
|
||||
} );
|
||||
};
|
||||
|
||||
exports.testJshint = function( module ) {
|
||||
|
||||
// Function.prototype.bind check is needed because JSHint doesn't work in ES3 browsers anymore
|
||||
// https://github.com/jshint/jshint/issues/1384
|
||||
if ( QUnit.urlParams.nojshint || !Function.prototype.bind ) {
|
||||
return;
|
||||
}
|
||||
|
||||
QUnit.test( "JSHint", function( assert ) {
|
||||
var ready = assert.async();
|
||||
require( [ "jshint" ], function() {
|
||||
assert.expect( 1 );
|
||||
|
||||
$.when(
|
||||
$.ajax( {
|
||||
url: "../../../ui/.jshintrc",
|
||||
dataType: "json"
|
||||
} ),
|
||||
$.ajax( {
|
||||
url: "../../../ui/" + module + ".js",
|
||||
dataType: "text"
|
||||
} )
|
||||
)
|
||||
.done( function( hintArgs, srcArgs ) {
|
||||
var globals, passed, errors,
|
||||
jshintrc = hintArgs[ 0 ],
|
||||
source = srcArgs[ 0 ];
|
||||
|
||||
globals = jshintrc.globals || {};
|
||||
delete jshintrc.globals;
|
||||
passed = JSHINT( source, jshintrc, globals );
|
||||
errors = $.map( JSHINT.errors, function( error ) {
|
||||
|
||||
// JSHINT may report null if there are too many errors
|
||||
if ( !error ) {
|
||||
return;
|
||||
}
|
||||
|
||||
return "[L" + error.line + ":C" + error.character + "] " +
|
||||
error.reason + "\n" + error.evidence + "\n";
|
||||
} ).join( "\n" );
|
||||
assert.ok( passed, errors );
|
||||
ready();
|
||||
} )
|
||||
.fail( function( hintError, srcError ) {
|
||||
assert.ok( false, "error loading source: " + ( hintError || srcError ).statusText );
|
||||
ready();
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
} );
|
||||
|
@ -1,4 +1,5 @@
|
||||
( function() {
|
||||
"use strict";
|
||||
|
||||
function includeStyle( url ) {
|
||||
document.write( "<link rel='stylesheet' href='../../../" + url + "'>" );
|
||||
|
@ -8,6 +8,7 @@ define( [
|
||||
"qunit",
|
||||
"jquery"
|
||||
], function( QUnit, $ ) {
|
||||
"use strict";
|
||||
|
||||
var domEqual = QUnit.assert.domEqual = function( selector, modifier, message ) {
|
||||
|
||||
|
@ -6,16 +6,11 @@ define( [
|
||||
"lib/qunit-assert-domequal",
|
||||
"phantom-bridge"
|
||||
], function( QUnit, $ ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.config.autostart = false;
|
||||
QUnit.config.requireExpects = true;
|
||||
|
||||
QUnit.config.urlConfig.push( {
|
||||
id: "nojshint",
|
||||
label: "Skip JSHint",
|
||||
tooltip: "Skip running JSHint, e.g., within TestSwarm, where Jenkins runs it already"
|
||||
} );
|
||||
|
||||
QUnit.config.urlConfig.push( {
|
||||
id: "jquery",
|
||||
label: "jQuery version",
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/accordion"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var beforeAfterEach = testHelper.beforeAfterEach,
|
||||
state = testHelper.state;
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/accordion"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var beforeAfterEach = testHelper.beforeAfterEach,
|
||||
state = testHelper.state;
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/accordion"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
return $.extend( helper, {
|
||||
equalHeight: function( assert, accordion, height ) {
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/accordion"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var equalHeight = testHelper.equalHeight,
|
||||
beforeAfterEach = testHelper.beforeAfterEach,
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/accordion"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var equalHeight = testHelper.equalHeight,
|
||||
beforeAfterEach = testHelper.beforeAfterEach,
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/autocomplete"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "autocomplete: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/autocomplete"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "autocomplete: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/autocomplete"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "autocomplete: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/autocomplete"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "autocomplete: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"ui/safe-active-element",
|
||||
"ui/widgets/button"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Button: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/button"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Button (deprecated): core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/button"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Button: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/button"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Button: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/button"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "button: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/checkboxradio"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Checkboxradio: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/checkboxradio"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Checkboxradio: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/checkboxradio"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Checkboxradio: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/checkboxradio"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Checkboxradio: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -8,6 +8,7 @@ define( [
|
||||
"ui/widgets/button",
|
||||
"ui/widgets/spinner"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Controlgroup: Core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -8,6 +8,7 @@ define( [
|
||||
"ui/widgets/button",
|
||||
"ui/widgets/spinner"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Controlgroup: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -8,6 +8,7 @@ define( [
|
||||
"ui/widgets/button",
|
||||
"ui/widgets/spinner"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "Controlgroup: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -7,11 +7,10 @@ define( [
|
||||
"ui/labels",
|
||||
"ui/unique-id"
|
||||
], function( QUnit, $, common, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "core - jQuery extensions", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
common.testJshint( "core" );
|
||||
|
||||
QUnit.test( "innerWidth - getter", function( assert ) {
|
||||
assert.expect( 2 );
|
||||
var el = $( "#dimensions" );
|
||||
|
@ -6,6 +6,7 @@ define( [
|
||||
"ui/focusable",
|
||||
"ui/tabbable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "core - selectors", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -7,6 +7,7 @@ define( [
|
||||
"ui/widgets/datepicker",
|
||||
"ui/i18n/datepicker-he"
|
||||
], function( QUnit, $, common, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "datepicker: core", {
|
||||
beforeEach: function() {
|
||||
@ -15,8 +16,6 @@ QUnit.module( "datepicker: core", {
|
||||
afterEach: helper.moduleAfterEach
|
||||
} );
|
||||
|
||||
common.testJshint( "widgets/datepicker" );
|
||||
|
||||
QUnit.test( "initialization - Reinitialization after body had been emptied.", function( assert ) {
|
||||
assert.expect( 1 );
|
||||
var bodyContent = $( "body" ).children(), inp = $( "#inp" );
|
||||
@ -57,7 +56,7 @@ QUnit.test( "baseStructure", function( assert ) {
|
||||
assert.ok( header.is( "div.ui-datepicker-header" ), "Structure - header division" );
|
||||
assert.equal( header.children().length, 3, "Structure - header child count" );
|
||||
assert.ok( header.children().first().is( "a.ui-datepicker-prev" ) && header.children().first().html() !== "", "Structure - prev link" );
|
||||
assert.ok( header.children().eq( 1 ).is( "a.ui-datepicker-next" ) && header.children().eq ( 1 ).html() !== "", "Structure - next link" );
|
||||
assert.ok( header.children().eq( 1 ).is( "a.ui-datepicker-next" ) && header.children().eq( 1 ).html() !== "", "Structure - next link" );
|
||||
|
||||
title = header.children().last();
|
||||
assert.ok( title.is( "div.ui-datepicker-title" ) && title.html() !== "", "Structure - title division" );
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/datepicker"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var beforeAfterEach = testHelper.beforeAfterEach;
|
||||
|
||||
@ -136,8 +137,12 @@ QUnit.test( "events", function( assert ) {
|
||||
|
||||
QUnit.test( "beforeShowDay-getDate", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
var inp = testHelper.init( "#inp", { beforeShowDay: function() { inp.datepicker( "getDate" ); return [ true, "" ]; } } ),
|
||||
dp = $( "#ui-datepicker-div" );
|
||||
var inp = testHelper.init( "#inp", {
|
||||
beforeShowDay: function() {
|
||||
inp.datepicker( "getDate" ); return [ true, "" ];
|
||||
}
|
||||
} );
|
||||
var dp = $( "#ui-datepicker-div" );
|
||||
inp.val( "01/01/2010" ).datepicker( "show" );
|
||||
|
||||
// Contains non-breaking space
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/datepicker"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
return $.extend( helper, {
|
||||
addMonths: function( date, offset ) {
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/datepicker"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var beforeAfterEach = testHelper.beforeAfterEach;
|
||||
|
||||
|
@ -8,6 +8,7 @@ define( [
|
||||
"ui/i18n/datepicker-zh-CN",
|
||||
"ui/ie"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var beforeAfterEach = testHelper.beforeAfterEach;
|
||||
|
||||
@ -902,7 +903,7 @@ QUnit.test( "localisation", function( assert ) {
|
||||
assert.expect( 24 );
|
||||
var dp, month, day, date,
|
||||
inp = testHelper.init( "#inp", $.datepicker.regional.fr );
|
||||
inp.datepicker( "option", { dateFormat: "DD, d MM yy", showButtonPanel:true, changeMonth:true, changeYear:true } ).val( "" ).datepicker( "show" );
|
||||
inp.datepicker( "option", { dateFormat: "DD, d MM yy", showButtonPanel: true, changeMonth: true, changeYear: true } ).val( "" ).datepicker( "show" );
|
||||
dp = $( "#ui-datepicker-div" );
|
||||
assert.equal( $( ".ui-datepicker-close", dp ).text(), "Fermer", "Localisation - close" );
|
||||
$( ".ui-datepicker-close", dp ).simulate( "mouseover" );
|
||||
@ -1039,50 +1040,85 @@ QUnit.test( "parseDateErrors", function( assert ) {
|
||||
try {
|
||||
expr();
|
||||
assert.ok( false, "Parsed error " + value );
|
||||
}
|
||||
catch ( e ) {
|
||||
} catch ( e ) {
|
||||
assert.equal( e, error, "Parsed error " + value );
|
||||
}
|
||||
}
|
||||
expectError( function() { $.datepicker.parseDate( null, "Sat 2 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( null, "Sat 2 01" );
|
||||
},
|
||||
"Sat 2 01", "Invalid arguments" );
|
||||
expectError( function() { $.datepicker.parseDate( "d m y", null ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "d m y", null );
|
||||
},
|
||||
"null", "Invalid arguments" );
|
||||
expectError( function() { $.datepicker.parseDate( "d m y", "Sat 2 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "d m y", "Sat 2 01" );
|
||||
},
|
||||
"Sat 2 01 - d m y", "Missing number at position 0" );
|
||||
expectError( function() { $.datepicker.parseDate( "dd mm yy", "Sat 2 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "dd mm yy", "Sat 2 01" );
|
||||
},
|
||||
"Sat 2 01 - dd mm yy", "Missing number at position 0" );
|
||||
expectError( function() { $.datepicker.parseDate( "d m y", "3 Feb 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "d m y", "3 Feb 01" );
|
||||
},
|
||||
"3 Feb 01 - d m y", "Missing number at position 2" );
|
||||
expectError( function() { $.datepicker.parseDate( "dd mm yy", "3 Feb 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "dd mm yy", "3 Feb 01" );
|
||||
},
|
||||
"3 Feb 01 - dd mm yy", "Missing number at position 2" );
|
||||
expectError( function() { $.datepicker.parseDate( "mm dd yy", "2 1 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "mm dd yy", "2 1 01" );
|
||||
},
|
||||
"2 1 01 - dd mm yy", "Missing number at position 4" );
|
||||
expectError( function() { $.datepicker.parseDate( "d m y", "3 2 AD01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "d m y", "3 2 AD01" );
|
||||
},
|
||||
"3 2 AD01 - d m y", "Missing number at position 4" );
|
||||
expectError( function() { $.datepicker.parseDate( "d m yy", "3 2 AD01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "d m yy", "3 2 AD01" );
|
||||
},
|
||||
"3 2 AD01 - dd mm yy", "Missing number at position 4" );
|
||||
expectError( function() { $.datepicker.parseDate( "y-o", "01-D01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "y-o", "01-D01" );
|
||||
},
|
||||
"2001-D01 - y-o", "Missing number at position 3" );
|
||||
expectError( function() { $.datepicker.parseDate( "yy-oo", "2001-D01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "yy-oo", "2001-D01" );
|
||||
},
|
||||
"2001-D01 - yy-oo", "Missing number at position 5" );
|
||||
expectError( function() { $.datepicker.parseDate( "D d M y", "D7 3 Feb 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "D d M y", "D7 3 Feb 01" );
|
||||
},
|
||||
"D7 3 Feb 01 - D d M y", "Unknown name at position 0" );
|
||||
expectError( function() { $.datepicker.parseDate( "D d M y", "Sat 3 M2 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "D d M y", "Sat 3 M2 01" );
|
||||
},
|
||||
"Sat 3 M2 01 - D d M y", "Unknown name at position 6" );
|
||||
expectError( function() { $.datepicker.parseDate( "DD, MM d, yy", "Saturday- Feb 3, 2001" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "DD, MM d, yy", "Saturday- Feb 3, 2001" );
|
||||
},
|
||||
"Saturday- Feb 3, 2001 - DD, MM d, yy", "Unexpected literal at position 8" );
|
||||
expectError( function() { $.datepicker.parseDate( "'day' d 'of' MM (''DD''), yy",
|
||||
"day 3 of February (\"Saturday\"), 2001" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "'day' d 'of' MM (''DD''), yy",
|
||||
"day 3 of February (\"Saturday\"), 2001" );
|
||||
},
|
||||
"day 3 of Mon2 ('Day7'), 2001", "Unexpected literal at position 19" );
|
||||
expectError( function() { $.datepicker.parseDate( "d m y", "29 2 01" ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "d m y", "29 2 01" );
|
||||
},
|
||||
"29 2 01 - d m y", "Invalid date" );
|
||||
fr = $.datepicker.regional.fr;
|
||||
settings = { dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
||||
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames };
|
||||
expectError( function() { $.datepicker.parseDate( "D d M y", "Mon 9 Avr 01", settings ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "D d M y", "Mon 9 Avr 01", settings );
|
||||
},
|
||||
"Mon 9 Avr 01 - D d M y", "Unknown name at position 0" );
|
||||
expectError( function() { $.datepicker.parseDate( "D d M y", "Lun. 9 Apr 01", settings ); },
|
||||
expectError( function() {
|
||||
$.datepicker.parseDate( "D d M y", "Lun. 9 Apr 01", settings );
|
||||
},
|
||||
"Lun. 9 Apr 01 - D d M y", "Unknown name at position 7" );
|
||||
} );
|
||||
|
||||
@ -1092,7 +1128,7 @@ QUnit.test( "Ticket #7244: date parser does not fail when too many numbers are p
|
||||
try {
|
||||
date = $.datepicker.parseDate( "dd/mm/yy", "18/04/19881" );
|
||||
assert.ok( false, "Did not properly detect an invalid date" );
|
||||
}catch ( e ) {
|
||||
} catch ( e ) {
|
||||
assert.ok( "invalid date detected" );
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/dialog"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
// TODO add afterEach callback to remove dialogs
|
||||
QUnit.module( "dialog: core", { afterEach: helper.moduleAfterEach } );
|
||||
@ -209,8 +210,7 @@ QUnit.test( "focus tabbable", function( assert ) {
|
||||
function( done ) {
|
||||
var inputs = element.find( "input"
|
||||
);
|
||||
assert.equal
|
||||
( document.activeElement, inputs[ 1 ], "Focus starts on second input" );
|
||||
assert.equal( document.activeElement, inputs[ 1 ], "Focus starts on second input" );
|
||||
inputs.last().simulate( "keydown", { keyCode: $.ui.keyCode.TAB } );
|
||||
setTimeout( function() {
|
||||
assert.equal( document.activeElement, inputs[ 0 ],
|
||||
@ -275,7 +275,7 @@ QUnit.test( "#9048: multiple modal dialogs opened and closed in different order"
|
||||
function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 1 );
|
||||
$( "#dialog1, #dialog2" ).dialog( { autoOpen: false, modal:true } );
|
||||
$( "#dialog1, #dialog2" ).dialog( { autoOpen: false, modal: true } );
|
||||
$( "#dialog1" ).dialog( "open" );
|
||||
$( "#dialog2" ).dialog( "open" );
|
||||
$( "#dialog1" ).dialog( "close" );
|
||||
@ -311,9 +311,7 @@ QUnit.test( "interaction between overlay and other dialogs", function( assert )
|
||||
// Wait for the modal to init
|
||||
setTimeout( function() {
|
||||
|
||||
second.
|
||||
testWidget
|
||||
( "open" );
|
||||
second.testWidget( "open" );
|
||||
|
||||
// Simulate user tabbing from address bar to an element outside the dialog
|
||||
$( "#favorite-animal" ).trigger( "focus" );
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/dialog"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "dialog (deprecated): options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/dialog"
|
||||
], function( QUnit, $, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "dialog: events", { afterEach: testHelper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/dialog"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
return $.extend( helper, {
|
||||
drag: function( element, handle, dx, dy ) {
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/dialog"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "dialog: methods", {
|
||||
afterEach: function() {
|
||||
@ -68,7 +69,7 @@ QUnit.test( "destroy", function( assert ) {
|
||||
assert.equal( $( ".ui-widget-overlay" ).length, 0, "overlay does not exist" );
|
||||
assert.equal( $( document ).data( "ui-dialog-overlays" ), undefined, "ui-dialog-overlays equals the number of open overlays" );
|
||||
|
||||
element = $( "#dialog1" ).dialog( { modal: true } ),
|
||||
element = $( "#dialog1" ).dialog( { modal: true } );
|
||||
element2 = $( "#dialog2" ).dialog( { modal: true } );
|
||||
assert.equal( $( ".ui-widget-overlay" ).length, 2, "overlays created when dialogs are open" );
|
||||
assert.equal( $( document ).data( "ui-dialog-overlays" ), 2, "ui-dialog-overlays equals the number of open overlays" );
|
||||
@ -86,7 +87,7 @@ QUnit.test( "destroy", function( assert ) {
|
||||
QUnit.test( "#9000: Dialog leaves broken event handler after close/destroy in certain cases", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 1 );
|
||||
$( "#dialog1" ).dialog( { modal:true } ).dialog( "close" ).dialog( "destroy" );
|
||||
$( "#dialog1" ).dialog( { modal: true } ).dialog( "close" ).dialog( "destroy" );
|
||||
setTimeout( function() {
|
||||
$( "#favorite-animal" ).trigger( "focus" );
|
||||
assert.ok( true, "close and destroy modal dialog before its really opened" );
|
||||
|
@ -7,6 +7,7 @@ define( [
|
||||
"ui/effects/effect-blind",
|
||||
"ui/effects/effect-explode"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "dialog: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -7,6 +7,7 @@ define( [
|
||||
"ui/widgets/droppable",
|
||||
"ui/widgets/resizable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "draggable: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/draggable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
var element;
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/draggable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
return $.extend( helper, {
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/draggable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var element;
|
||||
|
||||
|
@ -7,6 +7,7 @@ define( [
|
||||
"ui/widgets/droppable",
|
||||
"ui/widgets/sortable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "draggable: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/droppable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "droppable: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -20,7 +21,9 @@ QUnit.test( "element types", function( assert ) {
|
||||
var typeName = typeNames[ i ],
|
||||
el = $( document.createElement( typeName ) ).appendTo( "body" );
|
||||
|
||||
( typeName === "table" && el.append( "<tr><td>content</td></tr>" ) );
|
||||
if ( typeName === "table" ) {
|
||||
el.append( "<tr><td>content</td></tr>" );
|
||||
}
|
||||
el.droppable();
|
||||
testHelper.shouldDrop( assert );
|
||||
el.droppable( "destroy" );
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/droppable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "droppable: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -3,6 +3,7 @@ define( [
|
||||
"jquery",
|
||||
"lib/helper"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
return $.extend( helper, {
|
||||
shouldDrop: function( assert ) {
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/droppable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "droppable: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -61,7 +62,7 @@ QUnit.test( "enable", function( assert ) {
|
||||
assert.equal( el.droppable( "option", "disabled" ), false, "disabled option setter" );
|
||||
testHelper.shouldDrop( assert );
|
||||
|
||||
expected = $( "<div></div>" ).droppable(),
|
||||
expected = $( "<div></div>" ).droppable();
|
||||
actual = expected.droppable( "enable" );
|
||||
assert.equal( actual, expected, "enable is chainable" );
|
||||
} );
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/droppable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "droppable: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -80,6 +81,7 @@ QUnit.test( "scope", function( assert ) {
|
||||
assert.equal( draggableOffset.left, oldDraggableOffset.left );
|
||||
assert.equal( draggableOffset.top, oldDraggableOffset.top );
|
||||
} );
|
||||
|
||||
/*
|
||||
Test( "greedy", function() {
|
||||
ok(false, 'missing test - untested code is broken code');
|
||||
|
@ -20,6 +20,7 @@ define( [
|
||||
"ui/effects/effect-slide",
|
||||
"ui/effects/effect-transfer"
|
||||
], function( QUnit, $, common, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.assert.present = function( value, array, message ) {
|
||||
this.push( jQuery.inArray( value, array ) !== -1, value, array, message );
|
||||
@ -268,7 +269,7 @@ QUnit.test( "createPlaceholder: preserves layout affecting properties", function
|
||||
assert.deepEqual( before.position.top - position, placeholder.position().top, "position top preserved" );
|
||||
assert.deepEqual( before.position.left - position, placeholder.position().left, "position left preserved" );
|
||||
|
||||
assert.deepEqual( before[ "float" ], placeholder.css( "float" ), "float preserved" );
|
||||
assert.deepEqual( before.float, placeholder.css( "float" ), "float preserved" );
|
||||
assert.deepEqual( before.outerWidth, placeholder.outerWidth( true ), "width preserved" );
|
||||
assert.deepEqual( before.outerHeight, placeholder.outerHeight( true ), "height preserved" );
|
||||
} );
|
||||
@ -304,8 +305,6 @@ QUnit.test( "transfer() with callback", function( assert ) {
|
||||
$.each( $.effects.effect, function( effect ) {
|
||||
QUnit.module( "effects." + effect );
|
||||
|
||||
common.testJshint( "effects/effect-" + effect );
|
||||
|
||||
if ( effect === "transfer" ) {
|
||||
return;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/effects/effect-scale"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "effect.scale: Scale", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -34,8 +35,20 @@ function run( position, v, h, vo, ho ) {
|
||||
|
||||
css[ h ] = 33;
|
||||
css[ v ] = 33;
|
||||
target[ h ] = h === ho ? css[ h ] : ho === "center" ? css[ h ] - 35 : css[ h ] - 70;
|
||||
target[ v ] = v === vo ? css[ v ] : vo === "middle" ? css[ v ] - 35 : css[ v ] - 70;
|
||||
if ( h === ho ) {
|
||||
target[ h ] = css[ h ];
|
||||
} else if ( ho === "center" ) {
|
||||
target[ h ] = css[ h ] - 35;
|
||||
} else {
|
||||
target[ h ] = css[ h ] - 70;
|
||||
}
|
||||
if ( v === vo ) {
|
||||
target[ v ] = css[ v ];
|
||||
} else if ( vo === "middle" ) {
|
||||
target[ v ] = css[ v ] - 35;
|
||||
} else {
|
||||
target[ v ] = css[ v ] - 70;
|
||||
}
|
||||
if ( relative && h === "right" ) {
|
||||
target[ h ] += 70;
|
||||
}
|
||||
@ -51,6 +64,7 @@ function suite( position ) {
|
||||
run( position, "top", "left", "top", "left" );
|
||||
run( position, "top", "left", "middle", "center" );
|
||||
run( position, "top", "left", "bottom", "right" );
|
||||
|
||||
/* Firefox is currently not capable of supporting detection of bottom and right....
|
||||
run( position, "bottom", "right", "top", "left" );
|
||||
run( position, "bottom", "right", "middle", "center" );
|
||||
|
@ -6,6 +6,7 @@ define( [
|
||||
"ui/widget",
|
||||
"ui/form-reset-mixin"
|
||||
], function( QUnit, $, common, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "widget factory", {
|
||||
beforeEach: function() {
|
||||
@ -31,8 +32,6 @@ QUnit.module( "widget factory", {
|
||||
}
|
||||
} );
|
||||
|
||||
common.testJshint( "form-reset-mixin" );
|
||||
|
||||
QUnit.test( "form reset", function( assert ) {
|
||||
var ready = assert.async();
|
||||
assert.expect( 2 );
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/menu"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "menu: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/menu"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var log = testHelper.log,
|
||||
logOutput = testHelper.logOutput,
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/menu"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var log = testHelper.log,
|
||||
logOutput = testHelper.logOutput,
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/menu"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var log = testHelper.log,
|
||||
logOutput = testHelper.logOutput,
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/position"
|
||||
], function( QUnit, $, common, helper ) {
|
||||
"use strict";
|
||||
|
||||
var win = $( window ),
|
||||
scrollTopSupport = function() {
|
||||
@ -23,8 +24,6 @@ QUnit.module( "position", {
|
||||
afterEach: helper.moduleAfterEach
|
||||
} );
|
||||
|
||||
common.testJshint( "position" );
|
||||
|
||||
QUnit.test( "my, at, of", function( assert ) {
|
||||
assert.expect( 4 );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/progressbar"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "progressbar: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/progressbar"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "progressbar: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/progressbar"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "progressbar: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/progressbar"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "progressbar: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/resizable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "resizable: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/resizable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "resizable: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -3,6 +3,7 @@ define( [
|
||||
"jquery",
|
||||
"lib/helper"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
return $.extend( helper, {
|
||||
drag: function( el, dx, dy ) {
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/resizable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "resizable: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/resizable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "resizable: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectable"
|
||||
], function( QUnit, $, testHelpers ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectable: events", { afterEach: testHelpers.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectable: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -53,7 +54,9 @@ QUnit.test( "enable", function( assert ) {
|
||||
|
||||
el.selectable( {
|
||||
disabled: true,
|
||||
start: function() { fired = true; }
|
||||
start: function() {
|
||||
fired = true;
|
||||
}
|
||||
} );
|
||||
el.simulate( "drag", {
|
||||
dx: 20,
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectable: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -13,7 +14,9 @@ QUnit.test( "autoRefresh", function( assert ) {
|
||||
var actual = 0,
|
||||
el = $( "#selectable1" ),
|
||||
sel = $( "*", el ),
|
||||
selected = function() { actual += 1; };
|
||||
selected = function() {
|
||||
actual += 1;
|
||||
};
|
||||
|
||||
el = $( "#selectable1" ).selectable( { autoRefresh: false, selected: selected } );
|
||||
sel.hide();
|
||||
@ -51,7 +54,9 @@ QUnit.test( "filter", function( assert ) {
|
||||
var actual = 0,
|
||||
el = $( "#selectable1" ),
|
||||
sel = $( "*", el ),
|
||||
selected = function() { actual += 1; };
|
||||
selected = function() {
|
||||
actual += 1;
|
||||
};
|
||||
|
||||
el = $( "#selectable1" ).selectable( { filter: ".special", selected: selected } );
|
||||
el.simulate( "drag", {
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectmenu"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectmenu: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectmenu"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectmenu: events", {
|
||||
beforeEach: function() {
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectmenu"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectmenu: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/selectmenu"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "selectmenu: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/slider"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
var element, options;
|
||||
|
||||
@ -68,7 +69,7 @@ QUnit.test( "keydown HOME on handle sets value to min", function( assert ) {
|
||||
element.slider( "value", 0 );
|
||||
|
||||
handle().simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
||||
assert.equal( element.slider( "value" ), options.min ) ;
|
||||
assert.equal( element.slider( "value" ), options.min );
|
||||
|
||||
element.slider( "destroy" );
|
||||
} );
|
||||
@ -87,7 +88,7 @@ QUnit.test( "keydown END on handle sets value to max", function( assert ) {
|
||||
element.slider( "value", 0 );
|
||||
|
||||
handle().simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
||||
assert.equal( element.slider( "value" ), options.max ) ;
|
||||
assert.equal( element.slider( "value" ), options.max );
|
||||
|
||||
element.slider( "destroy" );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/slider"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "slider: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -124,7 +125,7 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
|
||||
start: function( event, ui ) {
|
||||
assert.equal( handles.index( ui.handle ), 0, "leftmost handle activated when overlapping at maximum" );
|
||||
}
|
||||
} ),
|
||||
} );
|
||||
handles = element.find( ".ui-slider-handle" );
|
||||
handles.eq( 0 ).simulate( "drag", { dx: -10 } );
|
||||
element.slider( "destroy" );
|
||||
@ -132,7 +133,7 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
|
||||
element = $( "#slider1" )
|
||||
.slider( {
|
||||
values: [ 19, 20 ]
|
||||
} ),
|
||||
} );
|
||||
handles = element.find( ".ui-slider-handle" );
|
||||
handles.eq( 0 ).simulate( "drag", { dx: 10 } );
|
||||
element.one( "slidestart", function( event, ui ) {
|
||||
@ -144,7 +145,7 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
|
||||
element = $( "#slider1" )
|
||||
.slider( {
|
||||
values: [ 19, 20 ]
|
||||
} ),
|
||||
} );
|
||||
handles = element.find( ".ui-slider-handle" );
|
||||
handles.eq( 1 ).simulate( "drag", { dx: -10 } );
|
||||
element.one( "slidestart", function( event, ui ) {
|
||||
@ -158,7 +159,7 @@ QUnit.test( "mouse based interaction part two: when handles overlap", function(
|
||||
min: 0,
|
||||
max: 100,
|
||||
values: [ 0, 50 ]
|
||||
} ),
|
||||
} );
|
||||
handles = element.find( ".ui-slider-handle" );
|
||||
|
||||
element.slider( "option", { values: [ 100, 100 ] } );
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/slider"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "slider: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/slider"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
var element, options;
|
||||
|
||||
@ -147,7 +148,7 @@ QUnit.test( "orientation", function( assert ) {
|
||||
assert.equal( element.find( ".ui-slider-handle" )[ 0 ].style.bottom, "", "CSS bottom reset" );
|
||||
assert.equal( handle()[ 0 ].style.left, percentVal + "%", "horizontal slider handle is positioned with left: %" );
|
||||
|
||||
element.slider( "destroy" ) ;
|
||||
element.slider( "destroy" );
|
||||
|
||||
options = {
|
||||
max: 2,
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/sortable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "sortable: core", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -6,6 +6,7 @@ define( [
|
||||
"ui/widgets/sortable",
|
||||
"ui/widgets/draggable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "sortable: events", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -183,7 +184,9 @@ QUnit.test( "#4752: link event firing on sortable with connect list", function(
|
||||
assert.expect( 10 );
|
||||
|
||||
var fired = {},
|
||||
hasFired = function( type ) { return ( type in fired ) && ( true === fired[ type ] ); };
|
||||
hasFired = function( type ) {
|
||||
return ( type in fired ) && ( true === fired[ type ] );
|
||||
};
|
||||
|
||||
$( "#sortable" ).clone().attr( "id", "sortable2" ).insertAfter( "#sortable" );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/sortable"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "sortable: methods", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
@ -62,7 +63,7 @@ QUnit.test( "enable", function( assert ) {
|
||||
|
||||
testHelper.sort( assert, $( "li", el )[ 0 ], 0, 44, 2, ".sortable('option', 'disabled', false)" );
|
||||
|
||||
expected = $( "<div></div>" ).sortable(),
|
||||
expected = $( "<div></div>" ).sortable();
|
||||
actual = expected.sortable( "enable" );
|
||||
assert.equal( actual, expected, "enable is chainable" );
|
||||
} );
|
||||
|
@ -4,6 +4,7 @@ define( [
|
||||
"lib/helper",
|
||||
"ui/widgets/sortable"
|
||||
], function( QUnit, $, helper ) {
|
||||
"use strict";
|
||||
|
||||
QUnit.module( "sortable: options", { afterEach: helper.moduleAfterEach } );
|
||||
|
||||
|
@ -5,6 +5,7 @@ define( [
|
||||
"./helper",
|
||||
"ui/widgets/spinner"
|
||||
], function( QUnit, $, helper, testHelper ) {
|
||||
"use strict";
|
||||
|
||||
var simulateKeyDownUp = testHelper.simulateKeyDownUp;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user