mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Merge branch 'master' into position-notification
This commit is contained in:
commit
308b55e50c
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,3 @@
|
|||||||
build/dist
|
|
||||||
build/size
|
|
||||||
build/build/.sizecache.json
|
|
||||||
dist
|
dist
|
||||||
node_modules
|
node_modules
|
||||||
docs
|
docs
|
||||||
|
373
build/build.xml
373
build/build.xml
@ -1,373 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
jQuery UI Release!
|
|
||||||
|
|
||||||
Call task called 'deploy-release' to build a full release.
|
|
||||||
The release built will be stored on 'dist' dir.
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project name="jquery-ui" default="deploy-release" basedir=".">
|
|
||||||
|
|
||||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
|
|
||||||
<classpath>
|
|
||||||
<pathelement location="build/ant-contrib-0.6.jar"/>
|
|
||||||
</classpath>
|
|
||||||
</taskdef>
|
|
||||||
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<loadfile failonerror="no" srcFile="../version.txt" property="release.version">
|
|
||||||
<filterchain><striplinebreaks/></filterchain>
|
|
||||||
</loadfile>
|
|
||||||
<property name="release.filename" value="jquery-ui-${release.version}" />
|
|
||||||
|
|
||||||
<property name="dist.dir" value="dist/${release.filename}/" />
|
|
||||||
<property name="cdndist.dir" value="dist/${release.filename}-cdn" />
|
|
||||||
<property name="build.dir" value="build" />
|
|
||||||
<property name="ui.dir" value="../" />
|
|
||||||
<property name="src.dir" value="${ui.dir}/ui/" />
|
|
||||||
<property name="theme.dir" value="${ui.dir}/themes/base/" />
|
|
||||||
<property name="docs.dir" value="${dist.dir}/docs/" />
|
|
||||||
<property name="min.dir" value="${dist.dir}/ui/minified" />
|
|
||||||
<property name="size.dir" value="size" />
|
|
||||||
|
|
||||||
<property name="concatenated" value="jquery-ui" />
|
|
||||||
<property name="concatenated.i18n" value="jquery-ui-i18n" />
|
|
||||||
|
|
||||||
<property name="core.files" value="jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js" />
|
|
||||||
<property name="core.files.min" value="jquery.ui.core.min.js, jquery.ui.widget.min.js, jquery.ui.mouse.min.js, jquery.ui.draggable.min.js, jquery.ui.droppable.min.js, jquery.ui.resizable.min.js, jquery.ui.selectable.min.js, jquery.ui.sortable.min.js, jquery.effects.core.min.js" />
|
|
||||||
|
|
||||||
<property description="YUI Compressor" name="yuicompressor-jar" value="${build.dir}/yuicompressor-2.4.2.jar" />
|
|
||||||
|
|
||||||
<target name="deploy-release" depends="clean, docs-download, copy, minify, replace-version, prepend-header, zip" description="Release builder">
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="replace-version">
|
|
||||||
<replaceregexp match="@VERSION" replace="${release.version}" flags="g" byline="true">
|
|
||||||
<fileset dir="${dist.dir}/ui/" includes="*.js"/>
|
|
||||||
<fileset dir="${dist.dir}/ui/minified/" includes="*.js"/>
|
|
||||||
<fileset dir="${dist.dir}/themes/" includes="**/*.css"/>
|
|
||||||
</replaceregexp>
|
|
||||||
<echo message="Replaced all @VERSION to ${release.version}." />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="prepend-header">
|
|
||||||
<copy todir="${dist.dir}/headers/">
|
|
||||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
|
||||||
</copy>
|
|
||||||
<replaceregexp match="^(\/\*.*?\*\/\s).+" replace="\1" flags="s">
|
|
||||||
<fileset dir="${dist.dir}/headers/" includes="*.css"/>
|
|
||||||
</replaceregexp>
|
|
||||||
<for param="file">
|
|
||||||
<path><fileset dir="${dist.dir}/themes/base/minified" includes="*.css" /></path>
|
|
||||||
<sequential>
|
|
||||||
<propertyregex override="yes" property="target" input="@{file}" regexp=".*[\\/](.+)\.min\.css$" replace="\1"/>
|
|
||||||
<concat destfile="${dist.dir}/ui-headered/${target}.min.css">
|
|
||||||
<header file="${dist.dir}/headers/${target}.css" />
|
|
||||||
<fileset file="@{file}" />
|
|
||||||
</concat>
|
|
||||||
</sequential>
|
|
||||||
</for>
|
|
||||||
<copy todir="${dist.dir}/themes/base/minified" overwrite="true">
|
|
||||||
<fileset dir="${dist.dir}/ui-headered/" includes="*.css" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<delete dir="${dist.dir}/headers/" />
|
|
||||||
<delete dir="${dist.dir}/ui-headered/" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target description="Zip the package" name="zip">
|
|
||||||
<zip destfile="${dist.dir}/../${release.filename}.zip">
|
|
||||||
<zipfileset dir="dist/" />
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="concatenate">
|
|
||||||
<echo message="Building concatenated" />
|
|
||||||
<mkdir dir="${dist.dir}/ui/" />
|
|
||||||
<delete file="${dist.dir}/ui/${concatenated}.js" />
|
|
||||||
|
|
||||||
<concat destfile="${dist.dir}/ui/${concatenated}.js">
|
|
||||||
<filelist dir="${src.dir}/" files="${core.files}" />
|
|
||||||
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" excludes="${core.files}" />
|
|
||||||
</concat>
|
|
||||||
<echo message="Concatenated built." />
|
|
||||||
|
|
||||||
<concat destfile="${dist.dir}/themes/base/${concatenated}.css">
|
|
||||||
<fileset dir="${theme.dir}/" includes="jquery.ui.core.css" />
|
|
||||||
<fileset dir="${theme.dir}/" includes="jquery.ui.*.css" excludes="jquery.ui.all.css, jquery.ui.core.css, jquery.ui.base.css, jquery.ui.theme.css" />
|
|
||||||
<fileset dir="${theme.dir}/" includes="jquery.ui.theme.css" />
|
|
||||||
</concat>
|
|
||||||
<echo message="Concatenated theme." />
|
|
||||||
|
|
||||||
<mkdir dir="${dist.dir}/ui/i18n/" />
|
|
||||||
<delete file="${dist.dir}/ui/i18n/${concatenated.i18n}.js" />
|
|
||||||
|
|
||||||
<concat destfile="${dist.dir}/ui/i18n/${concatenated.i18n}.js" encoding="utf-8">
|
|
||||||
<fileset dir="${src.dir}/i18n/" includes="jquery.ui.*.js" />
|
|
||||||
</concat>
|
|
||||||
<echo message="Concatenated i18n built." />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="minify" depends="concatenate" description="Remove all comments and whitespace, no compression, great in combination with GZip">
|
|
||||||
<echo message="Building minified" />
|
|
||||||
<mkdir dir="${min.dir}" />
|
|
||||||
<mkdir dir="${min.dir}/i18n/" />
|
|
||||||
<mkdir dir="${dist.dir}/themes/base/minified" />
|
|
||||||
<parallel threadsperprocessor="1">
|
|
||||||
<apply executable="build/minify-js.sh">
|
|
||||||
<fileset dir="${dist.dir}/ui" includes="**.js" />
|
|
||||||
<srcfile />
|
|
||||||
<mapper type="glob" from="*.js" to="${min.dir}/*.min.js" />
|
|
||||||
<targetfile/>
|
|
||||||
</apply>
|
|
||||||
<apply executable="build/minify-js.sh">
|
|
||||||
<fileset dir="${dist.dir}/ui/i18n" includes="**.js" />
|
|
||||||
<srcfile />
|
|
||||||
<mapper type="glob" from="*.js" to="${min.dir}/i18n/*.min.js" />
|
|
||||||
<targetfile/>
|
|
||||||
</apply>
|
|
||||||
<apply executable="java" parallel="false">
|
|
||||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
|
||||||
<arg line="-jar" />
|
|
||||||
<arg path="${yuicompressor-jar}" />
|
|
||||||
<arg line="--charset utf-8" />
|
|
||||||
<arg line="-v" />
|
|
||||||
<srcfile />
|
|
||||||
<arg line="-o" />
|
|
||||||
<mapper type="glob" from="*.css" to="${dist.dir}/themes/base/minified/*.min.css" />
|
|
||||||
<targetfile/>
|
|
||||||
</apply>
|
|
||||||
</parallel>
|
|
||||||
|
|
||||||
<replaceregexp match=".css" replace=".min.css" flags="g">
|
|
||||||
<fileset dir="${dist.dir}/themes/base/minified/">
|
|
||||||
<include name="*.base.min.css"/>
|
|
||||||
<include name="*.all.min.css"/>
|
|
||||||
</fileset>
|
|
||||||
</replaceregexp>
|
|
||||||
|
|
||||||
<!-- make a copy of all theme images to ensure that relative paths in minified css files work -->
|
|
||||||
<copy todir="${dist.dir}/themes/base/minified/images" >
|
|
||||||
<fileset dir="${ui.dir}/themes/base/images" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- make a copy of the minified files for use in tests -->
|
|
||||||
<copy todir="dist" file="${min.dir}/jquery-ui.min.js" />
|
|
||||||
<copy todir="dist/theme" file="${dist.dir}/themes/base/minified/jquery-ui.min.css" />
|
|
||||||
<copy todir="dist/theme/images" >
|
|
||||||
<fileset dir="${ui.dir}/themes/base/images" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<echo message="Minified ui/ built." />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target description="Copy needed folders" name="copy">
|
|
||||||
<echo message="Copying files" />
|
|
||||||
<mkdir dir="${dist.dir}" />
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/">
|
|
||||||
<fileset dir="${ui.dir}/" includes="jquery-*.js" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/ui/">
|
|
||||||
<fileset dir="${src.dir}/" includes="jquery.ui.*.js, jquery.effects.*.js" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/ui/i18n/" >
|
|
||||||
<fileset dir="${src.dir}/i18n/" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/">
|
|
||||||
<fileset dir="${ui.dir}/" includes="*.txt" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/demos/" >
|
|
||||||
<fileset dir="${ui.dir}/demos/" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/external/" >
|
|
||||||
<fileset dir="${ui.dir}/external/" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/tests/" >
|
|
||||||
<fileset dir="${ui.dir}/tests/" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<copy overwrite="true" todir="${dist.dir}/themes/" >
|
|
||||||
<fileset dir="${ui.dir}/themes/" />
|
|
||||||
</copy>
|
|
||||||
<echo message="Files copied." />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean">
|
|
||||||
<delete dir="dist" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="docs-download">
|
|
||||||
<mkdir dir="${docs.dir}" />
|
|
||||||
<property name="url" value="http://docs.jquery.com/action/render/UI/API/${release.version}/" />
|
|
||||||
<parallel threadcount="8">
|
|
||||||
<get src="${url}Draggable" dest="${docs.dir}draggable.html" />
|
|
||||||
<get src="${url}Droppable" dest="${docs.dir}droppable.html" />
|
|
||||||
<get src="${url}Resizable" dest="${docs.dir}resizable.html" />
|
|
||||||
<get src="${url}Selectable" dest="${docs.dir}selectable.html" />
|
|
||||||
<get src="${url}Sortable" dest="${docs.dir}sortable.html" />
|
|
||||||
|
|
||||||
<get src="${url}Accordion" dest="${docs.dir}accordion.html" />
|
|
||||||
<get src="${url}Autocomplete" dest="${docs.dir}autocomplete.html" />
|
|
||||||
<get src="${url}Button" dest="${docs.dir}button.html" />
|
|
||||||
<get src="${url}Datepicker" dest="${docs.dir}datepicker.html" />
|
|
||||||
<get src="${url}Dialog" dest="${docs.dir}dialog.html" />
|
|
||||||
<get src="${url}Menu" dest="${docs.dir}menu.html" />
|
|
||||||
<get src="${url}Progressbar" dest="${docs.dir}progressbar.html" />
|
|
||||||
<get src="${url}Slider" dest="${docs.dir}slider.html" />
|
|
||||||
<get src="${url}Spinner" dest="${docs.dir}spinner.html" />
|
|
||||||
<get src="${url}Tooltip" dest="${docs.dir}tooltip.html" />
|
|
||||||
<get src="${url}Tabs" dest="${docs.dir}tabs.html" />
|
|
||||||
|
|
||||||
<get src="${url}Position" dest="${docs.dir}position.html" />
|
|
||||||
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/animate" dest="${docs.dir}animate.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/addClass" dest="${docs.dir}addClass.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/effect" dest="${docs.dir}effect.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/hide" dest="${docs.dir}hide.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/removeClass" dest="${docs.dir}removeClass.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/show" dest="${docs.dir}show.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/switchClass" dest="${docs.dir}switchClass.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/toggle" dest="${docs.dir}toggle.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/toggleClass" dest="${docs.dir}toggleClass.html" />
|
|
||||||
|
|
||||||
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Blind" dest="${docs.dir}effect-blind.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Clip" dest="${docs.dir}effect-clip.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Drop" dest="${docs.dir}effect-drop.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Explode" dest="${docs.dir}effect-explode.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Fade" dest="${docs.dir}effect-fade.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Fold" dest="${docs.dir}effect-fold.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Puff" dest="${docs.dir}effect-puff.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Slide" dest="${docs.dir}effect-slide.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Scale" dest="${docs.dir}effect-scale.html" />
|
|
||||||
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Bounce" dest="${docs.dir}effect-bounce.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Highlight" dest="${docs.dir}effect-highlight.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Pulsate" dest="${docs.dir}effect-pulsate.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Shake" dest="${docs.dir}effect-shake.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Size" dest="${docs.dir}effect-size.html" />
|
|
||||||
<get src="http://docs.jquery.com/action/render/UI/Effects/Transfer" dest="${docs.dir}effect-transfer.html" />
|
|
||||||
</parallel>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="themes-download">
|
|
||||||
<!-- to create/update query strings for the theme-file, execute this in Firebug on /download page:
|
|
||||||
$("select option[value!=none]").map(function() { $(this).parent().val(this.value).change(); return $(this).parents("form").serialize(); }).get().join(",");
|
|
||||||
-->
|
|
||||||
<loadfile srcFile="themes" property="urls" />
|
|
||||||
<property name="zip" value="${dist.dir}themes/tmp.zip" />
|
|
||||||
<mkdir dir="${dist.dir}themes" />
|
|
||||||
<for list="${urls}" param="url">
|
|
||||||
<sequential>
|
|
||||||
<get src="http://ui-dev.jquery.com/download/?@{url}" dest="${zip}" />
|
|
||||||
<unzip src="${zip}" dest="${dist.dir}themes/">
|
|
||||||
<patternset>
|
|
||||||
<include name="development-bundle/themes/**"/>
|
|
||||||
<exclude name="development-bundle/themes/base/**"/>
|
|
||||||
</patternset>
|
|
||||||
<mapper type="glob" from="development-bundle/themes/*" to="*" />
|
|
||||||
</unzip>
|
|
||||||
<delete file="${zip}" />
|
|
||||||
</sequential>
|
|
||||||
</for>
|
|
||||||
<move todir="${dist.dir}themes/">
|
|
||||||
<fileset dir="${dist.dir}themes/" />
|
|
||||||
<mapper>
|
|
||||||
<mapper type="regexp" from="(.*)jquery-ui-.*custom.css" to="\1jquery-ui.css" />
|
|
||||||
</mapper>
|
|
||||||
</move>
|
|
||||||
<copy todir="dist/jquery-ui-themes-${release.version}">
|
|
||||||
<fileset dir="${dist.dir}/" includes="AUTHORS.txt,GPL-LICENSE.txt,MIT-LICENSE.txt,version.txt,themes/**" />
|
|
||||||
</copy>
|
|
||||||
<zip destfile="${dist.dir}/../jquery-ui-themes-${release.version}.zip">
|
|
||||||
<zipfileset dir="dist/" includes="jquery-ui-themes-${release.version}/" />
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="whitespace">
|
|
||||||
<replaceregexp match="[\t ]+$" replace="" flags="g" byline="true">
|
|
||||||
<fileset dir="${src.dir}" includes="*.js"/>
|
|
||||||
<fileset dir="${src.dir}/i18n/" includes="*.js"/>
|
|
||||||
</replaceregexp>
|
|
||||||
<echo message="All trailing spaces removed." />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="size" depends="copy, minify, replace-version, prepend-header" description="Report sizes of files">
|
|
||||||
<echo message="Collecting files to size" />
|
|
||||||
<mkdir dir="${size.dir}" />
|
|
||||||
<copy todir="${size.dir}">
|
|
||||||
<fileset dir="${dist.dir}/ui" includes="*.js" />
|
|
||||||
<fileset dir="${dist.dir}/ui/i18n" includes="*.js" />
|
|
||||||
<fileset dir="${dist.dir}/ui/minified" includes="*.js" />
|
|
||||||
<fileset dir="${dist.dir}/ui/minified/i18n" includes="*.js" />
|
|
||||||
<fileset dir="${dist.dir}/themes/base" includes="*.css" />
|
|
||||||
<fileset dir="${dist.dir}/themes/base/minified" includes="*.css" />
|
|
||||||
</copy>
|
|
||||||
<echo message="GZipping Minified" />
|
|
||||||
<apply executable="gzip">
|
|
||||||
<fileset dir="${size.dir}" includes="*.min.js" />
|
|
||||||
<fileset dir="${size.dir}" includes="*.min.css" />
|
|
||||||
<arg value="-c" />
|
|
||||||
<srcfile />
|
|
||||||
<redirector>
|
|
||||||
<outputmapper id="out" type="glob" from="*" to="${size.dir}/*.gz"/>
|
|
||||||
</redirector>
|
|
||||||
</apply>
|
|
||||||
<echo message="Comparing file size with previous build" />
|
|
||||||
<exec executable="bash">
|
|
||||||
<arg value="-c" />
|
|
||||||
<arg value="wc -c ${size.dir}/* | `which node nodejs 2>/dev/null` build/sizer.js" />
|
|
||||||
</exec>
|
|
||||||
<delete dir="${size.dir}" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="cdn">
|
|
||||||
<delete dir="${cdndist.dir}" />
|
|
||||||
<mkdir dir="${cdndist.dir}" />
|
|
||||||
<copy todir="${cdndist.dir}">
|
|
||||||
<fileset dir=".." includes="AUTHORS.txt, GPL-LICENSE.txt, MIT-LICENSE.txt, version.txt" />
|
|
||||||
</copy>
|
|
||||||
<copy todir="${cdndist.dir}">
|
|
||||||
<fileset dir="${dist.dir}ui" includes="jquery-ui.js" />
|
|
||||||
<fileset dir="${dist.dir}ui/minified" includes="jquery-ui.min.js" />
|
|
||||||
</copy>
|
|
||||||
<copy todir="${cdndist.dir}/i18n">
|
|
||||||
<fileset dir="${dist.dir}ui/i18n" />
|
|
||||||
<fileset dir="${dist.dir}ui/minified/i18n" />
|
|
||||||
</copy>
|
|
||||||
<copy todir="${cdndist.dir}/themes">
|
|
||||||
<fileset dir="${dist.dir}themes" />
|
|
||||||
</copy>
|
|
||||||
<checksum>
|
|
||||||
<fileset dir="${cdndist.dir}" />
|
|
||||||
</checksum>
|
|
||||||
<for param="file">
|
|
||||||
<path><fileset dir="${cdndist.dir}" includes="**/" excludes="**/*.MD5" /></path>
|
|
||||||
<sequential>
|
|
||||||
<!-- @{file} is an absolute path, use that ugly regexes to make it relative -->
|
|
||||||
<propertyregex override="yes" property="relativepath" input="@{file}" regexp=".+?cdn[\\/](.+)$" replace="\1"/>
|
|
||||||
<propertyregex override="yes" property="relativepath" input="${relativepath}" regexp="\\" replace="/" global="true" />
|
|
||||||
<concat destfile="${cdndist.dir}/MANIFEST" append="yes">${relativepath} </concat>
|
|
||||||
<concat destfile="${cdndist.dir}/MANIFEST" append="yes"><file file="@{file}.MD5" /></concat>
|
|
||||||
</sequential>
|
|
||||||
</for>
|
|
||||||
<delete dir="${cdndist.dir}" includes="**/*.MD5" />
|
|
||||||
<zip destfile="${dist.dir}/../${release.filename}-googlecdn.zip">
|
|
||||||
<zipfileset dir="dist/" includes="${release.filename}-cdn/" />
|
|
||||||
</zip>
|
|
||||||
<zip destfile="${dist.dir}/../${release.filename}-mscdn.zip">
|
|
||||||
<zipfileset dir="dist/${release.filename}-cdn/" />
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
</project>
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@
|
|||||||
var jsp = require("./parse-js"),
|
|
||||||
pro = require("./process"),
|
|
||||||
slice = jsp.slice,
|
|
||||||
member = jsp.member,
|
|
||||||
PRECEDENCE = jsp.PRECEDENCE,
|
|
||||||
OPERATORS = jsp.OPERATORS;
|
|
||||||
|
|
||||||
function ast_squeeze_more(ast) {
|
|
||||||
var w = pro.ast_walker(), walk = w.walk;
|
|
||||||
return w.with_walkers({
|
|
||||||
"call": function(expr, args) {
|
|
||||||
if (expr[0] == "dot" && expr[2] == "toString" && args.length == 0) {
|
|
||||||
// foo.toString() ==> foo+""
|
|
||||||
return [ "binary", "+", expr[1], [ "string", "" ]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, function() {
|
|
||||||
return walk(ast);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.ast_squeeze_more = ast_squeeze_more;
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
dir=$(dirname $0)
|
|
||||||
`which node nodejs 2> /dev/null` $dir/uglify.js $1 > $2
|
|
@ -1,41 +0,0 @@
|
|||||||
var fs = require( "fs" ),
|
|
||||||
stdin = process.openStdin(),
|
|
||||||
rsize = /(\d+).*?(jquery\S+)/g,
|
|
||||||
oldsizes = {},
|
|
||||||
sizes = {},
|
|
||||||
input = "";
|
|
||||||
|
|
||||||
stdin.setEncoding( "utf8" );
|
|
||||||
|
|
||||||
try {
|
|
||||||
oldsizes = JSON.parse( fs.readFileSync( __dirname + "/.sizecache.json", "utf8" ) );
|
|
||||||
} catch(e) {
|
|
||||||
oldsizes = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
function lpad( str, len, chr ) {
|
|
||||||
return ( Array(len+1).join( chr || " ") + str ).substr( -len );
|
|
||||||
}
|
|
||||||
|
|
||||||
stdin.on( "data" , function( chunk ) {
|
|
||||||
input += chunk;
|
|
||||||
});
|
|
||||||
stdin.on( "end", function() {
|
|
||||||
var match;
|
|
||||||
|
|
||||||
while ( match = rsize.exec( input ) ) {
|
|
||||||
sizes[ match[2] ] = parseInt( match[1], 10 );
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync( __dirname + "/.sizecache.json", JSON.stringify( sizes, true ), "utf8" );
|
|
||||||
for ( var key in sizes ) {
|
|
||||||
var diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] );
|
|
||||||
if ( diff > 0 ) {
|
|
||||||
diff = "+" + diff;
|
|
||||||
}
|
|
||||||
console.log( "%s %s %s", lpad( sizes[ key ], 8 ), lpad( oldsizes[key] ? "(" + diff + ")" : "(-)", 8 ), key );
|
|
||||||
}
|
|
||||||
process.nextTick(function() {
|
|
||||||
process.exit();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,211 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
||||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
||||||
<xsl:output method="html" />
|
|
||||||
|
|
||||||
<xsl:template name="ref">
|
|
||||||
<xsl:text>link-</xsl:text>
|
|
||||||
<xsl:value-of select="translate(@name, '$.|', '')"/>
|
|
||||||
<xsl:text>-</xsl:text>
|
|
||||||
<xsl:for-each select="params">
|
|
||||||
<xsl:value-of select="translate(@name, '<>|$.', '')" />
|
|
||||||
</xsl:for-each>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="href">
|
|
||||||
<xsl:attribute name="href">
|
|
||||||
<xsl:text>#</xsl:text>
|
|
||||||
<xsl:call-template name="ref" />
|
|
||||||
</xsl:attribute>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="id">
|
|
||||||
<xsl:attribute name="id">
|
|
||||||
<xsl:call-template name="ref" />
|
|
||||||
</xsl:attribute>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="return">
|
|
||||||
<xsl:attribute name="title">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="@return='jQuery'">A jQuery object.</xsl:when>
|
|
||||||
<xsl:when test="@return='Boolean'">true or false.</xsl:when>
|
|
||||||
<xsl:when test="@return='Object'">A simple Javascript object..</xsl:when>
|
|
||||||
<xsl:when test="@return='String'">A string of characters.</xsl:when>
|
|
||||||
<xsl:when test="@return='Number'">A valid numeric.</xsl:when>
|
|
||||||
<xsl:when test="@return='String|Number'">A string of characters or a number.</xsl:when>
|
|
||||||
<xsl:when test="@return='Element'">The Javascript object representation of a DOM Element.</xsl:when>
|
|
||||||
<xsl:when test="@return='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
|
|
||||||
<xsl:when test="@return='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
|
|
||||||
<xsl:when test="@return='Array<Element>'">An Array of DOM Elements.</xsl:when>
|
|
||||||
<xsl:when test="@return='Array<String>'">An Array of strings.</xsl:when>
|
|
||||||
<xsl:when test="@return='Function'">A reference to a Javascript function.</xsl:when>
|
|
||||||
<xsl:when test="@return='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:value-of select="@return"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="type">
|
|
||||||
<xsl:attribute name="title">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="@type='jQuery'">A jQuery object.</xsl:when>
|
|
||||||
<xsl:when test="@type='Boolean'">true or false.</xsl:when>
|
|
||||||
<xsl:when test="@type='Object'">A simple Javascript object..</xsl:when>
|
|
||||||
<xsl:when test="@type='String'">A string of characters.</xsl:when>
|
|
||||||
<xsl:when test="@type='Number'">A valid numeric.</xsl:when>
|
|
||||||
<xsl:when test="@type='String|Number'">A string of characters or a number.</xsl:when>
|
|
||||||
<xsl:when test="@type='Element'">The Javascript object representation of a DOM Element.</xsl:when>
|
|
||||||
<xsl:when test="@type='Element|Array<Element>'">One or more DOM Elements (a single one or an array).</xsl:when>
|
|
||||||
<xsl:when test="@type='Map'">A Javascript object that contains key/value pairs in the form of properties and values.</xsl:when>
|
|
||||||
<xsl:when test="@type='Array<Element>'">An Array of DOM Elements.</xsl:when>
|
|
||||||
<xsl:when test="@type='Array<String>'">An Array of strings.</xsl:when>
|
|
||||||
<xsl:when test="@type='Function'">A reference to a Javascript function.</xsl:when>
|
|
||||||
<xsl:when test="@type='XMLHttpRequest'">An XMLHttpRequest object (referencing a HTTP request).</xsl:when>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:value-of select="@type"/>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="break">
|
|
||||||
<xsl:value-of select="." disable-output-escaping="yes" />
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="option">
|
|
||||||
<div class="param">
|
|
||||||
<div class="param-header">
|
|
||||||
<h3><span><xsl:value-of select="@name"/></span></h3>
|
|
||||||
<p class="param-type"><span><xsl:call-template name="type" /></span></p>
|
|
||||||
<p class="param-default">Default: <xsl:value-of select="@default"/></p>
|
|
||||||
</div>
|
|
||||||
<div class="param-details">
|
|
||||||
<p><xsl:value-of select="desc"/></p>
|
|
||||||
<!-- TODO select all examples -->
|
|
||||||
<xsl:for-each select="following-sibling::example[1]">
|
|
||||||
<h4>Code sample:</h4>
|
|
||||||
<p><xsl:value-of select="desc" disable-output-escaping="yes"/></p>
|
|
||||||
<code>
|
|
||||||
<xsl:value-of select="code"/>
|
|
||||||
</code>
|
|
||||||
</xsl:for-each>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="/*">
|
|
||||||
<div id="widget-docs">
|
|
||||||
<ul>
|
|
||||||
<li><a href="#docs-overview"><span>Overview</span></a></li>
|
|
||||||
<li><a href="#docs-options"><span>Options</span></a></li>
|
|
||||||
<li><a href="#docs-methods"><span>Methods</span></a></li>
|
|
||||||
<li><a href="#docs-theming"><span>Theming</span></a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- TAB 1 -->
|
|
||||||
<div id="docs-overview">
|
|
||||||
<div id="docs-overview-sidebar">
|
|
||||||
<h4>Dependencies:</h4>
|
|
||||||
<ul>
|
|
||||||
<li><a href="#">jquery.ui.core.js</a></li>
|
|
||||||
<li><a href="#">jquery.ui.draggable.js <span>(Optional)</span></a></li>
|
|
||||||
<li><a href="#">jquery.ui.resizable.js <span>(Optional)</span></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="docs-overview-main">
|
|
||||||
<p>
|
|
||||||
<xsl:for-each select="//function[1]/desc">
|
|
||||||
<xsl:call-template name="break" />
|
|
||||||
</xsl:for-each>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<xsl:for-each select="//function[1]/longdesc">
|
|
||||||
<xsl:call-template name="break" />
|
|
||||||
</xsl:for-each>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- TAB 2 -->
|
|
||||||
<div id="docs-options">
|
|
||||||
<p class="intro"><xsl:value-of select="//function[1]/params/desc"/></p>
|
|
||||||
|
|
||||||
<div class="docs-list-header clearfix">
|
|
||||||
<h2>Property options</h2>
|
|
||||||
<p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="docs-list clearfix">
|
|
||||||
<xsl:for-each select="//function[1]/option[not(starts-with(@type, 'function'))]">
|
|
||||||
<xsl:call-template name="option"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
</div><!-- /property options -->
|
|
||||||
|
|
||||||
<div class="docs-list-header clearfix">
|
|
||||||
<h2>Event options</h2>
|
|
||||||
<p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="docs-list clearfix">
|
|
||||||
<xsl:for-each select="//function[1]/option[starts-with(@type, 'function')]">
|
|
||||||
<xsl:call-template name="option"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
</div><!-- /event options -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- TAB 3 -->
|
|
||||||
<div id="docs-methods">
|
|
||||||
<p class="intro">A brief description of methods and their uses goes here so their use is clearly explained and any caveats can be mentioned up front.</p>
|
|
||||||
|
|
||||||
<div class="docs-list-header clearfix">
|
|
||||||
<h2>Methods</h2>
|
|
||||||
<p><a href="#">Show details</a> | <a href="#">Hide details</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="docs-list clearfix">
|
|
||||||
<xsl:for-each select="//function[position() != 1]">
|
|
||||||
<div class="param">
|
|
||||||
<div class="param-header">
|
|
||||||
<h3><span><xsl:value-of select="//function[1]/@name"/>( <xsl:value-of select="params[1]/@name"/>
|
|
||||||
<xsl:for-each select="params[position() != 1]">
|
|
||||||
<xsl:text>, </xsl:text><xsl:value-of select="@name"/>
|
|
||||||
</xsl:for-each>
|
|
||||||
)</span></h3>
|
|
||||||
<p class="param-type">Returns: <span><xsl:call-template name="return" /></span></p>
|
|
||||||
</div>
|
|
||||||
<div class="param-details">
|
|
||||||
<p><xsl:value-of select="desc"/></p>
|
|
||||||
<p><xsl:value-of select="longdesc"/></p>
|
|
||||||
<h4>Arguments:</h4>
|
|
||||||
<table class="param-args" summary="Arguments for this method" cellspacing="0">
|
|
||||||
<tbody>
|
|
||||||
<xsl:for-each select="params[position() != 1]">
|
|
||||||
<tr>
|
|
||||||
<td><xsl:value-of select="@name"/></td>
|
|
||||||
<td><xsl:value-of select="@type"/></td>
|
|
||||||
<td><xsl:value-of select="."/></td>
|
|
||||||
</tr>
|
|
||||||
</xsl:for-each>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h4>Code sample:</h4>
|
|
||||||
<xsl:for-each select="example">
|
|
||||||
<h5><xsl:value-of select="desc"/></h5>
|
|
||||||
<code>
|
|
||||||
<xsl:value-of select="code"/>
|
|
||||||
</code>
|
|
||||||
</xsl:for-each>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xsl:for-each>
|
|
||||||
|
|
||||||
</div><!-- /methods -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- TAB 4 -->
|
|
||||||
<div id="docs-theming">
|
|
||||||
%%THEMING%%
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
@ -1,285 +0,0 @@
|
|||||||
#! /usr/bin/env node
|
|
||||||
// -*- js -*-
|
|
||||||
|
|
||||||
global.sys = require(/^v0\.[012]/.test(process.version) ? "sys" : "util");
|
|
||||||
var fs = require("fs");
|
|
||||||
var jsp = require("./lib/parse-js"),
|
|
||||||
pro = require("./lib/process");
|
|
||||||
|
|
||||||
var options = {
|
|
||||||
ast: false,
|
|
||||||
mangle: true,
|
|
||||||
mangle_toplevel: false,
|
|
||||||
squeeze: true,
|
|
||||||
make_seqs: true,
|
|
||||||
dead_code: true,
|
|
||||||
verbose: false,
|
|
||||||
show_copyright: true,
|
|
||||||
out_same_file: false,
|
|
||||||
max_line_length: 32 * 1024,
|
|
||||||
unsafe: false,
|
|
||||||
reserved_names: null,
|
|
||||||
defines: { },
|
|
||||||
codegen_options: {
|
|
||||||
ascii_only: false,
|
|
||||||
beautify: false,
|
|
||||||
indent_level: 4,
|
|
||||||
indent_start: 0,
|
|
||||||
quote_keys: false,
|
|
||||||
space_colon: false
|
|
||||||
},
|
|
||||||
output: true // stdout
|
|
||||||
};
|
|
||||||
|
|
||||||
var args = jsp.slice(process.argv, 2);
|
|
||||||
var filename;
|
|
||||||
|
|
||||||
out: while (args.length > 0) {
|
|
||||||
var v = args.shift();
|
|
||||||
switch (v) {
|
|
||||||
case "-b":
|
|
||||||
case "--beautify":
|
|
||||||
options.codegen_options.beautify = true;
|
|
||||||
break;
|
|
||||||
case "-i":
|
|
||||||
case "--indent":
|
|
||||||
options.codegen_options.indent_level = args.shift();
|
|
||||||
break;
|
|
||||||
case "-q":
|
|
||||||
case "--quote-keys":
|
|
||||||
options.codegen_options.quote_keys = true;
|
|
||||||
break;
|
|
||||||
case "-mt":
|
|
||||||
case "--mangle-toplevel":
|
|
||||||
options.mangle_toplevel = true;
|
|
||||||
break;
|
|
||||||
case "--no-mangle":
|
|
||||||
case "-nm":
|
|
||||||
options.mangle = false;
|
|
||||||
break;
|
|
||||||
case "--no-squeeze":
|
|
||||||
case "-ns":
|
|
||||||
options.squeeze = false;
|
|
||||||
break;
|
|
||||||
case "--no-seqs":
|
|
||||||
options.make_seqs = false;
|
|
||||||
break;
|
|
||||||
case "--no-dead-code":
|
|
||||||
options.dead_code = false;
|
|
||||||
break;
|
|
||||||
case "--no-copyright":
|
|
||||||
case "-nc":
|
|
||||||
options.show_copyright = false;
|
|
||||||
break;
|
|
||||||
case "-o":
|
|
||||||
case "--output":
|
|
||||||
options.output = args.shift();
|
|
||||||
break;
|
|
||||||
case "--overwrite":
|
|
||||||
options.out_same_file = true;
|
|
||||||
break;
|
|
||||||
case "-v":
|
|
||||||
case "--verbose":
|
|
||||||
options.verbose = true;
|
|
||||||
break;
|
|
||||||
case "--ast":
|
|
||||||
options.ast = true;
|
|
||||||
break;
|
|
||||||
case "--unsafe":
|
|
||||||
options.unsafe = true;
|
|
||||||
break;
|
|
||||||
case "--max-line-len":
|
|
||||||
options.max_line_length = parseInt(args.shift(), 10);
|
|
||||||
break;
|
|
||||||
case "--reserved-names":
|
|
||||||
options.reserved_names = args.shift().split(",");
|
|
||||||
break;
|
|
||||||
case "-d":
|
|
||||||
case "--define":
|
|
||||||
var defarg = args.shift();
|
|
||||||
try {
|
|
||||||
var defsym = function(sym) {
|
|
||||||
// KEYWORDS_ATOM doesn't include NaN or Infinity - should we check
|
|
||||||
// for them too ?? We don't check reserved words and the like as the
|
|
||||||
// define values are only substituted AFTER parsing
|
|
||||||
if (jsp.KEYWORDS_ATOM.hasOwnProperty(sym)) {
|
|
||||||
throw "Don't define values for inbuilt constant '"+sym+"'";
|
|
||||||
}
|
|
||||||
return sym;
|
|
||||||
},
|
|
||||||
defval = function(v) {
|
|
||||||
if (v.match(/^"(.*)"$/) || v.match(/^'(.*)'$/)) {
|
|
||||||
return [ "string", RegExp.$1 ];
|
|
||||||
}
|
|
||||||
else if (!isNaN(parseFloat(v))) {
|
|
||||||
return [ "num", parseFloat(v) ];
|
|
||||||
}
|
|
||||||
else if (v.match(/^[a-z\$_][a-z\$_0-9]*$/i)) {
|
|
||||||
return [ "name", v ];
|
|
||||||
}
|
|
||||||
else if (!v.match(/"/)) {
|
|
||||||
return [ "string", v ];
|
|
||||||
}
|
|
||||||
else if (!v.match(/'/)) {
|
|
||||||
return [ "string", v ];
|
|
||||||
}
|
|
||||||
throw "Can't understand the specified value: "+v;
|
|
||||||
};
|
|
||||||
if (defarg.match(/^([a-z_\$][a-z_\$0-9]*)(=(.*))?$/i)) {
|
|
||||||
var sym = defsym(RegExp.$1),
|
|
||||||
val = RegExp.$2 ? defval(RegExp.$2.substr(1)) : [ 'name', 'true' ];
|
|
||||||
options.defines[sym] = val;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw "The --define option expects SYMBOL[=value]";
|
|
||||||
}
|
|
||||||
} catch(ex) {
|
|
||||||
sys.print("ERROR: In option --define "+defarg+"\n"+ex+"\n");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "--define-from-module":
|
|
||||||
var defmodarg = args.shift(),
|
|
||||||
defmodule = require(defmodarg),
|
|
||||||
sym,
|
|
||||||
val;
|
|
||||||
for (sym in defmodule) {
|
|
||||||
if (defmodule.hasOwnProperty(sym)) {
|
|
||||||
options.defines[sym] = function(val) {
|
|
||||||
if (typeof val == "string")
|
|
||||||
return [ "string", val ];
|
|
||||||
if (typeof val == "number")
|
|
||||||
return [ "num", val ];
|
|
||||||
if (val === true)
|
|
||||||
return [ 'name', 'true' ];
|
|
||||||
if (val === false)
|
|
||||||
return [ 'name', 'false' ];
|
|
||||||
if (val === null)
|
|
||||||
return [ 'name', 'null' ];
|
|
||||||
if (val === undefined)
|
|
||||||
return [ 'name', 'undefined' ];
|
|
||||||
sys.print("ERROR: In option --define-from-module "+defmodarg+"\n");
|
|
||||||
sys.print("ERROR: Unknown object type for: "+sym+"="+val+"\n");
|
|
||||||
process.exit(1);
|
|
||||||
return null;
|
|
||||||
}(defmodule[sym]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "--ascii":
|
|
||||||
options.codegen_options.ascii_only = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
filename = v;
|
|
||||||
break out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.verbose) {
|
|
||||||
pro.set_logger(function(msg){
|
|
||||||
sys.debug(msg);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
jsp.set_logger(function(msg){
|
|
||||||
sys.debug(msg);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (filename) {
|
|
||||||
fs.readFile(filename, "utf8", function(err, text){
|
|
||||||
if (err) throw err;
|
|
||||||
output(squeeze_it(text));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
var stdin = process.openStdin();
|
|
||||||
stdin.setEncoding("utf8");
|
|
||||||
var text = "";
|
|
||||||
stdin.on("data", function(chunk){
|
|
||||||
text += chunk;
|
|
||||||
});
|
|
||||||
stdin.on("end", function() {
|
|
||||||
output(squeeze_it(text));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function output(text) {
|
|
||||||
var out;
|
|
||||||
if (options.out_same_file && filename)
|
|
||||||
options.output = filename;
|
|
||||||
if (options.output === true) {
|
|
||||||
out = process.stdout;
|
|
||||||
} else {
|
|
||||||
out = fs.createWriteStream(options.output, {
|
|
||||||
flags: "w",
|
|
||||||
encoding: "utf8",
|
|
||||||
mode: 0644
|
|
||||||
});
|
|
||||||
}
|
|
||||||
out.write(text);
|
|
||||||
if (options.output !== true) {
|
|
||||||
out.end();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// --------- main ends here.
|
|
||||||
|
|
||||||
function show_copyright(comments) {
|
|
||||||
var ret = "";
|
|
||||||
for (var i = 0; i < comments.length; ++i) {
|
|
||||||
var c = comments[i];
|
|
||||||
if (c.type == "comment1") {
|
|
||||||
ret += "//" + c.value + "\n";
|
|
||||||
} else {
|
|
||||||
ret += "/*" + c.value + "*/\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
|
|
||||||
function squeeze_it(code) {
|
|
||||||
var result = "";
|
|
||||||
if (options.show_copyright) {
|
|
||||||
var tok = jsp.tokenizer(code), c;
|
|
||||||
c = tok();
|
|
||||||
result += show_copyright(c.comments_before);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
var ast = time_it("parse", function(){ return jsp.parse(code); });
|
|
||||||
if (options.mangle) ast = time_it("mangle", function(){
|
|
||||||
return pro.ast_mangle(ast, {
|
|
||||||
toplevel: options.mangle_toplevel,
|
|
||||||
defines: options.defines,
|
|
||||||
except: options.reserved_names
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (options.squeeze) ast = time_it("squeeze", function(){
|
|
||||||
ast = pro.ast_squeeze(ast, {
|
|
||||||
make_seqs : options.make_seqs,
|
|
||||||
dead_code : options.dead_code,
|
|
||||||
keep_comps : !options.unsafe
|
|
||||||
});
|
|
||||||
if (options.unsafe)
|
|
||||||
ast = pro.ast_squeeze_more(ast);
|
|
||||||
return ast;
|
|
||||||
});
|
|
||||||
if (options.ast)
|
|
||||||
return sys.inspect(ast, null, null);
|
|
||||||
result += time_it("generate", function(){ return pro.gen_code(ast, options.codegen_options) });
|
|
||||||
if (!options.codegen_options.beautify && options.max_line_length) {
|
|
||||||
result = time_it("split", function(){ return pro.split_lines(result, options.max_line_length) });
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
} catch(ex) {
|
|
||||||
sys.debug(ex.stack);
|
|
||||||
sys.debug(sys.inspect(ex));
|
|
||||||
sys.debug(JSON.stringify(ex));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function time_it(name, cont) {
|
|
||||||
if (!options.verbose)
|
|
||||||
return cont();
|
|
||||||
var t1 = new Date().getTime();
|
|
||||||
try { return cont(); }
|
|
||||||
finally { sys.debug("// " + name + ": " + ((new Date().getTime() - t1) / 1000).toFixed(3) + " sec."); }
|
|
||||||
};
|
|
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
@ -37,53 +37,28 @@
|
|||||||
width: 120px;
|
width: 120px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
.ui-flipped-top {
|
|
||||||
border-top: 3px solid #000000;
|
|
||||||
}
|
|
||||||
.ui-flipped-bottom {
|
|
||||||
border-bottom: 3px solid #000000;
|
|
||||||
}
|
|
||||||
.ui-flipped-left {
|
|
||||||
border-left: 3px solid #000000;
|
|
||||||
}
|
|
||||||
.ui-flipped-right {
|
|
||||||
border-right: 3px solid #000000;
|
|
||||||
}
|
|
||||||
select, input {
|
select, input {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
function position( using ) {
|
function position() {
|
||||||
$( ".positionable" ).position({
|
$( ".positionable" ).position({
|
||||||
of: $( "#parent" ),
|
of: $( "#parent" ),
|
||||||
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
|
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
|
||||||
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
|
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
|
||||||
offset: $( "#offset" ).val(),
|
offset: $( "#offset" ).val(),
|
||||||
using: using,
|
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
|
||||||
collision: $( "#collision_horizontal" ).val() + ' ' + $( "#collision_vertical" ).val()
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$( ".positionable" ).css( "opacity", 0.5 );
|
$( ".positionable" ).css( "opacity", 0.5 );
|
||||||
|
|
||||||
$( ":input" ).bind( "click keyup change", function() { position(); });
|
$( ":input" ).bind( "click keyup change", position );
|
||||||
|
|
||||||
$( "#parent" ).draggable({
|
$( "#parent" ).draggable({
|
||||||
drag: function() { position(); }
|
drag: position
|
||||||
});
|
|
||||||
|
|
||||||
$( ".positionable" ).draggable({
|
|
||||||
drag: function( event, ui ) {
|
|
||||||
// reset offset before calculating it
|
|
||||||
$( "#offset" ).val( "0" );
|
|
||||||
position(function( result ) {
|
|
||||||
$( "#offset" ).val( "" + ( ui.offset.left - result.left ) +
|
|
||||||
" " + ( ui.offset.top - result.top ) );
|
|
||||||
position();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
position();
|
position();
|
||||||
@ -142,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="padding-bottom: 20px;">
|
<div style="padding-bottom: 20px;">
|
||||||
<b>offset:</b>
|
<b>offset:</b>
|
||||||
<input id="offset" type="text" size="15"/>
|
<input id="offset">
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-bottom: 20px;">
|
<div style="padding-bottom: 20px;">
|
||||||
<b>collision:</b>
|
<b>collision:</b>
|
||||||
|
152
grunt.js
152
grunt.js
@ -70,6 +70,8 @@ cssFiles.forEach(function( file ) {
|
|||||||
|
|
||||||
// csslint and cssmin tasks
|
// csslint and cssmin tasks
|
||||||
grunt.loadNpmTasks( "grunt-css" );
|
grunt.loadNpmTasks( "grunt-css" );
|
||||||
|
// file size comparison tasks
|
||||||
|
grunt.loadNpmTasks( "grunt-compare-size" );
|
||||||
|
|
||||||
grunt.registerHelper( "strip_all_banners", function( filepath ) {
|
grunt.registerHelper( "strip_all_banners", function( filepath ) {
|
||||||
return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" );
|
return grunt.file.read( filepath ).replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" );
|
||||||
@ -269,9 +271,8 @@ grunt.initConfig({
|
|||||||
// TODO remove items from this list once rewritten
|
// TODO remove items from this list once rewritten
|
||||||
return !( /(effects.core|mouse|datepicker|draggable|droppable|resizable|selectable|sortable)\.js$/ ).test( file );
|
return !( /(effects.core|mouse|datepicker|draggable|droppable|resizable|selectable|sortable)\.js$/ ).test( file );
|
||||||
}),
|
}),
|
||||||
grunt: "grunt.js"
|
grunt: "grunt.js",
|
||||||
// TODO enabled once fixed up
|
tests: "tests/unit/**/*.js"
|
||||||
// tests: "tests/unit/**/*.js"
|
|
||||||
},
|
},
|
||||||
csslint: {
|
csslint: {
|
||||||
// nothing: []
|
// nothing: []
|
||||||
@ -304,8 +305,7 @@ grunt.initConfig({
|
|||||||
smarttabs: true,
|
smarttabs: true,
|
||||||
// TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504
|
// TODO: use "faux strict mode" https://github.com/jshint/jshint/issues/504
|
||||||
// strict: true,
|
// strict: true,
|
||||||
// TODO: enable trailing
|
trailing: true,
|
||||||
// trailing: true,
|
|
||||||
undef: true
|
undef: true
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -342,15 +342,53 @@ grunt.initConfig({
|
|||||||
tests: {
|
tests: {
|
||||||
options: extend({
|
options: extend({
|
||||||
browser: true,
|
browser: true,
|
||||||
jquery: true
|
jquery: true,
|
||||||
|
// TODO: this is only for document.write() https://github.com/jshint/jshint/issues/519
|
||||||
|
evil: true
|
||||||
}, defaults ),
|
}, defaults ),
|
||||||
|
// TODO: don't create so many globals in tests
|
||||||
globals: {
|
globals: {
|
||||||
module: true,
|
addMonths: true,
|
||||||
test: true,
|
asyncTest: true,
|
||||||
ok: true,
|
container: true,
|
||||||
equal: true,
|
|
||||||
deepEqual: true,
|
deepEqual: true,
|
||||||
QUnit: true
|
d1: true,
|
||||||
|
d2: true,
|
||||||
|
dlg: true,
|
||||||
|
domEqual: true,
|
||||||
|
drag: true,
|
||||||
|
dragged: true,
|
||||||
|
el: true,
|
||||||
|
equal: true,
|
||||||
|
equalsDate: true,
|
||||||
|
expect: true,
|
||||||
|
Globalize: true,
|
||||||
|
heightAfter: true,
|
||||||
|
init: true,
|
||||||
|
isNotOpen: true,
|
||||||
|
isOpen: true,
|
||||||
|
modal: true,
|
||||||
|
module: true,
|
||||||
|
moved: true,
|
||||||
|
notEqual: true,
|
||||||
|
offsetAfter: true,
|
||||||
|
offsetBefore: true,
|
||||||
|
ok: true,
|
||||||
|
PROP_NAME: true,
|
||||||
|
QUnit: true,
|
||||||
|
restoreScroll: true,
|
||||||
|
shouldBeDroppable: true,
|
||||||
|
shouldmove: true,
|
||||||
|
shouldNotBeDroppable: true,
|
||||||
|
shouldnotmove: true,
|
||||||
|
shouldnotresize: true,
|
||||||
|
shouldresize: true,
|
||||||
|
start: true,
|
||||||
|
strictEqual: true,
|
||||||
|
stop: true,
|
||||||
|
test: true,
|
||||||
|
TestHelpers: true,
|
||||||
|
widthAfter: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -359,7 +397,16 @@ grunt.initConfig({
|
|||||||
|
|
||||||
grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() {
|
grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() {
|
||||||
function replaceVersion( source ) {
|
function replaceVersion( source ) {
|
||||||
return source.replace( "@VERSION", grunt.config( "pkg.version" ) );
|
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 ),
|
var files = grunt.file.expandFiles( this.file.src ),
|
||||||
target = this.file.dest + "/",
|
target = this.file.dest + "/",
|
||||||
@ -371,18 +418,12 @@ grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @
|
|||||||
}
|
}
|
||||||
files.forEach(function( fileName ) {
|
files.forEach(function( fileName ) {
|
||||||
var targetFile = strip ? fileName.replace( strip, "" ) : fileName;
|
var targetFile = strip ? fileName.replace( strip, "" ) : fileName;
|
||||||
if ( /(js|css)$/.test( fileName ) ) {
|
copyFile( fileName, target + targetFile );
|
||||||
grunt.file.copy( fileName, target + targetFile, {
|
|
||||||
process: replaceVersion
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
grunt.file.copy( fileName, target + targetFile );
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
grunt.log.writeln( "Copied " + files.length + " files." );
|
grunt.log.writeln( "Copied " + files.length + " files." );
|
||||||
for ( fileName in this.data.renames ) {
|
for ( fileName in this.data.renames ) {
|
||||||
renameCount += 1;
|
renameCount += 1;
|
||||||
grunt.file.copy( fileName, target + grunt.template.process( this.data.renames[ fileName ], grunt.config() ) );
|
copyFile( fileName, target + grunt.template.process( this.data.renames[ fileName ], grunt.config() ) );
|
||||||
}
|
}
|
||||||
if ( renameCount ) {
|
if ( renameCount ) {
|
||||||
grunt.log.writeln( "Renamed " + renameCount + " files." );
|
grunt.log.writeln( "Renamed " + renameCount + " files." );
|
||||||
@ -537,77 +578,6 @@ grunt.registerTask( "clean", function() {
|
|||||||
require( "rimraf" ).sync( "dist" );
|
require( "rimraf" ).sync( "dist" );
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO merge with code in jQuery Core, share as grunt plugin/npm
|
|
||||||
// this here actually uses the provided filenames in the output
|
|
||||||
// the helpers should just be regular functions, no need to share those with the world
|
|
||||||
grunt.registerMultiTask( "compare_size", "Compare size of this branch to master", function() {
|
|
||||||
var files = grunt.file.expandFiles( this.file.src ),
|
|
||||||
done = this.async(),
|
|
||||||
sizecache = __dirname + "/dist/.sizecache.json",
|
|
||||||
sources = {
|
|
||||||
min: grunt.file.read( files[1] ),
|
|
||||||
max: grunt.file.read( files[0] )
|
|
||||||
},
|
|
||||||
oldsizes = {},
|
|
||||||
sizes = {};
|
|
||||||
|
|
||||||
try {
|
|
||||||
oldsizes = JSON.parse( grunt.file.read( sizecache ) );
|
|
||||||
} catch( e ) {
|
|
||||||
oldsizes = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Obtain the current branch and continue...
|
|
||||||
grunt.helper( "git_current_branch", function( err, branch ) {
|
|
||||||
var key, diff;
|
|
||||||
|
|
||||||
// Derived and adapted from Corey Frang's original `sizer`
|
|
||||||
grunt.log.writeln( "sizes - compared to master" );
|
|
||||||
|
|
||||||
sizes[ files[0] ] = sources.max.length;
|
|
||||||
sizes[ files[1] ] = sources.min.length;
|
|
||||||
sizes[ files[1] + ".gz" ] = grunt.helper( "gzip", sources.min ).length;
|
|
||||||
|
|
||||||
for ( key in sizes ) {
|
|
||||||
diff = oldsizes[ key ] && ( sizes[ key ] - oldsizes[ key ] );
|
|
||||||
if ( diff > 0 ) {
|
|
||||||
diff = "+" + diff;
|
|
||||||
}
|
|
||||||
console.log( "%s %s %s",
|
|
||||||
grunt.helper("lpad", sizes[ key ], 8 ),
|
|
||||||
grunt.helper("lpad", diff ? "(" + diff + ")" : "(-)", 8 ),
|
|
||||||
key
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( branch === "master" ) {
|
|
||||||
// If master, write to file - this makes it easier to compare
|
|
||||||
// the size of your current code state to the master branch,
|
|
||||||
// without returning to the master to reset the cache
|
|
||||||
grunt.file.write( sizecache, JSON.stringify(sizes) );
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
grunt.registerHelper( "git_current_branch", function( done ) {
|
|
||||||
grunt.utils.spawn({
|
|
||||||
cmd: "git",
|
|
||||||
args: [ "branch", "--no-color" ]
|
|
||||||
}, function( err, result ) {
|
|
||||||
var branch;
|
|
||||||
|
|
||||||
result.split( "\n" ).forEach(function( branch ) {
|
|
||||||
var matches = /^\* (.*)/.exec( branch );
|
|
||||||
if ( matches !== null && matches.length && matches[ 1 ] ) {
|
|
||||||
done( null, matches[ 1 ] );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
grunt.registerHelper( "lpad", function( str, len, chr ) {
|
|
||||||
return ( Array( len + 1 ).join( chr || " " ) + str ).substr( -len );
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask( "default", "lint csslint qunit build compare_size" );
|
grunt.registerTask( "default", "lint csslint qunit build compare_size" );
|
||||||
grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" );
|
grunt.registerTask( "sizer", "concat:ui min:dist/jquery-ui.min.js compare_size" );
|
||||||
grunt.registerTask( "build", "concat min cssmin" );
|
grunt.registerTask( "build", "concat min cssmin" );
|
||||||
|
@ -26,8 +26,9 @@
|
|||||||
],
|
],
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "0.3.7",
|
"grunt": "0.3.9",
|
||||||
"grunt-css": "0.1.1",
|
"grunt-css": "0.1.1",
|
||||||
|
"grunt-compare-size": "0.1.1",
|
||||||
"request": "2.9.153",
|
"request": "2.9.153",
|
||||||
"rimraf": "2.0.1"
|
"rimraf": "2.0.1"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
module( "accordion: core", accordion_setupTeardown() );
|
var setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
|
module( "accordion: core", setupTeardown() );
|
||||||
|
|
||||||
$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( type, selector ) {
|
$.each( { div: "#list1", ul: "#navigation", dl: "#accordion-dl" }, function( type, selector ) {
|
||||||
test( "markup structure: " + type, function() {
|
test( "markup structure: " + type, function() {
|
||||||
@ -21,15 +24,15 @@ test( "handle click on header-descendant", function() {
|
|||||||
expect( 1 );
|
expect( 1 );
|
||||||
var element = $( "#navigation" ).accordion();
|
var element = $( "#navigation" ).accordion();
|
||||||
$( "#navigation h2:eq(1) a" ).click();
|
$( "#navigation h2:eq(1) a" ).click();
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "accessibility", function () {
|
test( "accessibility", function () {
|
||||||
expect( 37 );
|
expect( 37 );
|
||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: 1
|
active: 1
|
||||||
});
|
}),
|
||||||
var headers = element.find( ".ui-accordion-header" );
|
headers = element.find( ".ui-accordion-header" );
|
||||||
|
|
||||||
equal( element.attr( "role" ), "tablist", "element role" );
|
equal( element.attr( "role" ), "tablist", "element role" );
|
||||||
headers.each(function( i ) {
|
headers.each(function( i ) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "accordion", {
|
TestHelpers.commonWidgetTests( "accordion", {
|
||||||
defaults: {
|
defaults: {
|
||||||
active: 0,
|
active: 0,
|
||||||
animate: {},
|
animate: {},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "accordion", {
|
TestHelpers.commonWidgetTests( "accordion", {
|
||||||
defaults: {
|
defaults: {
|
||||||
active: 0,
|
active: 0,
|
||||||
animate: null,
|
animate: null,
|
||||||
|
@ -1,70 +1,74 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
module( "accordion (deprecated): expanded active option, activate method", accordion_setupTeardown() );
|
var equalHeights = TestHelpers.accordion.equalHeights,
|
||||||
|
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
|
module( "accordion (deprecated): expanded active option, activate method", setupTeardown() );
|
||||||
|
|
||||||
test( "activate, numeric", function() {
|
test( "activate, numeric", function() {
|
||||||
expect( 5 );
|
expect( 5 );
|
||||||
var element = $( "#list1" ).accordion({ active: 1 });
|
var element = $( "#list1" ).accordion({ active: 1 });
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
element.accordion( "activate", 2 );
|
element.accordion( "activate", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "activate", 0 );
|
element.accordion( "activate", 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.accordion( "activate", 1 );
|
element.accordion( "activate", 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
element.accordion( "activate", 2 );
|
element.accordion( "activate", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate, numeric, collapsible:true", function() {
|
test( "activate, numeric, collapsible:true", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#list1" ).accordion({ collapsible: true });
|
var element = $( "#list1" ).accordion({ collapsible: true });
|
||||||
element.accordion( "activate", 2 );
|
element.accordion( "activate", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "activate", 0 );
|
element.accordion( "activate", 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.accordion( "activate", -1 );
|
element.accordion( "activate", -1 );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate, boolean, collapsible: true", function() {
|
test( "activate, boolean, collapsible: true", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#list1" ).accordion({ collapsible: true });
|
var element = $( "#list1" ).accordion({ collapsible: true });
|
||||||
element.accordion( "activate", 2 );
|
element.accordion( "activate", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "activate", false );
|
element.accordion( "activate", false );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate, boolean, collapsible: false", function() {
|
test( "activate, boolean, collapsible: false", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#list1" ).accordion();
|
var element = $( "#list1" ).accordion();
|
||||||
element.accordion( "activate", 2 );
|
element.accordion( "activate", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "activate", false );
|
element.accordion( "activate", false );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate, string expression", function() {
|
test( "activate, string expression", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var element = $( "#list1" ).accordion({ active: "h3:last" });
|
var element = $( "#list1" ).accordion({ active: "h3:last" });
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "activate", ":first" );
|
element.accordion( "activate", ":first" );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.accordion( "activate", ":eq(1)" );
|
element.accordion( "activate", ":eq(1)" );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
element.accordion( "activate", ":last" );
|
element.accordion( "activate", ":last" );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate, jQuery or DOM element", function() {
|
test( "activate, jQuery or DOM element", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#list1" ).accordion({ active: $( "#list1 h3:last" ) });
|
var element = $( "#list1" ).accordion({ active: $( "#list1 h3:last" ) });
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "activate", $( "#list1 h3:first" ) );
|
element.accordion( "activate", $( "#list1 h3:first" ) );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.accordion( "activate", $( "#list1 h3" )[ 1 ] );
|
element.accordion( "activate", $( "#list1 h3" )[ 1 ] );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ active: Selector }", function() {
|
test( "{ active: Selector }", function() {
|
||||||
@ -72,9 +76,9 @@ test( "{ active: Selector }", function() {
|
|||||||
var element = $("#list1").accordion({
|
var element = $("#list1").accordion({
|
||||||
active: "h3:last"
|
active: "h3:last"
|
||||||
});
|
});
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "option", "active", "h3:eq(1)" );
|
element.accordion( "option", "active", "h3:eq(1)" );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ active: Element }", function() {
|
test( "{ active: Element }", function() {
|
||||||
@ -82,9 +86,9 @@ test( "{ active: Element }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: $( "#list1 h3:last" )[ 0 ]
|
active: $( "#list1 h3:last" )[ 0 ]
|
||||||
});
|
});
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "option", "active", $( "#list1 h3:eq(1)" )[ 0 ] );
|
element.accordion( "option", "active", $( "#list1 h3:eq(1)" )[ 0 ] );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ active: jQuery Object }", function() {
|
test( "{ active: jQuery Object }", function() {
|
||||||
@ -92,26 +96,26 @@ test( "{ active: jQuery Object }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: $( "#list1 h3:last" )
|
active: $( "#list1 h3:last" )
|
||||||
});
|
});
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.accordion( "option", "active", $( "#list1 h3:eq(1)" ) );
|
element.accordion( "option", "active", $( "#list1 h3:eq(1)" ) );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module( "accordion (deprecated) - height options", accordion_setupTeardown() );
|
module( "accordion (deprecated) - height options", setupTeardown() );
|
||||||
|
|
||||||
test( "{ autoHeight: true }, default", function() {
|
test( "{ autoHeight: true }, default", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
accordion_equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 );
|
equalHeights( $( "#navigation" ).accordion({ autoHeight: true }), 95, 130 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ autoHeight: false }", function() {
|
test( "{ autoHeight: false }", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#navigation" ).accordion({ autoHeight: false });
|
var element = $( "#navigation" ).accordion({ autoHeight: false }),
|
||||||
var sizes = [];
|
sizes = [];
|
||||||
element.find( ".ui-accordion-content" ).each(function() {
|
element.find( ".ui-accordion-content" ).each(function() {
|
||||||
sizes.push( $(this).height() );
|
sizes.push( $(this).height() );
|
||||||
});
|
});
|
||||||
@ -124,7 +128,7 @@ test( "{ fillSpace: true }", function() {
|
|||||||
expect( 3 );
|
expect( 3 );
|
||||||
$( "#navigationWrapper" ).height( 500 );
|
$( "#navigationWrapper" ).height( 500 );
|
||||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||||
accordion_equalHeights( element, 446, 458 );
|
equalHeights( element, 446, 458 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ fillSapce: true } with sibling", function() {
|
test( "{ fillSapce: true } with sibling", function() {
|
||||||
@ -138,7 +142,7 @@ test( "{ fillSapce: true } with sibling", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||||
accordion_equalHeights( element , 346, 358);
|
equalHeights( element , 346, 358);
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ fillSpace: true } with multiple siblings", function() {
|
test( "{ fillSpace: true } with multiple siblings", function() {
|
||||||
@ -167,14 +171,14 @@ test( "{ fillSpace: true } with multiple siblings", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
var element = $( "#navigation" ).accordion({ fillSpace: true });
|
||||||
accordion_equalHeights( element, 296, 308 );
|
equalHeights( element, 296, 308 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module( "accordion (deprecated) - icons", accordion_setupTeardown() );
|
module( "accordion (deprecated) - icons", setupTeardown() );
|
||||||
|
|
||||||
test( "icons, headerSelected", function() {
|
test( "icons, headerSelected", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
@ -191,7 +195,7 @@ test( "icons, headerSelected", function() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
module( "accordion (deprecated) - resize", accordion_setupTeardown() );
|
module( "accordion (deprecated) - resize", setupTeardown() );
|
||||||
|
|
||||||
test( "resize", function() {
|
test( "resize", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
@ -202,29 +206,29 @@ test( "resize", function() {
|
|||||||
.accordion({
|
.accordion({
|
||||||
heightStyle: "fill"
|
heightStyle: "fill"
|
||||||
});
|
});
|
||||||
accordion_equalHeights( element, 246, 258 );
|
equalHeights( element, 246, 258 );
|
||||||
|
|
||||||
element.parent().height( 500 );
|
element.parent().height( 500 );
|
||||||
element.accordion( "resize" );
|
element.accordion( "resize" );
|
||||||
accordion_equalHeights( element, 446, 458 );
|
equalHeights( element, 446, 458 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module( "accordion (deprecated) - navigation", accordion_setupTeardown() );
|
module( "accordion (deprecated) - navigation", setupTeardown() );
|
||||||
|
|
||||||
test( "{ navigation: true, navigationFilter: header }", function() {
|
test( "{ navigation: true, navigationFilter: header }", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#navigation" ).accordion({
|
var element = $( "#navigation" ).accordion({
|
||||||
navigation: true,
|
navigation: true,
|
||||||
navigationFilter: function() {
|
navigationFilter: function() {
|
||||||
return /\?p=1\.1\.3$/.test( this.href );
|
return (/\?p=1\.1\.3$/).test( this.href );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
equal( element.accordion( "option", "active" ), 2 );
|
equal( element.accordion( "option", "active" ), 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ navigation: true, navigationFilter: content }", function() {
|
test( "{ navigation: true, navigationFilter: content }", function() {
|
||||||
@ -232,27 +236,27 @@ test( "{ navigation: true, navigationFilter: content }", function() {
|
|||||||
var element = $( "#navigation" ).accordion({
|
var element = $( "#navigation" ).accordion({
|
||||||
navigation: true,
|
navigation: true,
|
||||||
navigationFilter: function() {
|
navigationFilter: function() {
|
||||||
return /\?p=1\.1\.3\.2$/.test( this.href );
|
return (/\?p=1\.1\.3\.2$/).test( this.href );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
equal( element.accordion( "option", "active" ), 2 );
|
equal( element.accordion( "option", "active" ), 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module( "accordion (deprecated) - changestart/change events", accordion_setupTeardown() );
|
module( "accordion (deprecated) - changestart/change events", setupTeardown() );
|
||||||
|
|
||||||
test( "changestart", function() {
|
test( "changestart", function() {
|
||||||
expect( 26 );
|
expect( 26 );
|
||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: false,
|
active: false,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
}),
|
||||||
var headers = element.find( ".ui-accordion-header" );
|
headers = element.find( ".ui-accordion-header" ),
|
||||||
var content = element.find( ".ui-accordion-content" );
|
content = element.find( ".ui-accordion-content" );
|
||||||
|
|
||||||
element.one( "accordionchangestart", function( event, ui ) {
|
element.one( "accordionchangestart", function( event, ui ) {
|
||||||
equal( ui.oldHeader.size(), 0 );
|
equal( ui.oldHeader.size(), 0 );
|
||||||
@ -261,10 +265,10 @@ test( "changestart", function() {
|
|||||||
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
|
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
|
||||||
equal( ui.newContent.size(), 1 );
|
equal( ui.newContent.size(), 1 );
|
||||||
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
|
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.accordion( "option", "active", 0 );
|
element.accordion( "option", "active", 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.one( "accordionchangestart", function( event, ui ) {
|
element.one( "accordionchangestart", function( event, ui ) {
|
||||||
equal( ui.oldHeader.size(), 1 );
|
equal( ui.oldHeader.size(), 1 );
|
||||||
@ -275,10 +279,10 @@ test( "changestart", function() {
|
|||||||
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
|
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
|
||||||
equal( ui.newContent.size(), 1 );
|
equal( ui.newContent.size(), 1 );
|
||||||
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
|
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
headers.eq( 1 ).click();
|
headers.eq( 1 ).click();
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.one( "accordionchangestart", function( event, ui ) {
|
element.one( "accordionchangestart", function( event, ui ) {
|
||||||
equal( ui.oldHeader.size(), 1 );
|
equal( ui.oldHeader.size(), 1 );
|
||||||
@ -287,10 +291,10 @@ test( "changestart", function() {
|
|||||||
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
|
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
|
||||||
equal( ui.newHeader.size(), 0 );
|
equal( ui.newHeader.size(), 0 );
|
||||||
equal( ui.newContent.size(), 0 );
|
equal( ui.newContent.size(), 0 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
element.accordion( "option", "active", false );
|
element.accordion( "option", "active", false );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "change", function() {
|
test( "change", function() {
|
||||||
@ -298,9 +302,9 @@ test( "change", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: false,
|
active: false,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
}),
|
||||||
var headers = element.find( ".ui-accordion-header" );
|
headers = element.find( ".ui-accordion-header" ),
|
||||||
var content = element.find( ".ui-accordion-content" );
|
content = element.find( ".ui-accordion-content" );
|
||||||
|
|
||||||
element.one( "accordionchange", function( event, ui ) {
|
element.one( "accordionchange", function( event, ui ) {
|
||||||
equal( ui.oldHeader.size(), 0 );
|
equal( ui.oldHeader.size(), 0 );
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
module( "accordion: events", accordion_setupTeardown() );
|
var setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
|
module( "accordion: events", setupTeardown() );
|
||||||
|
|
||||||
test( "create", function() {
|
test( "create", function() {
|
||||||
expect( 10 );
|
expect( 10 );
|
||||||
@ -46,9 +49,9 @@ test( "beforeActivate", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: false,
|
active: false,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
}),
|
||||||
var headers = element.find( ".ui-accordion-header" );
|
headers = element.find( ".ui-accordion-header" ),
|
||||||
var content = element.find( ".ui-accordion-content" );
|
content = element.find( ".ui-accordion-content" );
|
||||||
|
|
||||||
element.one( "accordionbeforeactivate", function( event, ui ) {
|
element.one( "accordionbeforeactivate", function( event, ui ) {
|
||||||
ok( !( "originalEvent" in event ) );
|
ok( !( "originalEvent" in event ) );
|
||||||
@ -58,10 +61,10 @@ test( "beforeActivate", function() {
|
|||||||
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
|
strictEqual( ui.newHeader[ 0 ], headers[ 0 ] );
|
||||||
equal( ui.newContent.size(), 1 );
|
equal( ui.newContent.size(), 1 );
|
||||||
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
|
strictEqual( ui.newContent[ 0 ], content[ 0 ] );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.accordion( "option", "active", 0 );
|
element.accordion( "option", "active", 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.one( "accordionbeforeactivate", function( event, ui ) {
|
element.one( "accordionbeforeactivate", function( event, ui ) {
|
||||||
equal( event.originalEvent.type, "click" );
|
equal( event.originalEvent.type, "click" );
|
||||||
@ -73,10 +76,10 @@ test( "beforeActivate", function() {
|
|||||||
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
|
strictEqual( ui.newHeader[ 0 ], headers[ 1 ] );
|
||||||
equal( ui.newContent.size(), 1 );
|
equal( ui.newContent.size(), 1 );
|
||||||
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
|
strictEqual( ui.newContent[ 0 ], content[ 1 ] );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
headers.eq( 1 ).click();
|
headers.eq( 1 ).click();
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.one( "accordionbeforeactivate", function( event, ui ) {
|
element.one( "accordionbeforeactivate", function( event, ui ) {
|
||||||
ok( !( "originalEvent" in event ) );
|
ok( !( "originalEvent" in event ) );
|
||||||
@ -86,10 +89,10 @@ test( "beforeActivate", function() {
|
|||||||
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
|
strictEqual( ui.oldContent[ 0 ], content[ 1 ] );
|
||||||
equal( ui.newHeader.size(), 0 );
|
equal( ui.newHeader.size(), 0 );
|
||||||
equal( ui.newContent.size(), 0 );
|
equal( ui.newContent.size(), 0 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
element.accordion( "option", "active", false );
|
element.accordion( "option", "active", false );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
|
|
||||||
element.one( "accordionbeforeactivate", function( event, ui ) {
|
element.one( "accordionbeforeactivate", function( event, ui ) {
|
||||||
ok( !( "originalEvent" in event ) );
|
ok( !( "originalEvent" in event ) );
|
||||||
@ -100,10 +103,10 @@ test( "beforeActivate", function() {
|
|||||||
equal( ui.newContent.size(), 1 );
|
equal( ui.newContent.size(), 1 );
|
||||||
strictEqual( ui.newContent[ 0 ], content[ 2 ] );
|
strictEqual( ui.newContent[ 0 ], content[ 2 ] );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.accordion( "option", "active", 2 );
|
element.accordion( "option", "active", 2 );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate", function() {
|
test( "activate", function() {
|
||||||
@ -111,9 +114,9 @@ test( "activate", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
active: false,
|
active: false,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
}),
|
||||||
var headers = element.find( ".ui-accordion-header" );
|
headers = element.find( ".ui-accordion-header" ),
|
||||||
var content = element.find( ".ui-accordion-content" );
|
content = element.find( ".ui-accordion-content" );
|
||||||
|
|
||||||
element.one( "accordionactivate", function( event, ui ) {
|
element.one( "accordionactivate", function( event, ui ) {
|
||||||
equal( ui.oldHeader.size(), 0 );
|
equal( ui.oldHeader.size(), 0 );
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
module( "accordion: methods", accordion_setupTeardown() );
|
var equalHeights = TestHelpers.accordion.equalHeights,
|
||||||
|
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
|
module( "accordion: methods", setupTeardown() );
|
||||||
|
|
||||||
test( "destroy", function() {
|
test( "destroy", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
@ -12,17 +16,17 @@ test( "destroy", function() {
|
|||||||
test( "enable/disable", function() {
|
test( "enable/disable", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var element = $( "#list1" ).accordion();
|
var element = $( "#list1" ).accordion();
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.accordion( "disable" );
|
element.accordion( "disable" );
|
||||||
// event does nothing
|
// event does nothing
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" );
|
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "click" );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
// option still works
|
// option still works
|
||||||
element.accordion( "option", "active", 1 );
|
element.accordion( "option", "active", 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
element.accordion( "enable" );
|
element.accordion( "enable" );
|
||||||
element.accordion( "option", "active", 2 );
|
element.accordion( "option", "active", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "refresh", function() {
|
test( "refresh", function() {
|
||||||
@ -34,11 +38,11 @@ test( "refresh", function() {
|
|||||||
.accordion({
|
.accordion({
|
||||||
heightStyle: "fill"
|
heightStyle: "fill"
|
||||||
});
|
});
|
||||||
accordion_equalHeights( element, 246, 258 );
|
equalHeights( element, 246, 258 );
|
||||||
|
|
||||||
element.parent().height( 500 );
|
element.parent().height( 500 );
|
||||||
element.accordion( "refresh" );
|
element.accordion( "refresh" );
|
||||||
accordion_equalHeights( element, 446, 458 );
|
equalHeights( element, 446, 458 );
|
||||||
});
|
});
|
||||||
|
|
||||||
}( jQuery ) );
|
}( jQuery ) );
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
module( "accordion: options", accordion_setupTeardown() );
|
var equalHeights = TestHelpers.accordion.equalHeights,
|
||||||
|
setupTeardown = TestHelpers.accordion.setupTeardown,
|
||||||
|
state = TestHelpers.accordion.state;
|
||||||
|
|
||||||
|
module( "accordion: options", setupTeardown() );
|
||||||
|
|
||||||
test( "{ active: default }", function() {
|
test( "{ active: default }", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#list1" ).accordion();
|
var element = $( "#list1" ).accordion();
|
||||||
equal( element.accordion( "option", "active" ), 0 );
|
equal( element.accordion( "option", "active" ), 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ active: false }", function() {
|
test( "{ active: false }", function() {
|
||||||
@ -15,19 +19,19 @@ test( "{ active: false }", function() {
|
|||||||
active: false,
|
active: false,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
});
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
equal( element.find( ".ui-accordion-header.ui-state-active" ).size(), 0, "no headers selected" );
|
equal( element.find( ".ui-accordion-header.ui-state-active" ).size(), 0, "no headers selected" );
|
||||||
equal( element.accordion( "option", "active" ), false );
|
equal( element.accordion( "option", "active" ), false );
|
||||||
|
|
||||||
element.accordion( "option", "collapsible", false );
|
element.accordion( "option", "collapsible", false );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
equal( element.accordion( "option", "active" ), 0 );
|
equal( element.accordion( "option", "active" ), 0 );
|
||||||
|
|
||||||
element.accordion( "destroy" );
|
element.accordion( "destroy" );
|
||||||
element.accordion({
|
element.accordion({
|
||||||
active: false
|
active: false
|
||||||
});
|
});
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
strictEqual( element.accordion( "option", "active" ), 0 );
|
strictEqual( element.accordion( "option", "active" ), 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -37,19 +41,19 @@ test( "{ active: Number }", function() {
|
|||||||
active: 2
|
active: 2
|
||||||
});
|
});
|
||||||
equal( element.accordion( "option", "active" ), 2 );
|
equal( element.accordion( "option", "active" ), 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.accordion( "option", "active", 0 );
|
element.accordion( "option", "active", 0 );
|
||||||
equal( element.accordion( "option", "active" ), 0 );
|
equal( element.accordion( "option", "active" ), 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).click();
|
element.find( ".ui-accordion-header" ).eq( 1 ).click();
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.accordion( "option", "active", 10 );
|
element.accordion( "option", "active", 10 );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( $.uiBackCompat === false ) {
|
if ( $.uiBackCompat === false ) {
|
||||||
@ -59,19 +63,19 @@ if ( $.uiBackCompat === false ) {
|
|||||||
active: -1
|
active: -1
|
||||||
});
|
});
|
||||||
equal( element.accordion( "option", "active" ), 2 );
|
equal( element.accordion( "option", "active" ), 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.accordion( "option", "active", -2 );
|
element.accordion( "option", "active", -2 );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.accordion( "option", "active", -10 );
|
element.accordion( "option", "active", -10 );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.accordion( "option", "active", -3 );
|
element.accordion( "option", "active", -3 );
|
||||||
equal( element.accordion( "option", "active" ), 0 );
|
equal( element.accordion( "option", "active" ), 0 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +84,7 @@ test( "{ animate: false }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
animate: false
|
animate: false
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
$.fn.animate = function() {
|
$.fn.animate = function() {
|
||||||
ok( false, ".animate() called" );
|
ok( false, ".animate() called" );
|
||||||
@ -98,7 +102,7 @@ asyncTest( "{ animate: Number }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
animate: 100
|
animate: 100
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
// called twice (both panels)
|
// called twice (both panels)
|
||||||
$.fn.animate = function( props, duration, easing ) {
|
$.fn.animate = function( props, duration, easing ) {
|
||||||
@ -122,7 +126,7 @@ asyncTest( "{ animate: String }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
animate: "linear"
|
animate: "linear"
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
// called twice (both panels)
|
// called twice (both panels)
|
||||||
$.fn.animate = function( props, duration, easing ) {
|
$.fn.animate = function( props, duration, easing ) {
|
||||||
@ -146,7 +150,7 @@ asyncTest( "{ animate: {} }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
animate: {}
|
animate: {}
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
// called twice (both panels)
|
// called twice (both panels)
|
||||||
$.fn.animate = function( props, duration, easing ) {
|
$.fn.animate = function( props, duration, easing ) {
|
||||||
@ -170,7 +174,7 @@ asyncTest( "{ animate: { duration, easing } }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
animate: { duration: 100, easing: "linear" }
|
animate: { duration: 100, easing: "linear" }
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
// called twice (both panels)
|
// called twice (both panels)
|
||||||
$.fn.animate = function( props, duration, easing ) {
|
$.fn.animate = function( props, duration, easing ) {
|
||||||
@ -195,7 +199,7 @@ asyncTest( "{ animate: { duration, easing } }, animate down", function() {
|
|||||||
active: 1,
|
active: 1,
|
||||||
animate: { duration: 100, easing: "linear" }
|
animate: { duration: 100, easing: "linear" }
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
// called twice (both panels)
|
// called twice (both panels)
|
||||||
$.fn.animate = function( props, duration, easing ) {
|
$.fn.animate = function( props, duration, easing ) {
|
||||||
@ -226,7 +230,7 @@ asyncTest( "{ animate: { duration, easing, down } }, animate down", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
panels = element.find( ".ui-accordion-content" );
|
panels = element.find( ".ui-accordion-content" ),
|
||||||
animate = $.fn.animate;
|
animate = $.fn.animate;
|
||||||
// called twice (both panels)
|
// called twice (both panels)
|
||||||
$.fn.animate = function( props, duration, easing ) {
|
$.fn.animate = function( props, duration, easing ) {
|
||||||
@ -252,11 +256,11 @@ test( "{ collapsible: false }", function() {
|
|||||||
});
|
});
|
||||||
element.accordion( "option", "active", false );
|
element.accordion( "option", "active", false );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).click();
|
element.find( ".ui-accordion-header" ).eq( 1 ).click();
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ collapsible: true }", function() {
|
test( "{ collapsible: true }", function() {
|
||||||
@ -268,15 +272,15 @@ test( "{ collapsible: true }", function() {
|
|||||||
|
|
||||||
element.accordion( "option", "active", false );
|
element.accordion( "option", "active", false );
|
||||||
equal( element.accordion( "option", "active" ), false );
|
equal( element.accordion( "option", "active" ), false );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
|
|
||||||
element.accordion( "option", "active", 1 );
|
element.accordion( "option", "active", 1 );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).click();
|
element.find( ".ui-accordion-header" ).eq( 1 ).click();
|
||||||
equal( element.accordion( "option", "active" ), false );
|
equal( element.accordion( "option", "active" ), false );
|
||||||
accordion_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ event: null }", function() {
|
test( "{ event: null }", function() {
|
||||||
@ -284,16 +288,16 @@ test( "{ event: null }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
event: null
|
event: null
|
||||||
});
|
});
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.accordion( "option", "active", 1 );
|
element.accordion( "option", "active", 1 );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// ensure default click handler isn't bound
|
// ensure default click handler isn't bound
|
||||||
element.find( ".ui-accordion-header" ).eq( 2 ).click();
|
element.find( ".ui-accordion-header" ).eq( 2 ).click();
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ event: custom }", function() {
|
test( "{ event: custom }", function() {
|
||||||
@ -301,20 +305,20 @@ test( "{ event: custom }", function() {
|
|||||||
var element = $( "#list1" ).accordion({
|
var element = $( "#list1" ).accordion({
|
||||||
event: "custom1 custom2"
|
event: "custom1 custom2"
|
||||||
});
|
});
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" );
|
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// ensure default click handler isn't bound
|
// ensure default click handler isn't bound
|
||||||
element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "click" );
|
element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "click" );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "custom2" );
|
element.find( ".ui-accordion-header" ).eq( 2 ).trigger( "custom2" );
|
||||||
equal( element.accordion( "option", "active" ), 2 );
|
equal( element.accordion( "option", "active" ), 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.accordion( "option", "event", "custom3" );
|
element.accordion( "option", "event", "custom3" );
|
||||||
|
|
||||||
@ -322,20 +326,20 @@ test( "{ event: custom }", function() {
|
|||||||
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" );
|
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom1" );
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom2" );
|
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom2" );
|
||||||
equal( element.accordion( "option", "active" ), 2 );
|
equal( element.accordion( "option", "active" ), 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom3" );
|
element.find( ".ui-accordion-header" ).eq( 1 ).trigger( "custom3" );
|
||||||
equal( element.accordion( "option", "active" ), 1 );
|
equal( element.accordion( "option", "active" ), 1 );
|
||||||
accordion_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ header: default }", function() {
|
test( "{ header: default }", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
// default: > li > :first-child,> :not(li):even
|
// default: > li > :first-child,> :not(li):even
|
||||||
// > :not(li):even
|
// > :not(li):even
|
||||||
accordion_state( $( "#list1" ).accordion(), 1, 0, 0);
|
state( $( "#list1" ).accordion(), 1, 0, 0);
|
||||||
// > li > :first-child
|
// > li > :first-child
|
||||||
accordion_state( $( "#navigation" ).accordion(), 1, 0, 0);
|
state( $( "#navigation" ).accordion(), 1, 0, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ header: custom }", function() {
|
test( "{ header: custom }", function() {
|
||||||
@ -347,21 +351,21 @@ test( "{ header: custom }", function() {
|
|||||||
ok( $( this ).hasClass( "ui-accordion-header" ) );
|
ok( $( this ).hasClass( "ui-accordion-header" ) );
|
||||||
});
|
});
|
||||||
equal( element.find( ".ui-accordion-header" ).length, 3 );
|
equal( element.find( ".ui-accordion-header" ).length, 3 );
|
||||||
accordion_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.accordion( "option", "active", 2 );
|
element.accordion( "option", "active", 2 );
|
||||||
accordion_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'auto' }", function() {
|
test( "{ heightStyle: 'auto' }", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "auto" });
|
||||||
accordion_equalHeights( element, 95, 130 );
|
equalHeights( element, 95, 130 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'content' }", function() {
|
test( "{ heightStyle: 'content' }", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "content" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "content" }),
|
||||||
var sizes = element.find( ".ui-accordion-content" ).map(function() {
|
sizes = element.find( ".ui-accordion-content" ).map(function() {
|
||||||
return $( this ).height();
|
return $( this ).height();
|
||||||
}).get();
|
}).get();
|
||||||
ok( sizes[ 0 ] >= 70 && sizes[ 0 ] <= 105, "was " + sizes[ 0 ] );
|
ok( sizes[ 0 ] >= 70 && sizes[ 0 ] <= 105, "was " + sizes[ 0 ] );
|
||||||
@ -373,7 +377,7 @@ test( "{ heightStyle: 'fill' }", function() {
|
|||||||
expect( 3 );
|
expect( 3 );
|
||||||
$( "#navigationWrapper" ).height( 500 );
|
$( "#navigationWrapper" ).height( 500 );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||||
accordion_equalHeights( element, 446, 458 );
|
equalHeights( element, 446, 458 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'fill' } with sibling", function() {
|
test( "{ heightStyle: 'fill' } with sibling", function() {
|
||||||
@ -387,7 +391,7 @@ test( "{ heightStyle: 'fill' } with sibling", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||||
accordion_equalHeights( element , 346, 358);
|
equalHeights( element , 346, 358);
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
||||||
@ -416,7 +420,7 @@ test( "{ heightStyle: 'fill' } with multiple siblings", function() {
|
|||||||
})
|
})
|
||||||
.prependTo( "#navigationWrapper" );
|
.prependTo( "#navigationWrapper" );
|
||||||
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
var element = $( "#navigation" ).accordion({ heightStyle: "fill" });
|
||||||
accordion_equalHeights( element, 296, 308 );
|
equalHeights( element, 296, 308 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ icons: false }", function() {
|
test( "{ icons: false }", function() {
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
function accordion_state( accordion ) {
|
TestHelpers.accordion = {
|
||||||
var expected = $.makeArray( arguments ).slice( 1 );
|
equalHeights: function( accordion, min, max ) {
|
||||||
var actual = accordion.find( ".ui-accordion-content" ).map(function() {
|
|
||||||
return $( this ).css( "display" ) === "none" ? 0 : 1;
|
|
||||||
}).get();
|
|
||||||
QUnit.push( QUnit.equiv(actual, expected), actual, expected );
|
|
||||||
}
|
|
||||||
|
|
||||||
function accordion_equalHeights( accordion, min, max ) {
|
|
||||||
var sizes = [];
|
var sizes = [];
|
||||||
accordion.find( ".ui-accordion-content" ).each(function() {
|
accordion.find( ".ui-accordion-content" ).each(function() {
|
||||||
sizes.push( $( this ).outerHeight() );
|
sizes.push( $( this ).outerHeight() );
|
||||||
@ -15,9 +8,9 @@ function accordion_equalHeights( accordion, min, max ) {
|
|||||||
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
|
"must be within " + min + " and " + max + ", was " + sizes[ 0 ] );
|
||||||
deepEqual( sizes[ 0 ], sizes[ 1 ] );
|
deepEqual( sizes[ 0 ], sizes[ 1 ] );
|
||||||
deepEqual( sizes[ 0 ], sizes[ 2 ] );
|
deepEqual( sizes[ 0 ], sizes[ 2 ] );
|
||||||
}
|
},
|
||||||
|
|
||||||
function accordion_setupTeardown() {
|
setupTeardown: function() {
|
||||||
var animate = $.ui.accordion.prototype.options.animate;
|
var animate = $.ui.accordion.prototype.options.animate;
|
||||||
return {
|
return {
|
||||||
setup: function() {
|
setup: function() {
|
||||||
@ -27,4 +20,13 @@ function accordion_setupTeardown() {
|
|||||||
$.ui.accordion.prototype.options.animate = animate;
|
$.ui.accordion.prototype.options.animate = animate;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
|
state: function( accordion ) {
|
||||||
|
var expected = $.makeArray( arguments ).slice( 1 ),
|
||||||
|
actual = accordion.find( ".ui-accordion-content" ).map(function() {
|
||||||
|
return $( this ).css( "display" ) === "none" ? 0 : 1;
|
||||||
|
}).get();
|
||||||
|
QUnit.push( QUnit.equiv(actual, expected), actual, expected );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "autocomplete", {
|
TestHelpers.commonWidgetTests( "autocomplete", {
|
||||||
defaults: {
|
defaults: {
|
||||||
appendTo: "body",
|
appendTo: "body",
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
|
@ -123,7 +123,7 @@ asyncTest( "cancel search", function() {
|
|||||||
|
|
||||||
asyncTest( "cancel focus", function() {
|
asyncTest( "cancel focus", function() {
|
||||||
expect( 1 );
|
expect( 1 );
|
||||||
var customVal = "custom value";
|
var customVal = "custom value",
|
||||||
element = $( "#autocomplete" ).autocomplete({
|
element = $( "#autocomplete" ).autocomplete({
|
||||||
delay: 0,
|
delay: 0,
|
||||||
source: data,
|
source: data,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
module("button: core");
|
module("button: core");
|
||||||
|
|
||||||
test("checkbox", function() {
|
test("checkbox", function() {
|
||||||
var input = $("#check");
|
var input = $("#check"),
|
||||||
label = $("label[for=check]");
|
label = $("label[for=check]");
|
||||||
ok( input.is(":visible") );
|
ok( input.is(":visible") );
|
||||||
ok( label.is(":not(.ui-button)") );
|
ok( label.is(":not(.ui-button)") );
|
||||||
@ -18,7 +18,7 @@ test("checkbox", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("radios", function() {
|
test("radios", function() {
|
||||||
var inputs = $("#radio0 input");
|
var inputs = $("#radio0 input"),
|
||||||
labels = $("#radio0 label");
|
labels = $("#radio0 label");
|
||||||
ok( inputs.is(":visible") );
|
ok( inputs.is(":visible") );
|
||||||
ok( labels.is(":not(.ui-button)") );
|
ok( labels.is(":not(.ui-button)") );
|
||||||
@ -51,7 +51,7 @@ test("radio groups", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("input type submit, don't create child elements", function() {
|
test("input type submit, don't create child elements", function() {
|
||||||
var input = $("#submit")
|
var input = $("#submit");
|
||||||
deepEqual( input.children().length, 0 );
|
deepEqual( input.children().length, 0 );
|
||||||
input.button();
|
input.button();
|
||||||
deepEqual( input.children().length, 0 );
|
deepEqual( input.children().length, 0 );
|
||||||
@ -68,11 +68,12 @@ test("buttonset", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("buttonset (rtl)", function() {
|
test("buttonset (rtl)", function() {
|
||||||
var parent = $("#radio1").parent();
|
var set,
|
||||||
|
parent = $("#radio1").parent();
|
||||||
// Set to rtl
|
// Set to rtl
|
||||||
parent.attr("dir", "rtl");
|
parent.attr("dir", "rtl");
|
||||||
|
|
||||||
var set = $("#radio1").buttonset();
|
set = $("#radio1").buttonset();
|
||||||
ok( set.is(".ui-buttonset") );
|
ok( set.is(".ui-buttonset") );
|
||||||
deepEqual( set.children(".ui-button").length, 3 );
|
deepEqual( set.children(".ui-button").length, 3 );
|
||||||
deepEqual( set.children("input:radio.ui-helper-hidden-accessible").length, 3 );
|
deepEqual( set.children("input:radio.ui-helper-hidden-accessible").length, 3 );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "button", {
|
TestHelpers.commonWidgetTests( "button", {
|
||||||
defaults: {
|
defaults: {
|
||||||
disabled: null,
|
disabled: null,
|
||||||
icons: {
|
icons: {
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
module("button: methods");
|
module("button: methods");
|
||||||
|
|
||||||
test("destroy", function() {
|
test("destroy", function() {
|
||||||
var beforeHtml = $("#button").parent().html();
|
var beforeHtml = $("#button").parent().html(),
|
||||||
var afterHtml = $("#button").button().button("destroy").parent().html();
|
afterHtml = $("#button").button().button("destroy").parent().html();
|
||||||
// Opera 9 outputs role="" instead of removing the attribute like everyone else
|
// Opera 9 outputs role="" instead of removing the attribute like everyone else
|
||||||
if ($.browser.opera) {
|
if ($.browser.opera) {
|
||||||
afterHtml = afterHtml.replace(/ role=""/g, "");
|
afterHtml = afterHtml.replace(/ role=""/g, "");
|
||||||
|
@ -53,52 +53,52 @@ test("widget method", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('baseStructure', function() {
|
test('baseStructure', function() {
|
||||||
var inp = init('#inp');
|
var header, title, table, thead, week, panel, inl, child,
|
||||||
inp.focus();
|
inp = init('#inp').focus(),
|
||||||
var dp = $('#ui-datepicker-div');
|
dp = $('#ui-datepicker-div'),
|
||||||
var iframe = ($.browser.msie && parseInt($.browser.version) < 7);
|
iframe = ($.browser.msie && parseInt($.browser.version, 10) < 7);
|
||||||
ok(dp.is(':visible'), 'Structure - datepicker visible');
|
ok(dp.is(':visible'), 'Structure - datepicker visible');
|
||||||
ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left');
|
ok(!dp.is('.ui-datepicker-rtl'), 'Structure - not right-to-left');
|
||||||
ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month');
|
ok(!dp.is('.ui-datepicker-multi'), 'Structure - not multi-month');
|
||||||
equal(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count');
|
equal(dp.children().length, 2 + (iframe ? 1 : 0), 'Structure - child count');
|
||||||
|
|
||||||
var header = dp.children(':first');
|
header = dp.children(':first');
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
|
ok(header.is('div.ui-datepicker-header'), 'Structure - header division');
|
||||||
equal(header.children().length, 3, 'Structure - header child count');
|
equal(header.children().length, 3, 'Structure - header child count');
|
||||||
ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() != '', 'Structure - prev link');
|
ok(header.children(':first').is('a.ui-datepicker-prev') && header.children(':first').html() !== '', 'Structure - prev link');
|
||||||
ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() != '', 'Structure - next link');
|
ok(header.children(':eq(1)').is('a.ui-datepicker-next') && header.children(':eq(1)').html() !== '', 'Structure - next link');
|
||||||
|
|
||||||
var title = header.children(':last');
|
title = header.children(':last');
|
||||||
ok(title.is('div.ui-datepicker-title') && title.html() != '','Structure - title division');
|
ok(title.is('div.ui-datepicker-title') && title.html() !== '','Structure - title division');
|
||||||
equal(title.children().length, 2, 'Structure - title child count');
|
equal(title.children().length, 2, 'Structure - title child count');
|
||||||
ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() != '', 'Structure - month text')
|
ok(title.children(':first').is('span.ui-datepicker-month') && title.children(':first').text() !== '', 'Structure - month text');
|
||||||
ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() != '', 'Structure - year text')
|
ok(title.children(':last').is('span.ui-datepicker-year') && title.children(':last').text() !== '', 'Structure - year text');
|
||||||
|
|
||||||
var table = dp.children(':eq(1)');
|
table = dp.children(':eq(1)');
|
||||||
ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table');
|
ok(table.is('table.ui-datepicker-calendar'), 'Structure - month table');
|
||||||
ok(table.children(':first').is('thead'), 'Structure - month table thead');
|
ok(table.children(':first').is('thead'), 'Structure - month table thead');
|
||||||
var thead = table.children(':first').children(':first');
|
thead = table.children(':first').children(':first');
|
||||||
ok(thead.is('tr'), 'Structure - month table title row');
|
ok(thead.is('tr'), 'Structure - month table title row');
|
||||||
equal(thead.find('th').length, 7, 'Structure - month table title cells');
|
equal(thead.find('th').length, 7, 'Structure - month table title cells');
|
||||||
ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body');
|
ok(table.children(':eq(1)').is('tbody'), 'Structure - month table body');
|
||||||
ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count');
|
ok(table.children(':eq(1)').children('tr').length >= 4, 'Structure - month table week count');
|
||||||
var week = table.children(':eq(1)').children(':first');
|
week = table.children(':eq(1)').children(':first');
|
||||||
ok(week.is('tr'), 'Structure - month table week row');
|
ok(week.is('tr'), 'Structure - month table week row');
|
||||||
equal(week.children().length, 7, 'Structure - week child count');
|
equal(week.children().length, 7, 'Structure - week child count');
|
||||||
ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell');
|
ok(week.children(':first').is('td.ui-datepicker-week-end'), 'Structure - month table first day cell');
|
||||||
ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell');
|
ok(week.children(':last').is('td.ui-datepicker-week-end'), 'Structure - month table second day cell');
|
||||||
ok(dp.children('iframe').length == (iframe ? 1 : 0), 'Structure - iframe');
|
ok(dp.children('iframe').length === (iframe ? 1 : 0), 'Structure - iframe');
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker('hide').datepicker('destroy');
|
||||||
|
|
||||||
// Editable month/year and button panel
|
// Editable month/year and button panel
|
||||||
inp = init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
|
inp = init('#inp', {changeMonth: true, changeYear: true, showButtonPanel: true});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
|
|
||||||
var title = dp.find('div.ui-datepicker-title');
|
title = dp.find('div.ui-datepicker-title');
|
||||||
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector');
|
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure - month selector');
|
||||||
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector');
|
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure - year selector');
|
||||||
|
|
||||||
var panel = dp.children(':last');
|
panel = dp.children(':last');
|
||||||
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
|
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure - button panel division');
|
||||||
equal(panel.children().length, 2, 'Structure - button panel child count');
|
equal(panel.children().length, 2, 'Structure - button panel child count');
|
||||||
ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button');
|
ok(panel.children(':first').is('button.ui-datepicker-current'), 'Structure - today button');
|
||||||
@ -110,7 +110,7 @@ test('baseStructure', function() {
|
|||||||
inp.focus();
|
inp.focus();
|
||||||
ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
|
ok(dp.is('.ui-datepicker-multi'), 'Structure multi [2] - multi-month');
|
||||||
equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count');
|
equal(dp.children().length, 3 + (iframe ? 1 : 0), 'Structure multi [2] - child count');
|
||||||
var child = dp.children(':first');
|
child = dp.children(':first');
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division');
|
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-first'), 'Structure multi [2] - first month division');
|
||||||
child = dp.children(':eq(1)');
|
child = dp.children(':eq(1)');
|
||||||
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
|
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
|
||||||
@ -146,16 +146,16 @@ test('baseStructure', function() {
|
|||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker('hide').datepicker('destroy');
|
||||||
|
|
||||||
// Inline
|
// Inline
|
||||||
var inl = init('#inl');
|
inl = init('#inl');
|
||||||
dp = inl.children();
|
dp = inl.children();
|
||||||
ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div');
|
ok(dp.is('.ui-datepicker-inline'), 'Structure inline - main div');
|
||||||
ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left');
|
ok(!dp.is('.ui-datepicker-rtl'), 'Structure inline - not right-to-left');
|
||||||
ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month');
|
ok(!dp.is('.ui-datepicker-multi'), 'Structure inline - not multi-month');
|
||||||
equal(dp.children().length, 2, 'Structure inline - child count');
|
equal(dp.children().length, 2, 'Structure inline - child count');
|
||||||
var header = dp.children(':first');
|
header = dp.children(':first');
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
|
ok(header.is('div.ui-datepicker-header'), 'Structure inline - header division');
|
||||||
equal(header.children().length, 3, 'Structure inline - header child count');
|
equal(header.children().length, 3, 'Structure inline - header child count');
|
||||||
var table = dp.children(':eq(1)');
|
table = dp.children(':eq(1)');
|
||||||
ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table');
|
ok(table.is('table.ui-datepicker-calendar'), 'Structure inline - month table');
|
||||||
ok(table.children(':first').is('thead'), 'Structure inline - month table thead');
|
ok(table.children(':first').is('thead'), 'Structure inline - month table thead');
|
||||||
ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body');
|
ok(table.children(':eq(1)').is('tbody'), 'Structure inline - month table body');
|
||||||
@ -176,19 +176,20 @@ test('baseStructure', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('customStructure', function() {
|
test('customStructure', function() {
|
||||||
var dp = $('#ui-datepicker-div');
|
var iframe, header, panel, title, thead,
|
||||||
|
dp = $('#ui-datepicker-div'),
|
||||||
// Check right-to-left localisation
|
// Check right-to-left localisation
|
||||||
var inp = init('#inp', $.datepicker.regional['he']);
|
inp = init('#inp', $.datepicker.regional.he);
|
||||||
inp.data('showButtonPanel.datepicker',true);
|
inp.data('showButtonPanel.datepicker',true);
|
||||||
inp.focus();
|
inp.focus();
|
||||||
var iframe = ($.browser.msie && parseInt($.browser.version) < 7);
|
iframe = ($.browser.msie && parseInt($.browser.version, 10) < 7);
|
||||||
ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
|
ok(dp.is('.ui-datepicker-rtl'), 'Structure RTL - right-to-left');
|
||||||
var header = dp.children(':first');
|
header = dp.children(':first');
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division');
|
ok(header.is('div.ui-datepicker-header'), 'Structure RTL - header division');
|
||||||
equal(header.children().length, 3, 'Structure RTL - header child count');
|
equal(header.children().length, 3, 'Structure RTL - header child count');
|
||||||
ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link');
|
ok(header.children(':first').is('a.ui-datepicker-next'), 'Structure RTL - prev link');
|
||||||
ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link');
|
ok(header.children(':eq(1)').is('a.ui-datepicker-prev'), 'Structure RTL - next link');
|
||||||
var panel = dp.children(':last');
|
panel = dp.children(':last');
|
||||||
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division');
|
ok(panel.is('div.ui-datepicker-buttonpane'), 'Structure RTL - button division');
|
||||||
equal(panel.children().length, 2, 'Structure RTL - button panel child count');
|
equal(panel.children().length, 2, 'Structure RTL - button panel child count');
|
||||||
ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button');
|
ok(panel.children(':first').is('button.ui-datepicker-close'), 'Structure RTL - close button');
|
||||||
@ -198,7 +199,7 @@ test('customStructure', function() {
|
|||||||
// Hide prev/next
|
// Hide prev/next
|
||||||
inp = init('#inp', {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
|
inp = init('#inp', {hideIfNoPrevNext: true, minDate: new Date(2008, 2 - 1, 4), maxDate: new Date(2008, 2 - 1, 14)});
|
||||||
inp.val('02/10/2008').focus();
|
inp.val('02/10/2008').focus();
|
||||||
var header = dp.children(':first');
|
header = dp.children(':first');
|
||||||
ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division');
|
ok(header.is('div.ui-datepicker-header'), 'Structure hide prev/next - header division');
|
||||||
equal(header.children().length, 1, 'Structure hide prev/next - links child count');
|
equal(header.children().length, 1, 'Structure hide prev/next - links child count');
|
||||||
ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division');
|
ok(header.children(':first').is('div.ui-datepicker-title'), 'Structure hide prev/next - title division');
|
||||||
@ -207,7 +208,7 @@ test('customStructure', function() {
|
|||||||
// Changeable Month with read-only year
|
// Changeable Month with read-only year
|
||||||
inp = init('#inp', {changeMonth: true});
|
inp = init('#inp', {changeMonth: true});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
var title = dp.children(':first').children(':last');
|
title = dp.children(':first').children(':last');
|
||||||
equal(title.children().length, 2, 'Structure changeable month - title child count');
|
equal(title.children().length, 2, 'Structure changeable month - title child count');
|
||||||
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector');
|
ok(title.children(':first').is('select.ui-datepicker-month'), 'Structure changeable month - month selector');
|
||||||
ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year');
|
ok(title.children(':last').is('span.ui-datepicker-year'), 'Structure changeable month - read-only year');
|
||||||
@ -216,7 +217,7 @@ test('customStructure', function() {
|
|||||||
// Changeable year with read-only month
|
// Changeable year with read-only month
|
||||||
inp = init('#inp', {changeYear: true});
|
inp = init('#inp', {changeYear: true});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
var title = dp.children(':first').children(':last');
|
title = dp.children(':first').children(':last');
|
||||||
equal(title.children().length, 2, 'Structure changeable year - title child count');
|
equal(title.children().length, 2, 'Structure changeable year - title child count');
|
||||||
ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month');
|
ok(title.children(':first').is('span.ui-datepicker-month'), 'Structure changeable year - read-only month');
|
||||||
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector');
|
ok(title.children(':last').is('select.ui-datepicker-year'), 'Structure changeable year - year selector');
|
||||||
@ -225,15 +226,15 @@ test('customStructure', function() {
|
|||||||
// Read-only first day of week
|
// Read-only first day of week
|
||||||
inp = init('#inp', {changeFirstDay: false});
|
inp = init('#inp', {changeFirstDay: false});
|
||||||
inp.focus();
|
inp.focus();
|
||||||
var thead = dp.find('.ui-datepicker-calendar thead tr');
|
thead = dp.find('.ui-datepicker-calendar thead tr');
|
||||||
equal(thead.children().length, 7, 'Structure read-only first day - thead child count');
|
equal(thead.children().length, 7, 'Structure read-only first day - thead child count');
|
||||||
equal(thead.find('a').length, 0, 'Structure read-only first day - thead links count');
|
equal(thead.find('a').length, 0, 'Structure read-only first day - thead links count');
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker('hide').datepicker('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('keystrokes', function() {
|
test('keystrokes', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var date = new Date();
|
date = new Date();
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
|
equalsDate(inp.datepicker('getDate'), date, 'Keystroke enter');
|
||||||
@ -366,9 +367,10 @@ test('keystrokes', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('mouse', function() {
|
test('mouse', function() {
|
||||||
var inp = init('#inp');
|
var inl,
|
||||||
var dp = $('#ui-datepicker-div');
|
inp = init('#inp'),
|
||||||
var date = new Date();
|
dp = $('#ui-datepicker-div'),
|
||||||
|
date = new Date();
|
||||||
inp.val('').datepicker('show');
|
inp.val('').datepicker('show');
|
||||||
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
|
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
|
||||||
date.setDate(10);
|
date.setDate(10);
|
||||||
@ -419,9 +421,9 @@ test('mouse', function() {
|
|||||||
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 18),
|
equalsDate(inp.datepicker('getDate'), new Date(2008, 2 - 1, 18),
|
||||||
'Mouse click - next + min/max');
|
'Mouse click - next + min/max');
|
||||||
// Inline
|
// Inline
|
||||||
var inl = init('#inl');
|
inl = init('#inl');
|
||||||
var dp = $('.ui-datepicker-inline', inl);
|
dp = $('.ui-datepicker-inline', inl);
|
||||||
var date = new Date();
|
date = new Date();
|
||||||
inl.datepicker('setDate', date);
|
inl.datepicker('setDate', date);
|
||||||
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
|
$('.ui-datepicker-calendar tbody a:contains(10)', dp).simulate('click', {});
|
||||||
date.setDate(10);
|
date.setDate(10);
|
||||||
|
@ -6,4 +6,4 @@ var datepicker_defaults = {
|
|||||||
disabled: false
|
disabled: false
|
||||||
};
|
};
|
||||||
|
|
||||||
//commonWidgetTests('datepicker', { defaults: datepicker_defaults });
|
//TestHelpers.commonWidgetTests('datepicker', { defaults: datepicker_defaults });
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
module("datepicker: events");
|
module("datepicker: events");
|
||||||
|
|
||||||
var selectedThis = null;
|
var selectedThis = null,
|
||||||
var selectedDate = null;
|
selectedDate = null,
|
||||||
var selectedInst = null;
|
selectedInst = null;
|
||||||
|
|
||||||
function callback(date, inst) {
|
function callback(date, inst) {
|
||||||
selectedThis = this;
|
selectedThis = this;
|
||||||
@ -22,8 +22,9 @@ function callback2(year, month, inst) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test('events', function() {
|
test('events', function() {
|
||||||
var inp = init('#inp', {onSelect: callback});
|
var dateStr, newMonthYear, inp2,
|
||||||
var date = new Date();
|
inp = init('#inp', {onSelect: callback}),
|
||||||
|
date = new Date();
|
||||||
// onSelect
|
// onSelect
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
@ -41,7 +42,7 @@ test('events', function() {
|
|||||||
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
equal(selectedDate, $.datepicker.formatDate('mm/dd/yy', date),
|
||||||
'Callback selected date - esc');
|
'Callback selected date - esc');
|
||||||
var dateStr = '02/04/2008';
|
dateStr = '02/04/2008';
|
||||||
inp.val(dateStr).datepicker('show').
|
inp.val(dateStr).datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equal(dateStr, selectedDate,
|
equal(dateStr, selectedDate,
|
||||||
@ -49,7 +50,7 @@ test('events', function() {
|
|||||||
// onChangeMonthYear
|
// onChangeMonthYear
|
||||||
inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
|
inp.datepicker('option', {onChangeMonthYear: callback2, onSelect: null}).
|
||||||
val('').datepicker('show');
|
val('').datepicker('show');
|
||||||
var newMonthYear = function(date) {
|
newMonthYear = function(date) {
|
||||||
return date.getFullYear() + '/' + (date.getMonth() + 1);
|
return date.getFullYear() + '/' + (date.getMonth() + 1);
|
||||||
};
|
};
|
||||||
date = new Date();
|
date = new Date();
|
||||||
@ -118,7 +119,7 @@ test('events', function() {
|
|||||||
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
equal(selectedDate, '', 'Callback close date - ctrl+end');
|
equal(selectedDate, '', 'Callback close date - ctrl+end');
|
||||||
|
|
||||||
var inp2 = init('#inp2');
|
inp2 = init('#inp2');
|
||||||
inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show');
|
inp2.datepicker().datepicker('option', {onClose: callback}).datepicker('show');
|
||||||
inp.datepicker('show');
|
inp.datepicker('show');
|
||||||
equal(selectedThis, inp2[0], 'Callback close this');
|
equal(selectedThis, inp2[0], 'Callback close this');
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
module("datepicker: methods");
|
module("datepicker: methods");
|
||||||
|
|
||||||
test('destroy', function() {
|
test('destroy', function() {
|
||||||
var inp = init('#inp');
|
var inl,
|
||||||
|
inp = init('#inp');
|
||||||
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
|
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
|
||||||
ok($.data(inp[0], PROP_NAME), 'Default - instance present');
|
ok($.data(inp[0], PROP_NAME), 'Default - instance present');
|
||||||
ok(inp.next().is('#alt'), 'Default - button absent');
|
ok(inp.next().is('#alt'), 'Default - button absent');
|
||||||
@ -19,7 +20,7 @@ test('destroy', function() {
|
|||||||
inp= init('#inp', {showOn: 'both'});
|
inp= init('#inp', {showOn: 'both'});
|
||||||
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
|
ok(inp.is('.hasDatepicker'), 'Button - marker class set');
|
||||||
ok($.data(inp[0], PROP_NAME), 'Button - instance present');
|
ok($.data(inp[0], PROP_NAME), 'Button - instance present');
|
||||||
ok(inp.next().text() == '...', 'Button - button added');
|
ok(inp.next().text() === '...', 'Button - button added');
|
||||||
inp.datepicker('destroy');
|
inp.datepicker('destroy');
|
||||||
inp = $('#inp');
|
inp = $('#inp');
|
||||||
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
|
ok(!inp.is('.hasDatepicker'), 'Button - marker class cleared');
|
||||||
@ -29,7 +30,7 @@ test('destroy', function() {
|
|||||||
inp = init('#inp', {appendText: 'Testing'});
|
inp = init('#inp', {appendText: 'Testing'});
|
||||||
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
|
ok(inp.is('.hasDatepicker'), 'Append - marker class set');
|
||||||
ok($.data(inp[0], PROP_NAME), 'Append - instance present');
|
ok($.data(inp[0], PROP_NAME), 'Append - instance present');
|
||||||
ok(inp.next().text() == 'Testing', 'Append - append text added');
|
ok(inp.next().text() === 'Testing', 'Append - append text added');
|
||||||
inp.datepicker('destroy');
|
inp.datepicker('destroy');
|
||||||
inp = $('#inp');
|
inp = $('#inp');
|
||||||
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
|
ok(!inp.is('.hasDatepicker'), 'Append - marker class cleared');
|
||||||
@ -40,29 +41,30 @@ test('destroy', function() {
|
|||||||
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
|
buttonImage: 'img/calendar.gif', appendText: 'Testing'});
|
||||||
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
|
ok(inp.is('.hasDatepicker'), 'Both - marker class set');
|
||||||
ok($.data(inp[0], PROP_NAME), 'Both - instance present');
|
ok($.data(inp[0], PROP_NAME), 'Both - instance present');
|
||||||
ok(inp.next()[0].nodeName.toLowerCase() == 'img', 'Both - button added');
|
ok(inp.next()[0].nodeName.toLowerCase() === 'img', 'Both - button added');
|
||||||
ok(inp.next().next().text() == 'Testing', 'Both - append text added');
|
ok(inp.next().next().text() === 'Testing', 'Both - append text added');
|
||||||
inp.datepicker('destroy');
|
inp.datepicker('destroy');
|
||||||
inp = $('#inp');
|
inp = $('#inp');
|
||||||
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
|
ok(!inp.is('.hasDatepicker'), 'Both - marker class cleared');
|
||||||
ok(!$.data(inp[0], PROP_NAME), 'Both - instance absent');
|
ok(!$.data(inp[0], PROP_NAME), 'Both - instance absent');
|
||||||
ok(inp.next().is('#alt'), 'Both - button and append text absent');
|
ok(inp.next().is('#alt'), 'Both - button and append text absent');
|
||||||
// Inline
|
// Inline
|
||||||
var inl = init('#inl');
|
inl = init('#inl');
|
||||||
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
|
ok(inl.is('.hasDatepicker'), 'Inline - marker class set');
|
||||||
ok(inl.html() != '', 'Inline - datepicker present');
|
ok(inl.html() !== '', 'Inline - datepicker present');
|
||||||
ok($.data(inl[0], PROP_NAME), 'Inline - instance present');
|
ok($.data(inl[0], PROP_NAME), 'Inline - instance present');
|
||||||
ok(inl.next().length == 0 || inl.next().is('p'), 'Inline - button absent');
|
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
|
||||||
inl.datepicker('destroy');
|
inl.datepicker('destroy');
|
||||||
inl = $('#inl');
|
inl = $('#inl');
|
||||||
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
|
ok(!inl.is('.hasDatepicker'), 'Inline - marker class cleared');
|
||||||
ok(inl.html() == '', 'Inline - datepicker absent');
|
ok(inl.html() === '', 'Inline - datepicker absent');
|
||||||
ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent');
|
ok(!$.data(inl[0], PROP_NAME), 'Inline - instance absent');
|
||||||
ok(inl.next().length == 0 || inl.next().is('p'), 'Inline - button absent');
|
ok(inl.next().length === 0 || inl.next().is('p'), 'Inline - button absent');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('enableDisable', function() {
|
test('enableDisable', function() {
|
||||||
var inp = init('#inp');
|
var inl, dp,
|
||||||
|
inp = init('#inp');
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
|
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');
|
||||||
ok(!inp[0].disabled, 'Enable/disable - field initially enabled');
|
ok(!inp[0].disabled, 'Enable/disable - field initially enabled');
|
||||||
inp.datepicker('disable');
|
inp.datepicker('disable');
|
||||||
@ -91,19 +93,19 @@ test('enableDisable', function() {
|
|||||||
buttonImage: 'img/calendar.gif'});
|
buttonImage: 'img/calendar.gif'});
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - initially marked as enabled');
|
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - initially marked as enabled');
|
||||||
ok(!inp[0].disabled, 'Enable/disable image - field initially enabled');
|
ok(!inp[0].disabled, 'Enable/disable image - field initially enabled');
|
||||||
ok(inp.next('img').css('opacity') == 1, 'Enable/disable image - image initially enabled');
|
ok(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image initially enabled');
|
||||||
inp.datepicker('disable');
|
inp.datepicker('disable');
|
||||||
ok(inp.datepicker('isDisabled'), 'Enable/disable image - now marked as disabled');
|
ok(inp.datepicker('isDisabled'), 'Enable/disable image - now marked as disabled');
|
||||||
ok(inp[0].disabled, 'Enable/disable image - field now disabled');
|
ok(inp[0].disabled, 'Enable/disable image - field now disabled');
|
||||||
ok(inp.next('img').css('opacity') != 1, 'Enable/disable image - image now disabled');
|
ok(parseFloat(inp.next('img').css('opacity')) !== 1, 'Enable/disable image - image now disabled');
|
||||||
inp.datepicker('enable');
|
inp.datepicker('enable');
|
||||||
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - now marked as enabled');
|
ok(!inp.datepicker('isDisabled'), 'Enable/disable image - now marked as enabled');
|
||||||
ok(!inp[0].disabled, 'Enable/disable image - field now enabled');
|
ok(!inp[0].disabled, 'Enable/disable image - field now enabled');
|
||||||
ok(inp.next('img').css('opacity') == 1, 'Enable/disable image - image now enabled');
|
ok(parseFloat(inp.next('img').css('opacity')) === 1, 'Enable/disable image - image now enabled');
|
||||||
inp.datepicker('destroy');
|
inp.datepicker('destroy');
|
||||||
// Inline
|
// Inline
|
||||||
var inl = init('#inl', {changeYear: true});
|
inl = init('#inl', {changeYear: true});
|
||||||
var dp = $('.ui-datepicker-inline', inl);
|
dp = $('.ui-datepicker-inline', inl);
|
||||||
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
|
ok(!inl.datepicker('isDisabled'), 'Enable/disable inline - initially marked as enabled');
|
||||||
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially');
|
ok(!dp.children().is('.ui-state-disabled'), 'Enable/disable inline - not visually disabled initially');
|
||||||
ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially');
|
ok(!dp.find('select').prop('disabled'), 'Enable/disable inline - form element enabled initially');
|
||||||
|
@ -16,8 +16,8 @@ test('setDefaults', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('option', function() {
|
test('option', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var inst = $.data(inp[0], PROP_NAME);
|
inst = $.data(inp[0], PROP_NAME);
|
||||||
// Set option
|
// Set option
|
||||||
equal(inst.settings.showOn, null, 'Initial setting showOn');
|
equal(inst.settings.showOn, null, 'Initial setting showOn');
|
||||||
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
|
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
|
||||||
@ -47,8 +47,8 @@ test('option', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('change', function() {
|
test('change', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var inst = $.data(inp[0], PROP_NAME);
|
inst = $.data(inp[0], PROP_NAME);
|
||||||
equal(inst.settings.showOn, null, 'Initial setting showOn');
|
equal(inst.settings.showOn, null, 'Initial setting showOn');
|
||||||
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
|
equal($.datepicker._get(inst, 'showOn'), 'focus', 'Initial instance showOn');
|
||||||
equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
|
equal($.datepicker._defaults.showOn, 'focus', 'Initial default showOn');
|
||||||
@ -67,14 +67,15 @@ test('change', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('invocation', function() {
|
test('invocation', function() {
|
||||||
var inp = init('#inp');
|
var button, image,
|
||||||
var dp = $('#ui-datepicker-div');
|
inp = init('#inp'),
|
||||||
var body = $('body');
|
dp = $('#ui-datepicker-div'),
|
||||||
|
body = $('body');
|
||||||
// On focus
|
// On focus
|
||||||
var button = inp.siblings('button');
|
button = inp.siblings('button');
|
||||||
ok(button.length == 0, 'Focus - button absent');
|
ok(button.length === 0, 'Focus - button absent');
|
||||||
var image = inp.siblings('img');
|
image = inp.siblings('img');
|
||||||
ok(image.length == 0, 'Focus - image absent');
|
ok(image.length === 0, 'Focus - image absent');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
ok(dp.is(':visible'), 'Focus - rendered on focus');
|
ok(dp.is(':visible'), 'Focus - rendered on focus');
|
||||||
inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
@ -89,8 +90,8 @@ test('invocation', function() {
|
|||||||
ok(!dp.is(':visible'), 'Button - initially hidden');
|
ok(!dp.is(':visible'), 'Button - initially hidden');
|
||||||
button = inp.siblings('button');
|
button = inp.siblings('button');
|
||||||
image = inp.siblings('img');
|
image = inp.siblings('img');
|
||||||
ok(button.length == 1, 'Button - button present');
|
ok(button.length === 1, 'Button - button present');
|
||||||
ok(image.length == 0, 'Button - image absent');
|
ok(image.length === 0, 'Button - image absent');
|
||||||
equal(button.text(), 'Popup', 'Button - button text');
|
equal(button.text(), 'Popup', 'Button - button text');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
ok(!dp.is(':visible'), 'Button - not rendered on focus');
|
ok(!dp.is(':visible'), 'Button - not rendered on focus');
|
||||||
@ -104,9 +105,9 @@ test('invocation', function() {
|
|||||||
buttonImage: 'img/calendar.gif', buttonText: 'Cal'});
|
buttonImage: 'img/calendar.gif', buttonText: 'Cal'});
|
||||||
ok(!dp.is(':visible'), 'Image button - initially hidden');
|
ok(!dp.is(':visible'), 'Image button - initially hidden');
|
||||||
button = inp.siblings('button');
|
button = inp.siblings('button');
|
||||||
ok(button.length == 0, 'Image button - button absent');
|
ok(button.length === 0, 'Image button - button absent');
|
||||||
image = inp.siblings('img');
|
image = inp.siblings('img');
|
||||||
ok(image.length == 1, 'Image button - image present');
|
ok(image.length === 1, 'Image button - image present');
|
||||||
equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source');
|
equal(image.attr('src'), 'img/calendar.gif', 'Image button - image source');
|
||||||
equal(image.attr('title'), 'Cal', 'Image button - image text');
|
equal(image.attr('title'), 'Cal', 'Image button - image text');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
@ -120,11 +121,11 @@ test('invocation', function() {
|
|||||||
inp = init('#inp', {showOn: 'both', buttonImage: 'img/calendar.gif'});
|
inp = init('#inp', {showOn: 'both', buttonImage: 'img/calendar.gif'});
|
||||||
ok(!dp.is(':visible'), 'Both - initially hidden');
|
ok(!dp.is(':visible'), 'Both - initially hidden');
|
||||||
button = inp.siblings('button');
|
button = inp.siblings('button');
|
||||||
ok(button.length == 1, 'Both - button present');
|
ok(button.length === 1, 'Both - button present');
|
||||||
image = inp.siblings('img');
|
image = inp.siblings('img');
|
||||||
ok(image.length == 0, 'Both - image absent');
|
ok(image.length === 0, 'Both - image absent');
|
||||||
image = button.children('img');
|
image = button.children('img');
|
||||||
ok(image.length == 1, 'Both - button image present');
|
ok(image.length === 1, 'Both - button image present');
|
||||||
inp.focus();
|
inp.focus();
|
||||||
ok(dp.is(':visible'), 'Both - rendered on focus');
|
ok(dp.is(':visible'), 'Both - rendered on focus');
|
||||||
body.simulate('mousedown', {});
|
body.simulate('mousedown', {});
|
||||||
@ -137,29 +138,29 @@ test('invocation', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('otherMonths', function() {
|
test('otherMonths', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var pop = $('#ui-datepicker-div');
|
pop = $('#ui-datepicker-div');
|
||||||
inp.val('06/01/2009').datepicker('show');
|
inp.val('06/01/2009').datepicker('show');
|
||||||
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
|
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
|
||||||
'Other months - none');
|
'Other months - none');
|
||||||
ok(pop.find('td:last *').length == 0, 'Other months - no content');
|
ok(pop.find('td:last *').length === 0, 'Other months - no content');
|
||||||
inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
|
inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
|
||||||
equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
|
equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
|
||||||
'Other months - show');
|
'Other months - show');
|
||||||
ok(pop.find('td:last span').length == 1, 'Other months - span content');
|
ok(pop.find('td:last span').length === 1, 'Other months - span content');
|
||||||
inp.datepicker('hide').datepicker('option', 'selectOtherMonths', true).datepicker('show');
|
inp.datepicker('hide').datepicker('option', 'selectOtherMonths', true).datepicker('show');
|
||||||
equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
|
equal(pop.find('tbody').text(), '311234567891011121314151617181920212223242526272829301234',
|
||||||
'Other months - select');
|
'Other months - select');
|
||||||
ok(pop.find('td:last a').length == 1, 'Other months - link content');
|
ok(pop.find('td:last a').length === 1, 'Other months - link content');
|
||||||
inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
|
inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
|
||||||
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
|
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0',
|
||||||
'Other months - none');
|
'Other months - none');
|
||||||
ok(pop.find('td:last *').length == 0, 'Other months - no content');
|
ok(pop.find('td:last *').length === 0, 'Other months - no content');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('defaultDate', function() {
|
test('defaultDate', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var date = new Date();
|
date = new Date();
|
||||||
inp.val('').datepicker('show').
|
inp.val('').datepicker('show').
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
|
equalsDate(inp.datepicker('getDate'), date, 'Default date null');
|
||||||
@ -252,17 +253,19 @@ test('defaultDate', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('miscellaneous', function() {
|
test('miscellaneous', function() {
|
||||||
var dp = $('#ui-datepicker-div');
|
var curYear, longNames, shortNames, date,
|
||||||
var inp = init('#inp');
|
dp = $('#ui-datepicker-div'),
|
||||||
|
inp = init('#inp');
|
||||||
// Year range
|
// Year range
|
||||||
var genRange = function(start, offset) {
|
function genRange(start, offset) {
|
||||||
var range = '';
|
var i = start,
|
||||||
for (var i = start; i < start + offset; i++) {
|
range = '';
|
||||||
|
for (; i < start + offset; i++) {
|
||||||
range += i;
|
range += i;
|
||||||
}
|
}
|
||||||
return range;
|
return range;
|
||||||
};
|
}
|
||||||
var curYear = new Date().getFullYear();
|
curYear = new Date().getFullYear();
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val('02/04/2008').datepicker('show');
|
||||||
equal(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default');
|
equal(dp.find('.ui-datepicker-year').text(), '2008', 'Year range - read-only default');
|
||||||
inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show');
|
inp.datepicker('hide').datepicker('option', {changeYear: true}).datepicker('show');
|
||||||
@ -285,9 +288,9 @@ test('miscellaneous', function() {
|
|||||||
equal(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default');
|
equal(dp.find('.ui-datepicker-next').text(), 'Next', 'Navigation next - default');
|
||||||
inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}).
|
inp.datepicker('hide').datepicker('option', {navigationAsDateFormat: true, prevText: '< M', currentText: 'MM', nextText: 'M >'}).
|
||||||
val('02/04/2008').datepicker('show');
|
val('02/04/2008').datepicker('show');
|
||||||
var longNames = $.datepicker.regional[''].monthNames;
|
longNames = $.datepicker.regional[''].monthNames;
|
||||||
var shortNames = $.datepicker.regional[''].monthNamesShort;
|
shortNames = $.datepicker.regional[''].monthNamesShort;
|
||||||
var date = new Date();
|
date = new Date();
|
||||||
equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format');
|
equal(dp.find('.ui-datepicker-prev').text(), '< ' + shortNames[0], 'Navigation prev - as date format');
|
||||||
equal(dp.find('.ui-datepicker-current').text(),
|
equal(dp.find('.ui-datepicker-current').text(),
|
||||||
longNames[date.getMonth()], 'Navigation current - as date format');
|
longNames[date.getMonth()], 'Navigation current - as date format');
|
||||||
@ -311,11 +314,12 @@ test('miscellaneous', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('minMax', function() {
|
test('minMax', function() {
|
||||||
var inp = init('#inp');
|
var date,
|
||||||
var lastYear = new Date(2007, 6 - 1, 4);
|
inp = init('#inp'),
|
||||||
var nextYear = new Date(2009, 6 - 1, 4);
|
lastYear = new Date(2007, 6 - 1, 4),
|
||||||
var minDate = new Date(2008, 2 - 1, 29);
|
nextYear = new Date(2009, 6 - 1, 4),
|
||||||
var maxDate = new Date(2008, 12 - 1, 7);
|
minDate = new Date(2008, 2 - 1, 29),
|
||||||
|
maxDate = new Date(2008, 12 - 1, 7);
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.PAGE_UP}).
|
||||||
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
@ -360,7 +364,7 @@ test('minMax', function() {
|
|||||||
equalsDate(inp.datepicker('getDate'), maxDate,
|
equalsDate(inp.datepicker('getDate'), maxDate,
|
||||||
'Min/max - null, 12/07/2008 - ctrl+pgdn');
|
'Min/max - null, 12/07/2008 - ctrl+pgdn');
|
||||||
// Relative dates
|
// Relative dates
|
||||||
var date = new Date();
|
date = new Date();
|
||||||
date.setDate(date.getDate() - 7);
|
date.setDate(date.getDate() - 7);
|
||||||
inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
|
inp.datepicker('option', {minDate: '-1w', maxDate: '+1 M +10 D '}).
|
||||||
datepicker('hide').val('').datepicker('show');
|
datepicker('hide').val('').datepicker('show');
|
||||||
@ -394,9 +398,10 @@ test('minMax', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('setDate', function() {
|
test('setDate', function() {
|
||||||
var inp = init('#inp');
|
var inl, alt, minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
|
||||||
var date1 = new Date(2008, 6 - 1, 4);
|
inp = init('#inp'),
|
||||||
var date2 = new Date();
|
date1 = new Date(2008, 6 - 1, 4),
|
||||||
|
date2 = new Date();
|
||||||
ok(inp.datepicker('getDate') == null, 'Set date - default');
|
ok(inp.datepicker('getDate') == null, 'Set date - default');
|
||||||
inp.datepicker('setDate', date1);
|
inp.datepicker('setDate', date1);
|
||||||
equalsDate(inp.datepicker('getDate'), date1, 'Set date - 2008-06-04');
|
equalsDate(inp.datepicker('getDate'), date1, 'Set date - 2008-06-04');
|
||||||
@ -423,7 +428,7 @@ test('setDate', function() {
|
|||||||
inp.datepicker('setDate', 'c -3 w');
|
inp.datepicker('setDate', 'c -3 w');
|
||||||
equalsDate(inp.datepicker('getDate'), date1, 'Set date - c -3 w');
|
equalsDate(inp.datepicker('getDate'), date1, 'Set date - c -3 w');
|
||||||
// Inline
|
// Inline
|
||||||
var inl = init('#inl');
|
inl = init('#inl');
|
||||||
date1 = new Date(2008, 6 - 1, 4);
|
date1 = new Date(2008, 6 - 1, 4);
|
||||||
date2 = new Date();
|
date2 = new Date();
|
||||||
equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - default');
|
equalsDate(inl.datepicker('getDate'), date2, 'Set date inline - default');
|
||||||
@ -441,7 +446,7 @@ test('setDate', function() {
|
|||||||
inl.datepicker('setDate');
|
inl.datepicker('setDate');
|
||||||
ok(inl.datepicker('getDate') == null, 'Set date inline - null');
|
ok(inl.datepicker('getDate') == null, 'Set date inline - null');
|
||||||
// Alternate field
|
// Alternate field
|
||||||
var alt = $('#alt');
|
alt = $('#alt');
|
||||||
inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'});
|
inp.datepicker('option', {altField: '#alt', altFormat: 'yy-mm-dd'});
|
||||||
date1 = new Date(2008, 6 - 1, 4);
|
date1 = new Date(2008, 6 - 1, 4);
|
||||||
inp.datepicker('setDate', date1);
|
inp.datepicker('setDate', date1);
|
||||||
@ -451,8 +456,8 @@ test('setDate', function() {
|
|||||||
inp = init('#inp');
|
inp = init('#inp');
|
||||||
date1 = new Date(2008, 1 - 1, 4);
|
date1 = new Date(2008, 1 - 1, 4);
|
||||||
date2 = new Date(2008, 6 - 1, 4);
|
date2 = new Date(2008, 6 - 1, 4);
|
||||||
var minDate = new Date(2008, 2 - 1, 29);
|
minDate = new Date(2008, 2 - 1, 29);
|
||||||
var maxDate = new Date(2008, 3 - 1, 28);
|
maxDate = new Date(2008, 3 - 1, 28);
|
||||||
inp.val('').datepicker('option', {minDate: minDate}).datepicker('setDate', date2);
|
inp.val('').datepicker('option', {minDate: minDate}).datepicker('setDate', date2);
|
||||||
equalsDate(inp.datepicker('getDate'), date2, 'Set date min/max - setDate > min');
|
equalsDate(inp.datepicker('getDate'), date2, 'Set date min/max - setDate > min');
|
||||||
inp.datepicker('setDate', date1);
|
inp.datepicker('setDate', date1);
|
||||||
@ -465,15 +470,15 @@ test('setDate', function() {
|
|||||||
equalsDate(inp.datepicker('getDate'), minDate, 'Set date min/max - setDate < min');
|
equalsDate(inp.datepicker('getDate'), minDate, 'Set date min/max - setDate < min');
|
||||||
inp.datepicker('setDate', date2);
|
inp.datepicker('setDate', date2);
|
||||||
equalsDate(inp.datepicker('getDate'), maxDate, 'Set date min/max - setDate > max');
|
equalsDate(inp.datepicker('getDate'), maxDate, 'Set date min/max - setDate > max');
|
||||||
var dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0);
|
dateAndTimeToSet = new Date(2008, 3 - 1, 28, 1, 11, 0);
|
||||||
var dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0);
|
dateAndTimeClone = new Date(2008, 3 - 1, 28, 1, 11, 0);
|
||||||
inp.datepicker('setDate', dateAndTimeToSet);
|
inp.datepicker('setDate', dateAndTimeToSet);
|
||||||
equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate');
|
equal(dateAndTimeToSet.getTime(), dateAndTimeClone.getTime(), 'Date object passed should not be changed by setDate');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('altField', function() {
|
test('altField', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var alt = $('#alt');
|
alt = $('#alt');
|
||||||
// No alternate field set
|
// No alternate field set
|
||||||
alt.val('');
|
alt.val('');
|
||||||
inp.val('06/04/2008').datepicker('show');
|
inp.val('06/04/2008').datepicker('show');
|
||||||
@ -507,26 +512,6 @@ test('altField', function() {
|
|||||||
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
inp.simulate('keydown', {ctrlKey: true, keyCode: $.ui.keyCode.END});
|
||||||
equal(inp.val(), '', 'Alt field - dp - ctrl+end');
|
equal(inp.val(), '', 'Alt field - dp - ctrl+end');
|
||||||
equal(alt.val(), '', 'Alt field - alt - ctrl+end');
|
equal(alt.val(), '', 'Alt field - alt - ctrl+end');
|
||||||
|
|
||||||
return
|
|
||||||
// TODO manual entry impl works (see altField demo) but this test doesn't
|
|
||||||
// probably something the rewrite won't cover anymore anyway
|
|
||||||
|
|
||||||
// Verify alt field is updated on keyup
|
|
||||||
alt.val('');
|
|
||||||
inp.val('06/04/200').datepicker('show');
|
|
||||||
inp.simulate('keydown', {charCode: '8'.charCodeAt(0)});
|
|
||||||
inp.simulate('keypress', {charCode: '8'.charCodeAt(0)});
|
|
||||||
inp.simulate('keyup', {charCode: '8'.charCodeAt(0)});
|
|
||||||
equal(inp.val(), '06/04/2008', 'Alt field - dp - manual entry');
|
|
||||||
equal(alt.val(), '2008-06-04', 'Alt field - manual entry');
|
|
||||||
// Verify alt field is not updated on keyup if date is invalid
|
|
||||||
inp.val('12/04');
|
|
||||||
inp.simulate('keydown', {charCode: '/'.charCodeAt(0)});
|
|
||||||
inp.simulate('keypress', {charCode: '/'.charCodeAt(0)});
|
|
||||||
inp.simulate('keyup', {charCode: '/'.charCodeAt(0)});
|
|
||||||
equal(inp.val(), '12/04/', 'Alt field - dp - manual entry incomplete');
|
|
||||||
equal(alt.val(), '2008-06-04', 'Alt field - manual entry - not updated');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('autoSize', function() {
|
test('autoSize', function() {
|
||||||
@ -541,7 +526,7 @@ test('autoSize', function() {
|
|||||||
inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
|
inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
|
||||||
equal(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy');
|
equal(inp.prop('size'), 29, 'Auto size - DD, MM dd, yy');
|
||||||
// French
|
// French
|
||||||
inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['fr']));
|
inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional.fr));
|
||||||
equal(inp.prop('size'), 29, 'Auto size - fr - default');
|
equal(inp.prop('size'), 29, 'Auto size - fr - default');
|
||||||
inp.datepicker('option', 'autoSize', true);
|
inp.datepicker('option', 'autoSize', true);
|
||||||
equal(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy');
|
equal(inp.prop('size'), 10, 'Auto size - fr - dd/mm/yy');
|
||||||
@ -552,7 +537,7 @@ test('autoSize', function() {
|
|||||||
inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
|
inp.datepicker('option', 'dateFormat', 'DD, MM dd, yy');
|
||||||
equal(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy');
|
equal(inp.prop('size'), 28, 'Auto size - fr - DD, MM dd, yy');
|
||||||
// Hebrew
|
// Hebrew
|
||||||
inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional['he']));
|
inp.datepicker('option', $.extend({autoSize: false}, $.datepicker.regional.he));
|
||||||
equal(inp.prop('size'), 28, 'Auto size - he - default');
|
equal(inp.prop('size'), 28, 'Auto size - he - default');
|
||||||
inp.datepicker('option', 'autoSize', true);
|
inp.datepicker('option', 'autoSize', true);
|
||||||
equal(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy');
|
equal(inp.prop('size'), 10, 'Auto size - he - dd/mm/yy');
|
||||||
@ -565,8 +550,8 @@ test('autoSize', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('daylightSaving', function() {
|
test('daylightSaving', function() {
|
||||||
var inp = init('#inp');
|
var inp = init('#inp'),
|
||||||
var dp = $('#ui-datepicker-div');
|
dp = $('#ui-datepicker-div');
|
||||||
ok(true, 'Daylight saving - ' + new Date());
|
ok(true, 'Daylight saving - ' + new Date());
|
||||||
// Australia, Sydney - AM change, southern hemisphere
|
// Australia, Sydney - AM change, southern hemisphere
|
||||||
inp.val('04/01/2008').datepicker('show');
|
inp.val('04/01/2008').datepicker('show');
|
||||||
@ -646,9 +631,12 @@ test('daylightSaving', function() {
|
|||||||
equal(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008');
|
equal(inp.val(), '11/03/2008', 'Daylight saving - US 11/03/2008');
|
||||||
});
|
});
|
||||||
|
|
||||||
var beforeShowThis = null;
|
var beforeShowThis = null,
|
||||||
var beforeShowInput = null;
|
beforeShowInput = null,
|
||||||
var beforeShowInst = null;
|
beforeShowInst = null,
|
||||||
|
beforeShowDayThis = null,
|
||||||
|
beforeShowDayOK = true;
|
||||||
|
|
||||||
|
|
||||||
function beforeAll(input, inst) {
|
function beforeAll(input, inst) {
|
||||||
beforeShowThis = this;
|
beforeShowThis = this;
|
||||||
@ -657,84 +645,86 @@ function beforeAll(input, inst) {
|
|||||||
return {currentText: 'Current'};
|
return {currentText: 'Current'};
|
||||||
}
|
}
|
||||||
|
|
||||||
var beforeShowDayThis = null;
|
|
||||||
var beforeShowDayOK = true;
|
|
||||||
|
|
||||||
function beforeDay(date) {
|
function beforeDay(date) {
|
||||||
beforeShowDayThis = this;
|
beforeShowDayThis = this;
|
||||||
beforeShowDayOK &= (date > new Date(2008, 1 - 1, 26) &&
|
beforeShowDayOK &= (date > new Date(2008, 1 - 1, 26) &&
|
||||||
date < new Date(2008, 3 - 1, 6));
|
date < new Date(2008, 3 - 1, 6));
|
||||||
return [(date.getDate() % 2 == 0), (date.getDate() % 10 == 0 ? 'day10' : ''),
|
return [(date.getDate() % 2 === 0), (date.getDate() % 10 === 0 ? 'day10' : ''),
|
||||||
(date.getDate() % 3 == 0 ? 'Divisble by 3' : '')];
|
(date.getDate() % 3 === 0 ? 'Divisble by 3' : '')];
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcWeek(date) {
|
function calcWeek(date) {
|
||||||
var doy = date.getDate() + 6;
|
var doy = date.getDate() + 6,
|
||||||
for (var m = date.getMonth() - 1; m >= 0; m--)
|
m = date.getMonth() - 1;
|
||||||
|
for (; m >= 0; m--) {
|
||||||
doy += $.datepicker._getDaysInMonth(date.getFullYear(), m);
|
doy += $.datepicker._getDaysInMonth(date.getFullYear(), m);
|
||||||
|
}
|
||||||
// Simple count from 01/01 starting at week 1
|
// Simple count from 01/01 starting at week 1
|
||||||
return Math.floor(doy / 7);
|
return Math.floor(doy / 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
test('callbacks', function() {
|
test('callbacks', function() {
|
||||||
// Before show
|
// Before show
|
||||||
var inp = init('#inp', {beforeShow: beforeAll});
|
var dp, day20, day21,
|
||||||
var inst = $.data(inp[0], 'datepicker');
|
inp = init('#inp', {beforeShow: beforeAll}),
|
||||||
|
inst = $.data(inp[0], 'datepicker');
|
||||||
equal($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial');
|
equal($.datepicker._get(inst, 'currentText'), 'Today', 'Before show - initial');
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val('02/04/2008').datepicker('show');
|
||||||
equal($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed');
|
equal($.datepicker._get(inst, 'currentText'), 'Current', 'Before show - changed');
|
||||||
ok(beforeShowThis.id == inp[0].id, 'Before show - this OK');
|
ok(beforeShowThis.id === inp[0].id, 'Before show - this OK');
|
||||||
ok(beforeShowInput.id == inp[0].id, 'Before show - input OK');
|
ok(beforeShowInput.id === inp[0].id, 'Before show - input OK');
|
||||||
deepEqual(beforeShowInst, inst, 'Before show - inst OK');
|
deepEqual(beforeShowInst, inst, 'Before show - inst OK');
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker('hide').datepicker('destroy');
|
||||||
// Before show day
|
// Before show day
|
||||||
inp = init('#inp', {beforeShowDay: beforeDay});
|
inp = init('#inp', {beforeShowDay: beforeDay});
|
||||||
var dp = $('#ui-datepicker-div');
|
dp = $('#ui-datepicker-div');
|
||||||
inp.val('02/04/2008').datepicker('show');
|
inp.val('02/04/2008').datepicker('show');
|
||||||
ok(beforeShowDayThis.id == inp[0].id, 'Before show day - this OK');
|
ok(beforeShowDayThis.id === inp[0].id, 'Before show day - this OK');
|
||||||
ok(beforeShowDayOK, 'Before show day - dates OK');
|
ok(beforeShowDayOK, 'Before show day - dates OK');
|
||||||
var day20 = dp.find('.ui-datepicker-calendar td:contains("20")');
|
day20 = dp.find('.ui-datepicker-calendar td:contains("20")');
|
||||||
var day21 = dp.find('.ui-datepicker-calendar td:contains("21")');
|
day21 = dp.find('.ui-datepicker-calendar td:contains("21")');
|
||||||
ok(!day20.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 20');
|
ok(!day20.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 20');
|
||||||
ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21');
|
ok(day21.is('.ui-datepicker-unselectable'), 'Before show day - unselectable 21');
|
||||||
ok(day20.is('.day10'), 'Before show day - CSS 20');
|
ok(day20.is('.day10'), 'Before show day - CSS 20');
|
||||||
ok(!day21.is('.day10'), 'Before show day - CSS 21');
|
ok(!day21.is('.day10'), 'Before show day - CSS 21');
|
||||||
ok(!day20.attr('title'), 'Before show day - title 20');
|
ok(!day20.attr('title'), 'Before show day - title 20');
|
||||||
ok(day21.attr('title') == 'Divisble by 3', 'Before show day - title 21');
|
ok(day21.attr('title') === 'Divisble by 3', 'Before show day - title 21');
|
||||||
inp.datepicker('hide').datepicker('destroy');
|
inp.datepicker('hide').datepicker('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('localisation', function() {
|
test('localisation', function() {
|
||||||
var inp = init('#inp', $.datepicker.regional['fr']);
|
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');
|
inp.datepicker('option', {dateFormat: 'DD, d MM yy', showButtonPanel:true, changeMonth:true, changeYear:true}).val('').datepicker('show');
|
||||||
var dp = $('#ui-datepicker-div');
|
dp = $('#ui-datepicker-div');
|
||||||
equal($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close');
|
equal($('.ui-datepicker-close', dp).text(), 'Fermer', 'Localisation - close');
|
||||||
$('.ui-datepicker-close', dp).simulate('mouseover');
|
$('.ui-datepicker-close', dp).simulate('mouseover');
|
||||||
equal($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous');
|
equal($('.ui-datepicker-prev', dp).text(), 'Précédent', 'Localisation - previous');
|
||||||
equal($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current');
|
equal($('.ui-datepicker-current', dp).text(), 'Aujourd\'hui', 'Localisation - current');
|
||||||
equal($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next');
|
equal($('.ui-datepicker-next', dp).text(), 'Suivant', 'Localisation - next');
|
||||||
var month = 0;
|
month = 0;
|
||||||
$('.ui-datepicker-month option', dp).each(function() {
|
$('.ui-datepicker-month option', dp).each(function() {
|
||||||
equal($(this).text(), $.datepicker.regional['fr'].monthNamesShort[month],
|
equal($(this).text(), $.datepicker.regional.fr.monthNamesShort[month],
|
||||||
'Localisation - month ' + month);
|
'Localisation - month ' + month);
|
||||||
month++;
|
month++;
|
||||||
});
|
});
|
||||||
var day = 1;
|
day = 1;
|
||||||
$('.ui-datepicker-calendar th', dp).each(function() {
|
$('.ui-datepicker-calendar th', dp).each(function() {
|
||||||
equal($(this).text(), $.datepicker.regional['fr'].dayNamesMin[day],
|
equal($(this).text(), $.datepicker.regional.fr.dayNamesMin[day],
|
||||||
'Localisation - day ' + day);
|
'Localisation - day ' + day);
|
||||||
day = (day + 1) % 7;
|
day = (day + 1) % 7;
|
||||||
});
|
});
|
||||||
inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
inp.simulate('keydown', {keyCode: $.ui.keyCode.ENTER});
|
||||||
var date = new Date();
|
date = new Date();
|
||||||
equal(inp.val(), $.datepicker.regional['fr'].dayNames[date.getDay()] + ', ' +
|
equal(inp.val(), $.datepicker.regional.fr.dayNames[date.getDay()] + ', ' +
|
||||||
date.getDate() + ' ' + $.datepicker.regional['fr'].monthNames[date.getMonth()] +
|
date.getDate() + ' ' + $.datepicker.regional.fr.monthNames[date.getMonth()] +
|
||||||
' ' + date.getFullYear(), 'Localisation - formatting');
|
' ' + date.getFullYear(), 'Localisation - formatting');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('noWeekends', function() {
|
test('noWeekends', function() {
|
||||||
for (var i = 1; i <= 31; i++) {
|
var i, date;
|
||||||
var date = new Date(2001, 1 - 1, i);
|
for (i = 1; i <= 31; i++) {
|
||||||
|
date = new Date(2001, 1 - 1, i);
|
||||||
deepEqual($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ''],
|
deepEqual($.datepicker.noWeekends(date), [(i + 1) % 7 >= 2, ''],
|
||||||
'No weekends ' + date);
|
'No weekends ' + date);
|
||||||
}
|
}
|
||||||
@ -769,6 +759,7 @@ test('iso8601Week', function() {
|
|||||||
|
|
||||||
test('parseDate', function() {
|
test('parseDate', function() {
|
||||||
init('#inp');
|
init('#inp');
|
||||||
|
var currentYear, gmtDate, fr, settings, zh;
|
||||||
ok($.datepicker.parseDate('d m y', '') == null, 'Parse date empty');
|
ok($.datepicker.parseDate('d m y', '') == null, 'Parse date empty');
|
||||||
equalsDate($.datepicker.parseDate('d m y', '3 2 01'),
|
equalsDate($.datepicker.parseDate('d m y', '3 2 01'),
|
||||||
new Date(2001, 2 - 1, 3), 'Parse date d m y');
|
new Date(2001, 2 - 1, 3), 'Parse date d m y');
|
||||||
@ -793,7 +784,7 @@ test('parseDate', function() {
|
|||||||
equalsDate($.datepicker.parseDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
|
equalsDate($.datepicker.parseDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
|
||||||
'day 3 of February (\'Saturday\'), 2001'), new Date(2001, 2 - 1, 3),
|
'day 3 of February (\'Saturday\'), 2001'), new Date(2001, 2 - 1, 3),
|
||||||
'Parse date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
|
'Parse date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
|
||||||
var currentYear = new Date().getFullYear();
|
currentYear = new Date().getFullYear();
|
||||||
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000) + '-02-03'),
|
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000) + '-02-03'),
|
||||||
new Date(currentYear, 2 - 1, 3), 'Parse date y-m-d - default cutuff');
|
new Date(currentYear, 2 - 1, 3), 'Parse date y-m-d - default cutuff');
|
||||||
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 10) + '-02-03'),
|
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 10) + '-02-03'),
|
||||||
@ -808,12 +799,12 @@ test('parseDate', function() {
|
|||||||
new Date(currentYear + 60, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
|
new Date(currentYear + 60, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
|
||||||
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 61) + '-02-03', {shortYearCutoff: '+60'}),
|
equalsDate($.datepicker.parseDate('y-m-d', (currentYear - 2000 + 61) + '-02-03', {shortYearCutoff: '+60'}),
|
||||||
new Date(currentYear - 39, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
|
new Date(currentYear - 39, 2 - 1, 3), 'Parse date y-m-d - cutoff +60');
|
||||||
var gmtDate = new Date(2001, 2 - 1, 3);
|
gmtDate = new Date(2001, 2 - 1, 3);
|
||||||
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
|
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
|
||||||
equalsDate($.datepicker.parseDate('@', '981158400000'), gmtDate, 'Parse date @');
|
equalsDate($.datepicker.parseDate('@', '981158400000'), gmtDate, 'Parse date @');
|
||||||
equalsDate($.datepicker.parseDate('!', '631167552000000000'), gmtDate, 'Parse date !');
|
equalsDate($.datepicker.parseDate('!', '631167552000000000'), gmtDate, 'Parse date !');
|
||||||
var fr = $.datepicker.regional['fr'];
|
fr = $.datepicker.regional.fr;
|
||||||
var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
||||||
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
|
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
|
||||||
equalsDate($.datepicker.parseDate('D d M y', 'Lun. 9 Avril 01', settings),
|
equalsDate($.datepicker.parseDate('D d M y', 'Lun. 9 Avril 01', settings),
|
||||||
new Date(2001, 4 - 1, 9), 'Parse date D M y with settings');
|
new Date(2001, 4 - 1, 9), 'Parse date D M y with settings');
|
||||||
@ -825,14 +816,15 @@ test('parseDate', function() {
|
|||||||
'jour 9 de Avril (\'Lundi\'), 2001', settings), new Date(2001, 4 - 1, 9),
|
'jour 9 de Avril (\'Lundi\'), 2001', settings), new Date(2001, 4 - 1, 9),
|
||||||
'Parse date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings');
|
'Parse date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings');
|
||||||
|
|
||||||
var zh = $.datepicker.regional['zh-CN'];
|
zh = $.datepicker.regional['zh-CN'];
|
||||||
equalsDate($.datepicker.parseDate('yy M d', '2011 十一 22', zh),
|
equalsDate($.datepicker.parseDate('yy M d', '2011 十一 22', zh),
|
||||||
new Date(2011, 11 - 1, 22), 'Parse date yy M d with zh-CN');
|
new Date(2011, 11 - 1, 22), 'Parse date yy M d with zh-CN');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('parseDateErrors', function() {
|
test('parseDateErrors', function() {
|
||||||
init('#inp');
|
init('#inp');
|
||||||
var expectError = function(expr, value, error) {
|
var fr, settings;
|
||||||
|
function expectError(expr, value, error) {
|
||||||
try {
|
try {
|
||||||
expr();
|
expr();
|
||||||
ok(false, 'Parsed error ' + value);
|
ok(false, 'Parsed error ' + value);
|
||||||
@ -840,7 +832,7 @@ test('parseDateErrors', function() {
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
equal(e, error, 'Parsed error ' + value);
|
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');
|
'Sat 2 01', 'Invalid arguments');
|
||||||
expectError(function() { $.datepicker.parseDate('d m y', null); },
|
expectError(function() { $.datepicker.parseDate('d m y', null); },
|
||||||
@ -872,8 +864,8 @@ test('parseDateErrors', function() {
|
|||||||
'day 3 of Mon2 ("Day7"), 2001', 'Unexpected literal at position 19');
|
'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');
|
'29 2 01 - d m y', 'Invalid date');
|
||||||
var fr = $.datepicker.regional['fr'];
|
fr = $.datepicker.regional.fr;
|
||||||
var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
||||||
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
|
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');
|
'Mon 9 Avr 01 - D d M y', 'Unknown name at position 0');
|
||||||
@ -883,6 +875,7 @@ test('parseDateErrors', function() {
|
|||||||
|
|
||||||
test('formatDate', function() {
|
test('formatDate', function() {
|
||||||
init('#inp');
|
init('#inp');
|
||||||
|
var gmtDate, fr, settings;
|
||||||
equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)),
|
equal($.datepicker.formatDate('d m y', new Date(2001, 2 - 1, 3)),
|
||||||
'3 2 01', 'Format date d m y');
|
'3 2 01', 'Format date d m y');
|
||||||
equal($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)),
|
equal($.datepicker.formatDate('dd mm yy', new Date(2001, 2 - 1, 3)),
|
||||||
@ -904,12 +897,12 @@ test('formatDate', function() {
|
|||||||
equal($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
|
equal($.datepicker.formatDate('\'day\' d \'of\' MM (\'\'DD\'\'), yy',
|
||||||
new Date(2001, 2 - 1, 3)), 'day 3 of February (\'Saturday\'), 2001',
|
new Date(2001, 2 - 1, 3)), 'day 3 of February (\'Saturday\'), 2001',
|
||||||
'Format date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
|
'Format date \'day\' d \'of\' MM (\'\'DD\'\'), yy');
|
||||||
var gmtDate = new Date(2001, 2 - 1, 3);
|
gmtDate = new Date(2001, 2 - 1, 3);
|
||||||
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
|
gmtDate.setMinutes(gmtDate.getMinutes() - gmtDate.getTimezoneOffset());
|
||||||
equal($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @');
|
equal($.datepicker.formatDate('@', gmtDate), '981158400000', 'Format date @');
|
||||||
equal($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !');
|
equal($.datepicker.formatDate('!', gmtDate), '631167552000000000', 'Format date !');
|
||||||
var fr = $.datepicker.regional['fr'];
|
fr = $.datepicker.regional.fr;
|
||||||
var settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
settings = {dayNamesShort: fr.dayNamesShort, dayNames: fr.dayNames,
|
||||||
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
|
monthNamesShort: fr.monthNamesShort, monthNames: fr.monthNames};
|
||||||
equal($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings),
|
equal($.datepicker.formatDate('D M y', new Date(2001, 4 - 1, 9), settings),
|
||||||
'Lun. Avril 01', 'Format date D M y with settings');
|
'Lun. Avril 01', 'Format date D M y with settings');
|
||||||
|
@ -7,8 +7,8 @@ module("datepicker: tickets");
|
|||||||
|
|
||||||
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
|
// http://forum.jquery.com/topic/several-breaking-changes-in-jquery-ui-1-8rc1
|
||||||
test('beforeShowDay-getDate', function() {
|
test('beforeShowDay-getDate', function() {
|
||||||
var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }});
|
var inp = init('#inp', {beforeShowDay: function(date) { inp.datepicker('getDate'); return [true, '']; }}),
|
||||||
var dp = $('#ui-datepicker-div');
|
dp = $('#ui-datepicker-div');
|
||||||
inp.val('01/01/2010').datepicker('show');
|
inp.val('01/01/2010').datepicker('show');
|
||||||
// contains non-breaking space
|
// contains non-breaking space
|
||||||
equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month');
|
equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month');
|
||||||
@ -29,8 +29,8 @@ test('Ticket 7602: Stop datepicker from appearing with beforeShow event handler'
|
|||||||
beforeShow: function(){
|
beforeShow: function(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
var dp = $('#ui-datepicker-div');
|
dp = $('#ui-datepicker-div');
|
||||||
inp.datepicker('show');
|
inp.datepicker('show');
|
||||||
equal(dp.css('display'), 'none',"beforeShow returns false");
|
equal(dp.css('display'), 'none',"beforeShow returns false");
|
||||||
inp.datepicker('destroy');
|
inp.datepicker('destroy');
|
||||||
|
@ -40,8 +40,8 @@ function drag(handle, dx, dy) {
|
|||||||
|
|
||||||
function moved(dx, dy, msg) {
|
function moved(dx, dy, msg) {
|
||||||
msg = msg ? msg + "." : "";
|
msg = msg ? msg + "." : "";
|
||||||
var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) };
|
var actual = { left: Math.round(offsetAfter.left), top: Math.round(offsetAfter.top) },
|
||||||
var expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) };
|
expected = { left: Math.round(offsetBefore.left + dx), top: Math.round(offsetBefore.top + dy) };
|
||||||
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ function shouldnotmove(why) {
|
|||||||
|
|
||||||
function resized(dw, dh, msg) {
|
function resized(dw, dh, msg) {
|
||||||
msg = msg ? msg + "." : "";
|
msg = msg ? msg + "." : "";
|
||||||
var actual = { width: widthAfter, height: heightAfter };
|
var actual = { width: widthAfter, height: heightAfter },
|
||||||
var expected = { width: widthBefore + dw, height: heightBefore + dh };
|
expected = { width: widthBefore + dw, height: heightBefore + dh };
|
||||||
deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
deepEqual(actual, expected, 'resized[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "dialog", {
|
TestHelpers.commonWidgetTests( "dialog", {
|
||||||
defaults: {
|
defaults: {
|
||||||
autoOpen: true,
|
autoOpen: true,
|
||||||
buttons: {},
|
buttons: {},
|
||||||
|
@ -63,7 +63,8 @@ test("dragStart", function() {
|
|||||||
|
|
||||||
test("drag", function() {
|
test("drag", function() {
|
||||||
expect(9);
|
expect(9);
|
||||||
var hasDragged = false;
|
var handle,
|
||||||
|
hasDragged = false;
|
||||||
|
|
||||||
el = $('<div></div>').dialog({
|
el = $('<div></div>').dialog({
|
||||||
drag: function(ev, ui) {
|
drag: function(ev, ui) {
|
||||||
@ -83,7 +84,7 @@ test("drag", function() {
|
|||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.offset !== undefined, "ui.offset in callback");
|
ok(ui.offset !== undefined, "ui.offset in callback");
|
||||||
});
|
});
|
||||||
var handle = $(".ui-dialog-titlebar", dlg());
|
handle = $(".ui-dialog-titlebar", dlg());
|
||||||
drag(handle, 50, 50);
|
drag(handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
@ -138,7 +139,8 @@ test("resizeStart", function() {
|
|||||||
|
|
||||||
test("resize", function() {
|
test("resize", function() {
|
||||||
expect(13);
|
expect(13);
|
||||||
var hasResized = false;
|
var handle,
|
||||||
|
hasResized = false;
|
||||||
|
|
||||||
el = $('<div></div>').dialog({
|
el = $('<div></div>').dialog({
|
||||||
resize: function(ev, ui) {
|
resize: function(ev, ui) {
|
||||||
@ -162,7 +164,7 @@ test("resize", function() {
|
|||||||
ok(ui.position !== undefined, "ui.position in callback");
|
ok(ui.position !== undefined, "ui.position in callback");
|
||||||
ok(ui.size !== undefined, "ui.size in callback");
|
ok(ui.size !== undefined, "ui.size in callback");
|
||||||
});
|
});
|
||||||
var handle = $(".ui-resizable-se", dlg());
|
handle = $(".ui-resizable-se", dlg());
|
||||||
drag(handle, 50, 50);
|
drag(handle, 50, 50);
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
@ -98,14 +98,17 @@ test("isOpen", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("moveToTop", function() {
|
test("moveToTop", function() {
|
||||||
var expected = $('<div></div>').dialog(),
|
var d1, d2, dlg1, dlg2,
|
||||||
|
expected = $('<div></div>').dialog(),
|
||||||
actual = expected.dialog('moveToTop');
|
actual = expected.dialog('moveToTop');
|
||||||
equal(actual, expected, 'moveToTop is chainable');
|
equal(actual, expected, 'moveToTop is chainable');
|
||||||
|
|
||||||
var d1 = $('<div></div>').dialog(), dlg1 = d1.parents('.ui-dialog');
|
d1 = $('<div></div>').dialog();
|
||||||
|
dlg1 = d1.parents('.ui-dialog');
|
||||||
d1.dialog('close');
|
d1.dialog('close');
|
||||||
d1.dialog('open');
|
d1.dialog('open');
|
||||||
var d2 = $('<div></div>').dialog(), dlg2 = d2.parents('.ui-dialog');
|
d2 = $('<div></div>').dialog();
|
||||||
|
dlg2 = d2.parents('.ui-dialog');
|
||||||
d2.dialog('close');
|
d2.dialog('close');
|
||||||
d2.dialog('open');
|
d2.dialog('open');
|
||||||
ok(dlg1.css('zIndex') < dlg2.css('zIndex'), 'dialog 1 under dialog 2 before moveToTop method called');
|
ok(dlg1.css('zIndex') < dlg2.css('zIndex'), 'dialog 1 under dialog 2 before moveToTop method called');
|
||||||
|
@ -20,7 +20,8 @@ test("autoOpen", function() {
|
|||||||
test("buttons", function() {
|
test("buttons", function() {
|
||||||
expect(21);
|
expect(21);
|
||||||
|
|
||||||
var buttons = {
|
var btn, i, newButtons,
|
||||||
|
buttons = {
|
||||||
"Ok": function(ev, ui) {
|
"Ok": function(ev, ui) {
|
||||||
ok(true, "button click fires callback");
|
ok(true, "button click fires callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
@ -34,10 +35,10 @@ test("buttons", function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ buttons: buttons });
|
el = $('<div></div>').dialog({ buttons: buttons });
|
||||||
var btn = $("button", dlg());
|
btn = $("button", dlg());
|
||||||
equal(btn.length, 2, "number of buttons");
|
equal(btn.length, 2, "number of buttons");
|
||||||
|
|
||||||
var i = 0;
|
i = 0;
|
||||||
$.each(buttons, function(key, val) {
|
$.each(buttons, function(key, val) {
|
||||||
equal(btn.eq(i).text(), key, "text of button " + (i+1));
|
equal(btn.eq(i).text(), key, "text of button " + (i+1));
|
||||||
i++;
|
i++;
|
||||||
@ -48,7 +49,7 @@ test("buttons", function() {
|
|||||||
|
|
||||||
btn.trigger("click");
|
btn.trigger("click");
|
||||||
|
|
||||||
var newButtons = {
|
newButtons = {
|
||||||
"Close": function(ev, ui) {
|
"Close": function(ev, ui) {
|
||||||
ok(true, "button click fires callback");
|
ok(true, "button click fires callback");
|
||||||
equal(this, el[0], "context of callback");
|
equal(this, el[0], "context of callback");
|
||||||
@ -275,54 +276,54 @@ test("minWidth", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("position, default center on window", function() {
|
test("position, default center on window", function() {
|
||||||
var el = $('<div></div>').dialog();
|
var el = $('<div></div>').dialog(),
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
|
deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
|
||||||
deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
|
deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("position, top on window", function() {
|
test("position, top on window", function() {
|
||||||
var el = $('<div></div>').dialog({ position: "top" });
|
var el = $('<div></div>').dialog({ position: "top" }),
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
|
deepEqual(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
|
||||||
deepEqual(offset.top, $(window).scrollTop());
|
deepEqual(offset.top, $(window).scrollTop());
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("position, left on window", function() {
|
test("position, left on window", function() {
|
||||||
var el = $('<div></div>').dialog({ position: "left" });
|
var el = $('<div></div>').dialog({ position: "left" }),
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
deepEqual(offset.left, 0);
|
deepEqual(offset.left, 0);
|
||||||
deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
|
deepEqual(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("position, right bottom on window", function() {
|
test("position, right bottom on window", function() {
|
||||||
var el = $('<div></div>').dialog({ position: "right bottom" });
|
var el = $('<div></div>').dialog({ position: "right bottom" }),
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
||||||
deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("position, right bottom on window w/array", function() {
|
test("position, right bottom on window w/array", function() {
|
||||||
var el = $('<div></div>').dialog({ position: ["right", "bottom"] });
|
var el = $('<div></div>').dialog({ position: ["right", "bottom"] }),
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
||||||
deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
||||||
el.remove();
|
el.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("position, offset from top left w/array", function() {
|
test("position, offset from top left w/array", function() {
|
||||||
var el = $('<div></div>').dialog({ position: [10, 10] });
|
var el = $('<div></div>').dialog({ position: [10, 10] }),
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
deepEqual(offset.left, 10 + $(window).scrollLeft());
|
deepEqual(offset.left, 10 + $(window).scrollLeft());
|
||||||
deepEqual(offset.top, 10 + $(window).scrollTop());
|
deepEqual(offset.top, 10 + $(window).scrollTop());
|
||||||
el.remove();
|
el.remove();
|
||||||
@ -334,10 +335,9 @@ test("position, right bottom at right bottom via ui.position args", function() {
|
|||||||
my: "right bottom",
|
my: "right bottom",
|
||||||
at: "right bottom"
|
at: "right bottom"
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
|
dialog = el.dialog('widget'),
|
||||||
var dialog = el.dialog('widget');
|
offset = dialog.offset();
|
||||||
var offset = dialog.offset();
|
|
||||||
|
|
||||||
deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
deepEqual(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
|
||||||
deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
deepEqual(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
|
||||||
@ -351,18 +351,18 @@ test("position, at another element", function() {
|
|||||||
left: 600,
|
left: 600,
|
||||||
height: 10,
|
height: 10,
|
||||||
width: 10
|
width: 10
|
||||||
}).appendTo('body');
|
}).appendTo('body'),
|
||||||
|
|
||||||
var el = $('<div></div>').dialog({
|
el = $('<div></div>').dialog({
|
||||||
position: {
|
position: {
|
||||||
my: "left top",
|
my: "left top",
|
||||||
at: "left top",
|
at: "left top",
|
||||||
of: parent
|
of: parent
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
|
|
||||||
var dialog = el.dialog('widget');
|
dialog = el.dialog('widget'),
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
|
|
||||||
deepEqual(offset.left, 600);
|
deepEqual(offset.left, 600);
|
||||||
deepEqual(offset.top, 400);
|
deepEqual(offset.top, 400);
|
||||||
@ -373,7 +373,7 @@ test("position, at another element", function() {
|
|||||||
of: parent
|
of: parent
|
||||||
});
|
});
|
||||||
|
|
||||||
var offset = dialog.offset();
|
offset = dialog.offset();
|
||||||
|
|
||||||
deepEqual(offset.left, 610);
|
deepEqual(offset.left, 610);
|
||||||
deepEqual(offset.top, 410);
|
deepEqual(offset.top, 410);
|
||||||
|
@ -12,12 +12,6 @@ asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
|
|||||||
inputs = el.find( "input" ),
|
inputs = el.find( "input" ),
|
||||||
widget = el.dialog( "widget" );
|
widget = el.dialog( "widget" );
|
||||||
|
|
||||||
inputs.eq( 1 ).focus();
|
|
||||||
equal( document.activeElement, inputs[1], "Focus set on second input" );
|
|
||||||
inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
|
|
||||||
|
|
||||||
setTimeout( checkTab, 2 );
|
|
||||||
|
|
||||||
function checkTab() {
|
function checkTab() {
|
||||||
ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
|
ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" );
|
||||||
|
|
||||||
@ -32,14 +26,21 @@ asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() {
|
|||||||
el.remove();
|
el.remove();
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inputs.eq( 1 ).focus();
|
||||||
|
equal( document.activeElement, inputs[1], "Focus set on second input" );
|
||||||
|
inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB });
|
||||||
|
|
||||||
|
setTimeout( checkTab, 2 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("#4826: setting resizable false toggles resizable on dialog", function() {
|
test("#4826: setting resizable false toggles resizable on dialog", function() {
|
||||||
expect(6);
|
expect(6);
|
||||||
|
var i;
|
||||||
|
|
||||||
el = $('<div></div>').dialog({ resizable: false });
|
el = $('<div></div>').dialog({ resizable: false });
|
||||||
shouldnotresize("[default]");
|
shouldnotresize("[default]");
|
||||||
for (var i=0; i<2; i++) {
|
for (i=0; i<2; i++) {
|
||||||
el.dialog('close').dialog('open');
|
el.dialog('close').dialog('open');
|
||||||
shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')');
|
shouldnotresize('initialized with resizable false toggle ('+ (i+1) +')');
|
||||||
}
|
}
|
||||||
@ -47,7 +48,7 @@ test("#4826: setting resizable false toggles resizable on dialog", function() {
|
|||||||
|
|
||||||
el = $('<div></div>').dialog({ resizable: true });
|
el = $('<div></div>').dialog({ resizable: true });
|
||||||
shouldresize("[default]");
|
shouldresize("[default]");
|
||||||
for (var i=0; i<2; i++) {
|
for (i=0; i<2; i++) {
|
||||||
el.dialog('close').dialog('option', 'resizable', false).dialog('open');
|
el.dialog('close').dialog('option', 'resizable', false).dialog('open');
|
||||||
shouldnotresize('set option resizable false toggle ('+ (i+1) +')');
|
shouldnotresize('set option resizable false toggle ('+ (i+1) +')');
|
||||||
}
|
}
|
||||||
@ -108,7 +109,7 @@ test("#6137: dialog('open') causes form elements to reset on IE7", function() {
|
|||||||
test("#6645: Missing element not found check in overlay", function(){
|
test("#6645: Missing element not found check in overlay", function(){
|
||||||
expect(2);
|
expect(2);
|
||||||
d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true});
|
d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true});
|
||||||
d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove()}});
|
d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }});
|
||||||
equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created');
|
equal($.ui.dialog.overlay.instances.length, 2, 'two overlays created');
|
||||||
d2.dialog('close');
|
d2.dialog('close');
|
||||||
equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay');
|
equal($.ui.dialog.overlay.instances.length, 1, 'one overlay remains after closing the 2nd overlay');
|
||||||
@ -119,7 +120,7 @@ test("#6966: Escape key closes all dialogs, not the top one", function(){
|
|||||||
expect(8);
|
expect(8);
|
||||||
// test with close function removing dialog
|
// test with close function removing dialog
|
||||||
d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true});
|
d1 = $('<div title="dialog 1">Dialog 1</div>').dialog({modal: true});
|
||||||
d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove()}});
|
d2 = $('<div title="dialog 2">Dialog 2</div>').dialog({modal: true, close: function(){ d2.remove(); }});
|
||||||
ok(d1.dialog("isOpen"), 'first dialog is open');
|
ok(d1.dialog("isOpen"), 'first dialog is open');
|
||||||
ok(d2.dialog("isOpen"), 'second dialog is open');
|
ok(d2.dialog("isOpen"), 'second dialog is open');
|
||||||
d2.simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
d2.simulate("keydown", {keyCode: $.ui.keyCode.ESCAPE});
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
var el, offsetBefore, offsetAfter, dragged;
|
var el, offsetBefore, offsetAfter, dragged;
|
||||||
|
|
||||||
var drag = function(handle, dx, dy) {
|
function drag(handle, dx, dy) {
|
||||||
var element = el.data("draggable").element;
|
var element = el.data("draggable").element;
|
||||||
offsetBefore = el.offset();
|
offsetBefore = el.offset();
|
||||||
$(handle).simulate("drag", {
|
$(handle).simulate("drag", {
|
||||||
@ -15,10 +15,10 @@ var drag = function(handle, dx, dy) {
|
|||||||
offsetAfter = el.offset();
|
offsetAfter = el.offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
var moved = function (dx, dy, msg) {
|
function moved(dx, dy, msg) {
|
||||||
msg = msg ? msg + "." : "";
|
msg = msg ? msg + "." : "";
|
||||||
var actual = { left: offsetAfter.left, top: offsetAfter.top };
|
var actual = { left: offsetAfter.left, top: offsetAfter.top },
|
||||||
var expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
|
expected = { left: offsetBefore.left + dx, top: offsetBefore.top + dy };
|
||||||
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
deepEqual(actual, expected, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ' + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,15 +35,15 @@ function restoreScroll(what) {
|
|||||||
module("draggable");
|
module("draggable");
|
||||||
|
|
||||||
test("element types", function() {
|
test("element types", function() {
|
||||||
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
|
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form' +
|
||||||
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
|
',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr' +
|
||||||
+ ',acronym,code,samp,kbd,var,img,object,hr'
|
',acronym,code,samp,kbd,var,img,object,hr' +
|
||||||
+ ',input,button,label,select,iframe').split(',');
|
',input,button,label,select,iframe').split(',');
|
||||||
|
|
||||||
$.each(typeNames, function(i) {
|
$.each(typeNames, function(i) {
|
||||||
var typeName = typeNames[i];
|
var typeName = typeNames[i];
|
||||||
el = $(document.createElement(typeName)).appendTo('body');
|
el = $(document.createElement(typeName)).appendTo('body');
|
||||||
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
|
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
|
||||||
el.draggable({ cancel: '' });
|
el.draggable({ cancel: '' });
|
||||||
drag(el, 50, 50);
|
drag(el, 50, 50);
|
||||||
moved(50, 50, "<" + typeName + ">");
|
moved(50, 50, "<" + typeName + ">");
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
/*
|
TestHelpers.commonWidgetTests( "draggable", {
|
||||||
* draggable_defaults.js
|
defaults: {
|
||||||
*/
|
|
||||||
|
|
||||||
var draggable_defaults = {
|
|
||||||
addClasses: true,
|
addClasses: true,
|
||||||
appendTo: "parent",
|
appendTo: "parent",
|
||||||
axis: false,
|
axis: false,
|
||||||
@ -31,6 +28,5 @@ var draggable_defaults = {
|
|||||||
snapTolerance: 20,
|
snapTolerance: 20,
|
||||||
stack: false,
|
stack: false,
|
||||||
zIndex: false
|
zIndex: false
|
||||||
};
|
}
|
||||||
|
});
|
||||||
commonWidgetTests('draggable', { defaults: draggable_defaults });
|
|
||||||
|
@ -17,15 +17,16 @@ function setScroll(what) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var border = function(el, side) { return parseInt(el.css('border-' + side + '-width')); }
|
function border(el, side) {
|
||||||
|
return parseInt(el.css('border-' + side + '-width'), 10);
|
||||||
var margin = function(el, side) { return parseInt(el.css('margin-' + side)); }
|
}
|
||||||
|
function margin(el, side) {
|
||||||
|
return parseInt(el.css('margin-' + side), 10);
|
||||||
|
}
|
||||||
|
|
||||||
module("draggable: options");
|
module("draggable: options");
|
||||||
|
|
||||||
test("{ addClasses: true }, default", function() {
|
test("{ addClasses: true }, default", function() {
|
||||||
equal(draggable_defaults.addClasses, true);
|
|
||||||
|
|
||||||
el = $("<div></div>").draggable({ addClasses: true });
|
el = $("<div></div>").draggable({ addClasses: true });
|
||||||
ok(el.is(".ui-draggable"), "'ui-draggable' class added");
|
ok(el.is(".ui-draggable"), "'ui-draggable' class added");
|
||||||
|
|
||||||
@ -40,8 +41,6 @@ test("{ addClasses: false }", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("{ appendTo: 'parent' }, default", function() {
|
test("{ appendTo: 'parent' }, default", function() {
|
||||||
equal(draggable_defaults.appendTo, "parent");
|
|
||||||
|
|
||||||
el = $("#draggable2").draggable({ appendTo: 'parent' });
|
el = $("#draggable2").draggable({ appendTo: 'parent' });
|
||||||
drag(el, 50, 50);
|
drag(el, 50, 50);
|
||||||
moved(50, 50);
|
moved(50, 50);
|
||||||
@ -73,8 +72,6 @@ test("{ appendTo: Selector }", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("{ axis: false }, default", function() {
|
test("{ axis: false }, default", function() {
|
||||||
equal(draggable_defaults.axis, false);
|
|
||||||
|
|
||||||
el = $("#draggable2").draggable({ axis: false });
|
el = $("#draggable2").draggable({ axis: false });
|
||||||
drag(el, 50, 50);
|
drag(el, 50, 50);
|
||||||
moved(50, 50);
|
moved(50, 50);
|
||||||
@ -106,12 +103,10 @@ test("{ axis: ? }, unexpected", function() {
|
|||||||
drag(el, 50, 50);
|
drag(el, 50, 50);
|
||||||
moved(50, 50, "axis: " + key);
|
moved(50, 50, "axis: " + key);
|
||||||
el.draggable("destroy");
|
el.draggable("destroy");
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ cancel: ':input,option' }, default", function() {
|
test("{ cancel: ':input,option' }, default", function() {
|
||||||
equal(draggable_defaults.cancel, ":input,option");
|
|
||||||
|
|
||||||
$('<div id="draggable-option-cancel-default"><input type="text"></div>').appendTo('#main');
|
$('<div id="draggable-option-cancel-default"><input type="text"></div>').appendTo('#main');
|
||||||
|
|
||||||
el = $("#draggable-option-cancel-default").draggable({ cancel: ":input,option" });
|
el = $("#draggable-option-cancel-default").draggable({ cancel: ":input,option" });
|
||||||
@ -155,12 +150,10 @@ test("{ cancel: ? }, unexpected", function() {
|
|||||||
var expected = [50, 50];
|
var expected = [50, 50];
|
||||||
moved(expected[0], expected[1], "cancel: " + key);
|
moved(expected[0], expected[1], "cancel: " + key);
|
||||||
el.draggable("destroy");
|
el.draggable("destroy");
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: false }, default", function() {
|
test("{ containment: false }, default", function() {
|
||||||
equal(draggable_defaults.containment, false);
|
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, 'missing test - untested code is broken code');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -170,23 +163,25 @@ test("{ containment: Element }", function() {
|
|||||||
|
|
||||||
test("{ containment: 'parent' }, relative", function() {
|
test("{ containment: 'parent' }, relative", function() {
|
||||||
el = $("#draggable1").draggable({ containment: 'parent' });
|
el = $("#draggable1").draggable({ containment: 'parent' });
|
||||||
var p = el.parent(), po = p.offset();
|
var p = el.parent(),
|
||||||
drag(el, -100, -100);
|
po = p.offset(),
|
||||||
var expected = {
|
expected = {
|
||||||
left: po.left + border(p, 'left') + margin(el, 'left'),
|
left: po.left + border(p, 'left') + margin(el, 'left'),
|
||||||
top: po.top + border(p, 'top') + margin(el, 'top')
|
top: po.top + border(p, 'top') + margin(el, 'top')
|
||||||
}
|
};
|
||||||
|
drag(el, -100, -100);
|
||||||
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("{ containment: 'parent' }, absolute", function() {
|
test("{ containment: 'parent' }, absolute", function() {
|
||||||
el = $("#draggable2").draggable({ containment: 'parent' });
|
el = $("#draggable2").draggable({ containment: 'parent' });
|
||||||
var p = el.parent(), po = p.offset();
|
var p = el.parent(),
|
||||||
drag(el, -100, -100);
|
po = p.offset(),
|
||||||
var expected = {
|
expected = {
|
||||||
left: po.left + border(p, 'left') + margin(el, 'left'),
|
left: po.left + border(p, 'left') + margin(el, 'left'),
|
||||||
top: po.top + border(p, 'top') + margin(el, 'top')
|
top: po.top + border(p, 'top') + margin(el, 'top')
|
||||||
}
|
};
|
||||||
|
drag(el, -100, -100);
|
||||||
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
deepEqual(offsetAfter, expected, 'compare offset to parent');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -207,11 +202,9 @@ test("{ containment: [x1, y1, x2, y2] }", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("{ cursor: 'auto' }, default", function() {
|
test("{ cursor: 'auto' }, default", function() {
|
||||||
equal(draggable_defaults.cursor, 'auto');
|
|
||||||
|
|
||||||
function getCursor() { return $("#draggable2").css("cursor"); }
|
function getCursor() { return $("#draggable2").css("cursor"); }
|
||||||
|
|
||||||
expect(3);
|
expect(2);
|
||||||
|
|
||||||
var expected = "auto", actual, before, after;
|
var expected = "auto", actual, before, after;
|
||||||
|
|
||||||
@ -256,8 +249,6 @@ test("{ cursor: 'move' }", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("{ cursorAt: false}, default", function() {
|
test("{ cursorAt: false}, default", function() {
|
||||||
equal(draggable_defaults.cursorAt, false);
|
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, 'missing test - untested code is broken code');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -611,8 +602,8 @@ test("{ helper: 'original' }, fixed, with scroll offset on root and parent", fun
|
|||||||
|
|
||||||
test("{ helper: 'clone' }, absolute", function() {
|
test("{ helper: 'clone' }, absolute", function() {
|
||||||
|
|
||||||
var helperOffset = null;
|
var helperOffset = null,
|
||||||
var origOffset = $("#draggable1").offset();
|
origOffset = $("#draggable1").offset();
|
||||||
|
|
||||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
@ -626,8 +617,8 @@ test("{ helper: 'clone' }, absolute", function() {
|
|||||||
test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
||||||
|
|
||||||
setScroll();
|
setScroll();
|
||||||
var helperOffset = null;
|
var helperOffset = null,
|
||||||
var origOffset = null;
|
origOffset = null;
|
||||||
|
|
||||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
@ -655,8 +646,8 @@ test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
|||||||
test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
|
test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
|
||||||
|
|
||||||
setScroll('root');
|
setScroll('root');
|
||||||
var helperOffset = null;
|
var helperOffset = null,
|
||||||
var origOffset = null;
|
origOffset = null;
|
||||||
|
|
||||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
@ -685,25 +676,25 @@ test("{ helper: 'clone' }, absolute with scroll offset on root and parent", func
|
|||||||
|
|
||||||
setScroll('root');
|
setScroll('root');
|
||||||
setScroll();
|
setScroll();
|
||||||
var helperOffset = null;
|
var helperOffset = null,
|
||||||
var origOffset = null;
|
origOffset = null;
|
||||||
|
|
||||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||||
helperOffset = ui.helper.offset();
|
helperOffset = ui.helper.offset();
|
||||||
} });
|
} });
|
||||||
|
|
||||||
$("#main").css('position', 'relative');
|
$("#main").css('position', 'relative');
|
||||||
origOffset = $("#draggable1").offset()
|
origOffset = $("#draggable1").offset();
|
||||||
drag(el, 1, 1);
|
drag(el, 1, 1);
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||||
|
|
||||||
$("#main").css('position', 'static');
|
$("#main").css('position', 'static');
|
||||||
origOffset = $("#draggable1").offset()
|
origOffset = $("#draggable1").offset();
|
||||||
drag(el, 1, 1);
|
drag(el, 1, 1);
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||||
|
|
||||||
$("#main").css('position', 'absolute');
|
$("#main").css('position', 'absolute');
|
||||||
origOffset = $("#draggable1").offset()
|
origOffset = $("#draggable1").offset();
|
||||||
drag(el, 1, 1);
|
drag(el, 1, 1);
|
||||||
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
deepEqual({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||||
|
|
||||||
@ -734,9 +725,9 @@ test("{ zIndex: 10 }", function() {
|
|||||||
|
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var expected = 10, actual;
|
var actual,
|
||||||
|
expected = 10,
|
||||||
var zIndex = null;
|
zIndex = null;
|
||||||
el = $("#draggable2").draggable({
|
el = $("#draggable2").draggable({
|
||||||
zIndex: expected,
|
zIndex: expected,
|
||||||
start: function(event, ui) {
|
start: function(event, ui) {
|
||||||
|
@ -17,15 +17,15 @@ function shouldNotBeDroppable() {
|
|||||||
module("droppable: core");
|
module("droppable: core");
|
||||||
|
|
||||||
test("element types", function() {
|
test("element types", function() {
|
||||||
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form'
|
var typeNames = ('p,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,div,form' +
|
||||||
+ ',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr'
|
',table,fieldset,address,ins,del,em,strong,q,cite,dfn,abbr' +
|
||||||
+ ',acronym,code,samp,kbd,var,img,object,hr'
|
',acronym,code,samp,kbd,var,img,object,hr' +
|
||||||
+ ',input,button,label,select,iframe').split(',');
|
',input,button,label,select,iframe').split(',');
|
||||||
|
|
||||||
$.each(typeNames, function(i) {
|
$.each(typeNames, function(i) {
|
||||||
var typeName = typeNames[i];
|
var typeName = typeNames[i];
|
||||||
el = $(document.createElement(typeName)).appendTo('body');
|
el = $(document.createElement(typeName)).appendTo('body');
|
||||||
(typeName == 'table' && el.append("<tr><td>content</td></tr>"));
|
(typeName === 'table' && el.append("<tr><td>content</td></tr>"));
|
||||||
el.droppable();
|
el.droppable();
|
||||||
shouldBeDroppable();
|
shouldBeDroppable();
|
||||||
el.droppable("destroy");
|
el.droppable("destroy");
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
/*
|
TestHelpers.commonWidgetTests( "droppable", {
|
||||||
* droppable_defaults.js
|
defaults: {
|
||||||
*/
|
accept: "*",
|
||||||
|
|
||||||
var droppable_defaults = {
|
|
||||||
accept: '*',
|
|
||||||
activeClass: false,
|
activeClass: false,
|
||||||
addClasses: true,
|
addClasses: true,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@ -11,6 +8,5 @@ var droppable_defaults = {
|
|||||||
hoverClass: false,
|
hoverClass: false,
|
||||||
scope: "default",
|
scope: "default",
|
||||||
tolerance: "intersect"
|
tolerance: "intersect"
|
||||||
};
|
}
|
||||||
|
});
|
||||||
commonWidgetTests('droppable', { defaults: droppable_defaults });
|
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
module("droppable: options");
|
module("droppable: options");
|
||||||
|
|
||||||
test("{ accept '*' }, default ", function() {
|
test("{ accept '*' }, default ", function() {
|
||||||
equal(droppable_defaults.accept, '*');
|
|
||||||
|
|
||||||
ok(false, 'missing test - untested code is broken code');
|
ok(false, 'missing test - untested code is broken code');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -24,8 +22,6 @@ test("activeClass", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("{ addClasses: true }, default", function() {
|
test("{ addClasses: true }, default", function() {
|
||||||
equal(droppable_defaults.addClasses, true);
|
|
||||||
|
|
||||||
el = $("<div></div>").droppable({ addClasses: true });
|
el = $("<div></div>").droppable({ addClasses: true });
|
||||||
ok(el.is(".ui-droppable"), "'ui-droppable' class added");
|
ok(el.is(".ui-droppable"), "'ui-droppable' class added");
|
||||||
el.droppable("destroy");
|
el.droppable("destroy");
|
||||||
|
@ -113,17 +113,17 @@ asyncTest( "animateClass clears style properties when stopped", function() {
|
|||||||
asyncTest( "animateClass: css and class changes during animation are not lost (#7106)", function() {
|
asyncTest( "animateClass: css and class changes during animation are not lost (#7106)", function() {
|
||||||
var test = $( "div.ticket7106" );
|
var test = $( "div.ticket7106" );
|
||||||
|
|
||||||
// add a class and change a style property after starting an animated class
|
|
||||||
test.addClass( "animate", minDuration, animationComplete )
|
|
||||||
.addClass( "testClass" )
|
|
||||||
.height( 100 );
|
|
||||||
|
|
||||||
// ensure the class stays and that the css property stays
|
// ensure the class stays and that the css property stays
|
||||||
function animationComplete() {
|
function animationComplete() {
|
||||||
ok( test.hasClass( "testClass" ), "class change during animateClass was not lost" );
|
ok( test.hasClass( "testClass" ), "class change during animateClass was not lost" );
|
||||||
equal( test.height(), 100, "css change during animateClass was not lost" );
|
equal( test.height(), 100, "css change during animateClass was not lost" );
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add a class and change a style property after starting an animated class
|
||||||
|
test.addClass( "animate", minDuration, animationComplete )
|
||||||
|
.addClass( "testClass" )
|
||||||
|
.height( 100 );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -133,10 +133,9 @@ $.each( $.effects.effect, function( effect ) {
|
|||||||
}
|
}
|
||||||
module( "effect."+effect );
|
module( "effect."+effect );
|
||||||
asyncTest( "show/hide", function() {
|
asyncTest( "show/hide", function() {
|
||||||
var hidden = $( "div.hidden" );
|
|
||||||
expect( 8 );
|
expect( 8 );
|
||||||
|
var hidden = $( "div.hidden" ),
|
||||||
var count = 0,
|
count = 0,
|
||||||
test = 0;
|
test = 0;
|
||||||
|
|
||||||
function queueTest( fn ) {
|
function queueTest( fn ) {
|
||||||
|
@ -4,6 +4,11 @@ module( "effect.scale: Scale" );
|
|||||||
function run( position, v, h, vo, ho ) {
|
function run( position, v, h, vo, ho ) {
|
||||||
var desc = "End Position Correct: " + position + " (" + v + "," + h + ") - origin: (" + vo + "," + ho + ")";
|
var desc = "End Position Correct: " + position + " (" + v + "," + h + ") - origin: (" + vo + "," + ho + ")";
|
||||||
asyncTest( desc, function() {
|
asyncTest( desc, function() {
|
||||||
|
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 );
|
||||||
|
start();
|
||||||
|
}
|
||||||
var test = $( ".testScale" ),
|
var test = $( ".testScale" ),
|
||||||
css = {
|
css = {
|
||||||
position: position
|
position: position
|
||||||
@ -21,22 +26,16 @@ function run( position, v, h, vo, ho ) {
|
|||||||
|
|
||||||
css[ h ] = 33;
|
css[ h ] = 33;
|
||||||
css[ v ] = 33;
|
css[ v ] = 33;
|
||||||
target[ h ] = h === ho ? css[ h ] : ho == "center" ? css[ h ] - 35 : css[ h ] - 70;
|
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;
|
target[ v ] = v === vo ? css[ v ] : vo === "middle" ? css[ v ] - 35 : css[ v ] - 70;
|
||||||
if ( relative && h == "right" ) {
|
if ( relative && h === "right" ) {
|
||||||
target[ h ] += 70;
|
target[ h ] += 70;
|
||||||
}
|
}
|
||||||
if ( relative && v == "bottom" ) {
|
if ( relative && v === "bottom" ) {
|
||||||
target[ v ] += 70;
|
target[ v ] += 70;
|
||||||
}
|
}
|
||||||
test.css( css );
|
test.css( css );
|
||||||
test.effect( effect );
|
test.effect( effect );
|
||||||
|
|
||||||
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 );
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +251,22 @@
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ul id="menu6">
|
||||||
|
<li class="foo"><a class="foo" href="#">Aberdeen</a></li>
|
||||||
|
<li class="foo ui-state-disabled"><a class="foo" href="#">Ada</a></li>
|
||||||
|
<li class="foo"><a class="foo" href="#">Adamsville</a></li>
|
||||||
|
<li class="foo"><a class="foo" href="#">Addyston</a></li>
|
||||||
|
<li class="ui-state-disabled">
|
||||||
|
<a href="#">Delphi</a>
|
||||||
|
<ul>
|
||||||
|
<li class="foo"><a class="foo" href="#">Ada</a></li>
|
||||||
|
<li class="foo"><a class="foo" href="#">Saarland</a></li>
|
||||||
|
<li class="foo"><a class="foo" href="#">Salzburg</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="foo"><a class="foo" href="#">Saarland</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,18 +9,19 @@ module("menu: core");
|
|||||||
|
|
||||||
test("accessibility", function () {
|
test("accessibility", function () {
|
||||||
expect(5);
|
expect(5);
|
||||||
var menu = $('#menu1').menu();
|
var item,
|
||||||
var item0 = $("li:eq(0) a");
|
menu = $('#menu1').menu(),
|
||||||
|
item0 = $("li:eq(0) a");
|
||||||
|
|
||||||
ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
|
ok( menu.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class");
|
||||||
equal( menu.attr("role"), "menu", "main role");
|
equal( menu.attr("role"), "menu", "main role");
|
||||||
ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active");
|
ok( !menu.attr("aria-activedescendant"), "aria attribute not yet active");
|
||||||
|
|
||||||
var item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
|
item = menu.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end();
|
||||||
menu.menu( "focus", $.Event(), item );
|
menu.menu( "focus", $.Event(), item );
|
||||||
equal( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom");
|
equal( menu.attr("aria-activedescendant"), "xid", "aria attribute, id from dom");
|
||||||
|
|
||||||
var item = menu.find( "li:last" );
|
item = menu.find( "li:last" );
|
||||||
menu.menu( "focus", $.Event(), item );
|
menu.menu( "focus", $.Event(), item );
|
||||||
equal( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id");
|
equal( menu.attr("aria-activedescendant"), "menu1-4", "aria attribute, generated id");
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "menu", {
|
TestHelpers.commonWidgetTests( "menu", {
|
||||||
defaults: {
|
defaults: {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
menus: "ul",
|
menus: "ul",
|
||||||
|
@ -3,21 +3,24 @@
|
|||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
|
var log = TestHelpers.menu.log,
|
||||||
|
click = TestHelpers.menu.click;
|
||||||
|
|
||||||
module("menu: events");
|
module("menu: events");
|
||||||
|
|
||||||
test("handle click on menu", function() {
|
test("handle click on menu", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
var menu = $('#menu1').menu({
|
var menu = $('#menu1').menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log();
|
log();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu_log("click",true);
|
log("click",true);
|
||||||
menu_click($('#menu1'),"1");
|
click($('#menu1'),"1");
|
||||||
menu_log("afterclick");
|
log("afterclick");
|
||||||
menu_click( menu,"2");
|
click( menu,"2");
|
||||||
menu_click($('#menu1'),"3");
|
click($('#menu1'),"3");
|
||||||
menu_click( menu,"1");
|
click( menu,"1");
|
||||||
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
|
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -25,16 +28,16 @@ test("handle click on custom item menu", function() {
|
|||||||
expect(1);
|
expect(1);
|
||||||
var menu = $('#menu5').menu({
|
var menu = $('#menu5').menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log();
|
log();
|
||||||
},
|
},
|
||||||
menus: "div"
|
menus: "div"
|
||||||
});
|
});
|
||||||
menu_log("click",true);
|
log("click",true);
|
||||||
menu_click($('#menu5'),"1");
|
click($('#menu5'),"1");
|
||||||
menu_log("afterclick");
|
log("afterclick");
|
||||||
menu_click( menu,"2");
|
click( menu,"2");
|
||||||
menu_click($('#menu5'),"3");
|
click($('#menu5'),"3");
|
||||||
menu_click( menu,"1");
|
click( menu,"1");
|
||||||
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
|
equal( $("#log").html(), "1,3,2,afterclick,1,click,", "Click order not valid.");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -75,7 +78,7 @@ test( "handle blur on custom item menu: click", function() {
|
|||||||
items: "div"
|
items: "div"
|
||||||
});
|
});
|
||||||
|
|
||||||
menu_click($('#menu5'),"1");
|
click($('#menu5'),"1");
|
||||||
$( "<a>", { id: "remove"} ).appendTo("body").trigger( "click" );
|
$( "<a>", { id: "remove"} ).appendTo("body").trigger( "click" );
|
||||||
|
|
||||||
$("#remove").remove();
|
$("#remove").remove();
|
||||||
@ -84,14 +87,12 @@ test( "handle blur on custom item menu: click", function() {
|
|||||||
|
|
||||||
asyncTest( "handle submenu auto collapse: mouseleave", function() {
|
asyncTest( "handle submenu auto collapse: mouseleave", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var $menu = $( "#menu2" ).menu();
|
var $menu = $( "#menu2" ).menu(),
|
||||||
|
event = $.Event( "mouseenter" );
|
||||||
$menu.find( "li:nth-child(7)" ).trigger( "mouseover" );
|
|
||||||
setTimeout( menumouseleave1, 350 );
|
|
||||||
|
|
||||||
function menumouseleave1() {
|
function menumouseleave1() {
|
||||||
equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
|
equal( $menu.find( "ul[aria-expanded='true']" ).length, 1, "first submenu expanded" );
|
||||||
$menu.find( "li:nth-child(7) li:first" ).trigger( "mouseover" );
|
$menu.menu( "focus", event, $menu.find( "li:nth-child(7) li:first" ) );
|
||||||
setTimeout( menumouseleave2, 350 );
|
setTimeout( menumouseleave2, 350 );
|
||||||
}
|
}
|
||||||
function menumouseleave2() {
|
function menumouseleave2() {
|
||||||
@ -108,18 +109,19 @@ asyncTest( "handle submenu auto collapse: mouseleave", function() {
|
|||||||
equal( $menu.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
|
equal( $menu.find( "ul[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu.find( "li:nth-child(7)" ).trigger( "mouseenter" );
|
||||||
|
setTimeout( menumouseleave1, 350 );
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "handle submenu auto collapse: mouseleave", function() {
|
asyncTest( "handle submenu auto collapse: mouseleave", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var $menu = $( "#menu5" ).menu( { menus: "div" } );
|
var $menu = $( "#menu5" ).menu( { menus: "div" } ),
|
||||||
|
event = $.Event( "mouseenter" );
|
||||||
$menu.find( ":nth-child(7)" ).trigger( "mouseover" );
|
|
||||||
setTimeout( menumouseleave1, 350 );
|
|
||||||
|
|
||||||
function menumouseleave1() {
|
function menumouseleave1() {
|
||||||
equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
|
equal( $menu.find( "div[aria-expanded='true']" ).length, 1, "first submenu expanded" );
|
||||||
$menu.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ).trigger( "mouseover" );
|
$menu.menu( "focus", event, $menu.find( ":nth-child(7)" ).find( "div" ).eq( 0 ).children().eq( 0 ) );
|
||||||
setTimeout( menumouseleave2, 350 );
|
setTimeout( menumouseleave2, 350 );
|
||||||
}
|
}
|
||||||
function menumouseleave2() {
|
function menumouseleave2() {
|
||||||
@ -136,6 +138,10 @@ asyncTest( "handle submenu auto collapse: mouseleave", function() {
|
|||||||
equal( $menu.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
|
equal( $menu.find( "div[aria-expanded='true']" ).length, 0, "first submenu collapsed" );
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu.find( ":nth-child(7)" ).trigger( "mouseenter" );
|
||||||
|
setTimeout( menumouseleave1, 350 );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -143,60 +149,60 @@ test("handle keyboard navigation on menu without scroll and without submenus", f
|
|||||||
expect(12);
|
expect(12);
|
||||||
var element = $('#menu1').menu({
|
var element = $('#menu1').menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log($(ui.item[0]).text());
|
log($(ui.item[0]).text());
|
||||||
},
|
},
|
||||||
focus: function( event, ui ) {
|
focus: function( event, ui ) {
|
||||||
menu_log($(event.target).find(".ui-state-focus").parent().index());
|
log($(event.target).find(".ui-state-focus").parent().index());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.focus();
|
element.focus();
|
||||||
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 } );
|
||||||
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
|
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
equal( $("#log").html(), "1,keydown,", "Keydown UP");
|
equal( $("#log").html(), "1,keydown,", "Keydown UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN");
|
equal( $("#log").html(), "4,keydown,", "Keydown PAGE_DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
||||||
equal( $("#log").html(), "4,keydown,", "Keydown END");
|
equal( $("#log").html(), "4,keydown,", "Keydown END");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||||
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
|
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
|
||||||
});
|
});
|
||||||
@ -205,14 +211,14 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
|
|||||||
expect(14);
|
expect(14);
|
||||||
var element = $('#menu2').menu({
|
var element = $('#menu2').menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log($(ui.item[0]).text());
|
log($(ui.item[0]).text());
|
||||||
},
|
},
|
||||||
focus: function( event, ui ) {
|
focus: function( event, ui ) {
|
||||||
menu_log($(event.target).find(".ui-state-focus").parent().index());
|
log($(event.target).find(".ui-state-focus").parent().index());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.one( "menufocus", function( event, ui ) {
|
element.one( "menufocus", function( event, ui ) {
|
||||||
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 } );
|
||||||
@ -222,16 +228,16 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
|
|||||||
element.focus();
|
element.focus();
|
||||||
|
|
||||||
function menukeyboard1() {
|
function menukeyboard1() {
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
|
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
||||||
|
|
||||||
menu_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.DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } );
|
||||||
@ -245,7 +251,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menukeyboard2() {
|
function menukeyboard2() {
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
equal( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)");
|
equal( $("#log").html(), "4,keydown,", "Keydown LEFT (close submenu)");
|
||||||
|
|
||||||
@ -255,35 +261,35 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menukeyboard3() {
|
function menukeyboard3() {
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN");
|
equal( $("#log").html(), "2,keydown,", "Keydown PAGE_DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
||||||
equal( $("#log").html(), "2,keydown,", "Keydown END");
|
equal( $("#log").html(), "2,keydown,", "Keydown END");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
||||||
equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)");
|
equal( $("#log").html(), "4,keydown,", "Keydown ESCAPE (close submenu)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||||
setTimeout( menukeyboard4, 50 );
|
setTimeout( menukeyboard4, 50 );
|
||||||
}
|
}
|
||||||
@ -291,7 +297,7 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus",
|
|||||||
function menukeyboard4() {
|
function menukeyboard4() {
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
|
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||||
equal( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)");
|
equal( $("#log").html(), "Ada,keydown,", "Keydown ENTER (select item)");
|
||||||
|
|
||||||
@ -303,69 +309,69 @@ test("handle keyboard navigation on menu with scroll and without submenus", func
|
|||||||
expect(14);
|
expect(14);
|
||||||
var element = $('#menu3').menu({
|
var element = $('#menu3').menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log($(ui.item[0]).text());
|
log($(ui.item[0]).text());
|
||||||
},
|
},
|
||||||
focus: function( event, ui ) {
|
focus: function( event, ui ) {
|
||||||
menu_log($(event.target).find(".ui-state-focus").parent().index());
|
log($(event.target).find(".ui-state-focus").parent().index());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.focus();
|
element.focus();
|
||||||
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 } );
|
||||||
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
|
equal( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
|
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
|
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
|
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
|
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown PAGE_UP (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
||||||
equal( $("#log").html(), "37,keydown,", "Keydown END");
|
equal( $("#log").html(), "37,keydown,", "Keydown END");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown PAGE_DOWN (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown ESCAPE (no effect)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||||
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
|
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER");
|
||||||
});
|
});
|
||||||
@ -374,14 +380,14 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
|
|||||||
expect(14);
|
expect(14);
|
||||||
var element = $('#menu4').menu({
|
var element = $('#menu4').menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log($(ui.item[0]).text());
|
log($(ui.item[0]).text());
|
||||||
},
|
},
|
||||||
focus: function( event, ui ) {
|
focus: function( event, ui ) {
|
||||||
menu_log($(event.target).find(".ui-state-focus").parent().index());
|
log($(event.target).find(".ui-state-focus").parent().index());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.one( "menufocus", function( event, ui ) {
|
element.one( "menufocus", function( event, ui ) {
|
||||||
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 } );
|
||||||
@ -392,16 +398,16 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
|
|||||||
|
|
||||||
|
|
||||||
function menukeyboard1() {
|
function menukeyboard1() {
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
|
||||||
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
|
equal( $("#log").html(), "0,1,keydown,", "Keydown UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
||||||
|
|
||||||
menu_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 } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
|
||||||
|
|
||||||
@ -412,7 +418,7 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menukeyboard2() {
|
function menukeyboard2() {
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
equal( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)");
|
equal( $("#log").html(), "1,keydown,", "Keydown LEFT (close submenu)");
|
||||||
|
|
||||||
@ -422,35 +428,35 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
function menukeyboard3() {
|
function menukeyboard3() {
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
|
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_DOWN } );
|
||||||
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
|
equal( $("#log").html(), "20,keydown,", "Keydown PAGE_DOWN");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
|
equal( $("#log").html(), "10,keydown,", "Keydown PAGE_UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.PAGE_UP } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
equal( $("#log").html(), "0,keydown,", "Keydown PAGE_UP");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.END } );
|
||||||
equal( $("#log").html(), "27,keydown,", "Keydown END");
|
equal( $("#log").html(), "27,keydown,", "Keydown END");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.HOME } );
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
equal( $("#log").html(), "0,keydown,", "Keydown HOME");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ESCAPE } );
|
||||||
equal( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)");
|
equal( $("#log").html(), "1,keydown,", "Keydown ESCAPE (close submenu)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||||
setTimeout( menukeyboard4, 50 );
|
setTimeout( menukeyboard4, 50 );
|
||||||
}
|
}
|
||||||
@ -458,7 +464,7 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
|
|||||||
function menukeyboard4() {
|
function menukeyboard4() {
|
||||||
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
|
equal( $("#log").html(), "0,keydown,", "Keydown ENTER (open submenu)");
|
||||||
|
|
||||||
menu_log("keydown",true);
|
log("keydown",true);
|
||||||
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } );
|
||||||
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)");
|
equal( $("#log").html(), "Aberdeen,keydown,", "Keydown ENTER (select item)");
|
||||||
|
|
||||||
@ -466,4 +472,56 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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("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");
|
||||||
|
setTimeout( menukeyboard1, 50 );
|
||||||
|
});
|
||||||
|
element.focus();
|
||||||
|
|
||||||
|
|
||||||
|
function menukeyboard1() {
|
||||||
|
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");
|
||||||
|
|
||||||
|
log("keydown",true);
|
||||||
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } );
|
||||||
|
equal( $("#log").html(), "keydown,", "Keydown LEFT (no effect)");
|
||||||
|
|
||||||
|
log("keydown",true);
|
||||||
|
element.simulate( "keydown", { keyCode: $.ui.keyCode.RIGHT } );
|
||||||
|
|
||||||
|
setTimeout( function() {
|
||||||
|
equal( $("#log").html(), "keydown,", "Keydown RIGHT (no effect on disabled sub-menu)");
|
||||||
|
|
||||||
|
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);
|
||||||
|
click( element, "1" );
|
||||||
|
equal( $("#log").html(), "click,", "Click disabled item (no effect)");
|
||||||
|
start();
|
||||||
|
}, 50);
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -3,25 +3,28 @@
|
|||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
|
var log = TestHelpers.menu.log,
|
||||||
|
click = TestHelpers.menu.click;
|
||||||
|
|
||||||
module("menu: methods");
|
module("menu: methods");
|
||||||
|
|
||||||
test( "enable/disable", function() {
|
test( "enable/disable", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var menu = $( "#menu1" ).menu({
|
var menu = $( "#menu1" ).menu({
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log();
|
log();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.menu("disable");
|
menu.menu("disable");
|
||||||
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
|
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
|
||||||
menu_log("click",true);
|
log("click",true);
|
||||||
menu_click(menu,"1");
|
click(menu,"1");
|
||||||
menu_log("afterclick");
|
log("afterclick");
|
||||||
menu.menu("enable");
|
menu.menu("enable");
|
||||||
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
|
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
|
||||||
menu_log("click");
|
log("click");
|
||||||
menu_click(menu,"1");
|
click(menu,"1");
|
||||||
menu_log("afterclick");
|
log("afterclick");
|
||||||
equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid.");
|
equal( $("#log").html(), "afterclick,1,click,afterclick,click,", "Click order not valid.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
|
var log = TestHelpers.menu.log,
|
||||||
|
click = TestHelpers.menu.click;
|
||||||
|
|
||||||
module("menu: options");
|
module("menu: options");
|
||||||
|
|
||||||
test( "{ disabled: true }", function() {
|
test( "{ disabled: true }", function() {
|
||||||
@ -10,13 +13,13 @@ test( "{ disabled: true }", function() {
|
|||||||
var menu = $( "#menu1" ).menu({
|
var menu = $( "#menu1" ).menu({
|
||||||
disabled: true,
|
disabled: true,
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log();
|
log();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
|
ok(menu.is(".ui-state-disabled"),"Missing ui-state-disabled class");
|
||||||
menu_log("click",true);
|
log("click",true);
|
||||||
menu_click(menu,"1");
|
click(menu,"1");
|
||||||
menu_log("afterclick");
|
log("afterclick");
|
||||||
equal( $("#log").html(), "afterclick,click,", "Click order not valid.");
|
equal( $("#log").html(), "afterclick,click,", "Click order not valid.");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -25,13 +28,13 @@ test( "{ disabled: false }", function() {
|
|||||||
var menu = $( "#menu1" ).menu({
|
var menu = $( "#menu1" ).menu({
|
||||||
disabled: false,
|
disabled: false,
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
menu_log();
|
log();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
|
ok(menu.not(".ui-state-disabled"),"Has ui-state-disabled class");
|
||||||
menu_log("click",true);
|
log("click",true);
|
||||||
menu_click(menu,"1");
|
click(menu,"1");
|
||||||
menu_log("afterclick");
|
log("afterclick");
|
||||||
equal( $("#log").html(), "afterclick,1,click,", "Click order not valid.");
|
equal( $("#log").html(), "afterclick,1,click,", "Click order not valid.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
function menu_log( message, clear ) {
|
TestHelpers.menu = {
|
||||||
|
log: function( message, clear ) {
|
||||||
if ( clear ) {
|
if ( clear ) {
|
||||||
$( "#log" ).empty();
|
$( "#log" ).empty();
|
||||||
}
|
}
|
||||||
@ -6,9 +7,10 @@ function menu_log( message, clear ) {
|
|||||||
message = $( "#log" ).data( "lastItem" );
|
message = $( "#log" ).data( "lastItem" );
|
||||||
}
|
}
|
||||||
$( "#log" ).prepend( $.trim( message ) + "," );
|
$( "#log" ).prepend( $.trim( message ) + "," );
|
||||||
}
|
},
|
||||||
|
|
||||||
function menu_click( menu, item ) {
|
click: function( menu, item ) {
|
||||||
$( "#log" ).data( "lastItem", item );
|
$( "#log" ).data( "lastItem", item );
|
||||||
menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
|
menu.children( ":eq(" + item + ")" ).find( "a:first" ).trigger( "click" );
|
||||||
}
|
}
|
||||||
|
};
|
@ -42,31 +42,32 @@ test( "my, at, of", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "multiple elements", function() {
|
test( "multiple elements", function() {
|
||||||
var elements = $( "#el1, #el2" );
|
var elements = $( "#el1, #el2" ),
|
||||||
var result = elements.position({
|
result = elements.position({
|
||||||
my: "left top",
|
my: "left top",
|
||||||
at: "left bottom",
|
at: "left bottom",
|
||||||
of: "#parent",
|
of: "#parent",
|
||||||
collision: "none"
|
collision: "none"
|
||||||
});
|
}),
|
||||||
|
expected = { top: 10, left: 4 };
|
||||||
|
|
||||||
deepEqual( result, elements );
|
deepEqual( result, elements );
|
||||||
var expected = { top: 10, left: 4 };
|
|
||||||
elements.each(function() {
|
elements.each(function() {
|
||||||
deepEqual( $( this ).offset(), expected );
|
deepEqual( $( this ).offset(), expected );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "positions", function() {
|
test( "positions", function() {
|
||||||
var definitions = [];
|
var definitions = [],
|
||||||
var offsets = {
|
offsets = {
|
||||||
left: 0,
|
left: 0,
|
||||||
center: 3,
|
center: 3,
|
||||||
right: 6,
|
right: 6,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 6
|
bottom: 6
|
||||||
};
|
},
|
||||||
var start = { left: 4, top: 4 };
|
start = { left: 4, top: 4 },
|
||||||
|
el = $( "#el1" );
|
||||||
$.each( [ 0, 1 ], function( my ) {
|
$.each( [ 0, 1 ], function( my ) {
|
||||||
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
|
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
|
||||||
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
|
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
|
||||||
@ -81,7 +82,6 @@ test( "positions", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var el = $( "#el1" );
|
|
||||||
$.each( definitions, function( index, definition ) {
|
$.each( definitions, function( index, definition ) {
|
||||||
el.position({
|
el.position({
|
||||||
my: definition.my,
|
my: definition.my,
|
||||||
@ -445,12 +445,12 @@ test( "addClass: flipped left", function() {
|
|||||||
|
|
||||||
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
|
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
|
||||||
|
|
||||||
elem.position( {
|
elem.position({
|
||||||
my: "right center",
|
my: "right center",
|
||||||
of: window,
|
of: window,
|
||||||
collision: "flip",
|
collision: "flip",
|
||||||
at: "left center"
|
at: "left center"
|
||||||
})
|
});
|
||||||
|
|
||||||
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
|
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
|
||||||
});
|
});
|
||||||
|
@ -65,32 +65,33 @@ test( "my, at, of", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "multiple elements", function() {
|
test( "multiple elements", function() {
|
||||||
var elements = $( "#el1, #el2" );
|
var elements = $( "#el1, #el2" ),
|
||||||
var result = elements.position({
|
result = elements.position({
|
||||||
my: "left top",
|
my: "left top",
|
||||||
at: "left bottom",
|
at: "left bottom",
|
||||||
of: "#parent",
|
of: "#parent",
|
||||||
collision: "none",
|
collision: "none",
|
||||||
within: $("#within-container")
|
within: $("#within-container")
|
||||||
});
|
}),
|
||||||
|
expected = { top: addTop + 10, left: addLeft + 4 };
|
||||||
|
|
||||||
deepEqual( result, elements );
|
deepEqual( result, elements );
|
||||||
var expected = { top: addTop + 10, left: addLeft + 4 };
|
|
||||||
elements.each(function() {
|
elements.each(function() {
|
||||||
deepEqual( $( this ).addOffsets(), expected );
|
deepEqual( $( this ).addOffsets(), expected );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "positions", function() {
|
test( "positions", function() {
|
||||||
var definitions = [];
|
var definitions = [],
|
||||||
var offsets = {
|
offsets = {
|
||||||
left: 0,
|
left: 0,
|
||||||
center: 3,
|
center: 3,
|
||||||
right: 6,
|
right: 6,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 6
|
bottom: 6
|
||||||
};
|
},
|
||||||
var start = { left: 4, top: 4 };
|
start = { left: 4, top: 4 },
|
||||||
|
el = $( "#el1" );
|
||||||
$.each( [ 0, 1 ], function( my ) {
|
$.each( [ 0, 1 ], function( my ) {
|
||||||
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
|
$.each( [ "top", "center", "bottom" ], function( vindex, vertical ) {
|
||||||
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
|
$.each( [ "left", "center", "right" ], function( hindex, horizontal ) {
|
||||||
@ -105,7 +106,6 @@ test( "positions", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var el = $( "#el1" );
|
|
||||||
$.each( definitions, function( index, definition ) {
|
$.each( definitions, function( index, definition ) {
|
||||||
el.position({
|
el.position({
|
||||||
my: definition.my,
|
my: definition.my,
|
||||||
@ -120,7 +120,8 @@ test( "positions", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "of", function() {
|
test( "of", function() {
|
||||||
var within = $("#within-container");
|
var event,
|
||||||
|
within = $( "#within-container" );
|
||||||
|
|
||||||
$( "#elx" ).position({
|
$( "#elx" ).position({
|
||||||
my: "left top",
|
my: "left top",
|
||||||
@ -149,7 +150,7 @@ test( "of", function() {
|
|||||||
});
|
});
|
||||||
deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" );
|
deepEqual( $( "#elx" ).addOffsets(), { top: addTop + 40, left: addLeft + 40 }, "DOM element" );
|
||||||
|
|
||||||
var event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } );
|
event = $.extend( $.Event( "someEvent" ), { pageX: 200, pageY: 300 } );
|
||||||
$( "#elx" ).position({
|
$( "#elx" ).position({
|
||||||
my: "left top",
|
my: "left top",
|
||||||
at: "left top",
|
at: "left top",
|
||||||
@ -219,9 +220,8 @@ test( "within:offsets", function() {
|
|||||||
test( "using", function() {
|
test( "using", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
|
|
||||||
var within = $("#within-container");
|
var within = $( "#within-container" ),
|
||||||
|
count = 0,
|
||||||
var count = 0,
|
|
||||||
elems = $( "#el1, #el2" ),
|
elems = $( "#el1, #el2" ),
|
||||||
expectedPosition = { top: addTop + 40, left: addLeft + 40 },
|
expectedPosition = { top: addTop + 40, left: addLeft + 40 },
|
||||||
originalPosition = elems.position({
|
originalPosition = elems.position({
|
||||||
@ -252,9 +252,8 @@ test( "using", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function collisionTest( config, result, msg ) {
|
function collisionTest( config, result, msg ) {
|
||||||
var within = $("#within-container");
|
var within = $( "#within-container" ),
|
||||||
|
elem = $( "#elx" ).position( $.extend({
|
||||||
var elem = $( "#elx" ).position( $.extend({
|
|
||||||
my: "left top",
|
my: "left top",
|
||||||
at: "right bottom",
|
at: "right bottom",
|
||||||
of: "#parentx",
|
of: "#parentx",
|
||||||
@ -448,9 +447,8 @@ test( "collision: flip, with margin", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "addClass: flipped left", function() {
|
test( "addClass: flipped left", function() {
|
||||||
var within = $("#within-container");
|
var within = $("#within-container"),
|
||||||
|
elem = $( "#elx" ).position( {
|
||||||
var elem = $( "#elx" ).position( {
|
|
||||||
my: "left center",
|
my: "left center",
|
||||||
of: within[0],
|
of: within[0],
|
||||||
within: within,
|
within: within,
|
||||||
@ -460,21 +458,20 @@ test( "addClass: flipped left", function() {
|
|||||||
|
|
||||||
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
|
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Has ui-flipped-left class' );
|
||||||
|
|
||||||
elem.position( {
|
elem.position({
|
||||||
my: "right center",
|
my: "right center",
|
||||||
of: within[0],
|
of: within[0],
|
||||||
within: within,
|
within: within,
|
||||||
collision: "flip",
|
collision: "flip",
|
||||||
at: "left center"
|
at: "left center"
|
||||||
})
|
});
|
||||||
|
|
||||||
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
|
deepEqual( elem.hasClass( 'ui-flipped-left' ), false, 'Removed ui-flipped-left class' );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "addClass: flipped top", function() {
|
test( "addClass: flipped top", function() {
|
||||||
var within = $("#within-container");
|
var within = $("#within-container"),
|
||||||
|
elem = $( "#elx" ).position( {
|
||||||
var elem = $( "#elx" ).position( {
|
|
||||||
my: "left top",
|
my: "left top",
|
||||||
of: within[0],
|
of: within[0],
|
||||||
within: within,
|
within: within,
|
||||||
@ -496,9 +493,8 @@ test( "addClass: flipped top", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "addClass: flipped right", function() {
|
test( "addClass: flipped right", function() {
|
||||||
var within = $("#within-container");
|
var within = $("#within-container"),
|
||||||
|
elem = $( "#elx" ).position( {
|
||||||
var elem = $( "#elx" ).position( {
|
|
||||||
my: "right center",
|
my: "right center",
|
||||||
of: within[0],
|
of: within[0],
|
||||||
within: within,
|
within: within,
|
||||||
@ -521,9 +517,8 @@ test( "addClass: flipped right", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "addClass: flipped bottom", function() {
|
test( "addClass: flipped bottom", function() {
|
||||||
var within = $("#within-container");
|
var within = $("#within-container"),
|
||||||
|
elem = $( "#elx" ).position( {
|
||||||
var elem = $( "#elx" ).position( {
|
|
||||||
my: "left bottom",
|
my: "left bottom",
|
||||||
of: window,
|
of: window,
|
||||||
collision: "flip",
|
collision: "flip",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "progressbar", {
|
TestHelpers.commonWidgetTests( "progressbar", {
|
||||||
defaults: {
|
defaults: {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
value: 0,
|
value: 0,
|
||||||
|
@ -15,7 +15,7 @@ test("create", function() {
|
|||||||
change: function() {
|
change: function() {
|
||||||
ok(false, 'create() has triggered change()');
|
ok(false, 'create() has triggered change()');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("change", function() {
|
test("change", function() {
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
/*
|
TestHelpers.commonWidgetTests('resizable', {
|
||||||
* resizable_defaults.js
|
defaults: {
|
||||||
*/
|
|
||||||
|
|
||||||
var resizable_defaults = {
|
|
||||||
alsoResize: false,
|
alsoResize: false,
|
||||||
animate: false,
|
animate: false,
|
||||||
animateDuration: 'slow',
|
animateDuration: 'slow',
|
||||||
@ -23,6 +20,5 @@ var resizable_defaults = {
|
|||||||
minHeight: 10,
|
minHeight: 10,
|
||||||
minWidth: 10,
|
minWidth: 10,
|
||||||
zIndex: 1000
|
zIndex: 1000
|
||||||
};
|
}
|
||||||
|
});
|
||||||
commonWidgetTests('resizable', { defaults: resizable_defaults });
|
|
||||||
|
@ -20,7 +20,7 @@ test("init", function() {
|
|||||||
$('<div></div>').resizable().resizable("foo").remove();
|
$('<div></div>').resizable().resizable("foo").remove();
|
||||||
ok(true, 'arbitrary method called after init');
|
ok(true, 'arbitrary method called after init');
|
||||||
|
|
||||||
el = $('<div></div>').resizable()
|
el = $('<div></div>').resizable();
|
||||||
var foo = el.resizable("option", "foo");
|
var foo = el.resizable("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, 'arbitrary option getter after init');
|
||||||
|
@ -187,4 +187,13 @@ test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
|||||||
equal( target.height(), 100, "compare maxHeight" );
|
equal( target.height(), 100, "compare maxHeight" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("zIndex, applied to all handles", function() {
|
||||||
|
expect(8);
|
||||||
|
|
||||||
|
var target = $('<div></div>').resizable({ handles: 'all', zIndex: 100 });
|
||||||
|
target.children( '.ui-resizable-handle' ).each( function( index, handle ) {
|
||||||
|
equals( $( handle ).css( 'zIndex' ), 100, 'compare zIndex' );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
/*
|
TestHelpers.commonWidgetTests('selectable', {
|
||||||
* selectable_defaults.js
|
defaults: {
|
||||||
*/
|
|
||||||
|
|
||||||
var selectable_defaults = {
|
|
||||||
appendTo: 'body',
|
appendTo: 'body',
|
||||||
autoRefresh: true,
|
autoRefresh: true,
|
||||||
cancel: ':input,option',
|
cancel: ':input,option',
|
||||||
@ -11,6 +8,5 @@ var selectable_defaults = {
|
|||||||
distance: 0,
|
distance: 0,
|
||||||
filter: '*',
|
filter: '*',
|
||||||
tolerance: 'touch'
|
tolerance: 'touch'
|
||||||
};
|
}
|
||||||
|
});
|
||||||
commonWidgetTests('selectable', { defaults: selectable_defaults });
|
|
||||||
|
@ -20,7 +20,7 @@ test("init", function() {
|
|||||||
$("<div></div>").selectable().selectable("foo").remove();
|
$("<div></div>").selectable().selectable("foo").remove();
|
||||||
ok(true, 'arbitrary method called after init');
|
ok(true, 'arbitrary method called after init');
|
||||||
|
|
||||||
el = $("<div></div>").selectable()
|
el = $("<div></div>").selectable();
|
||||||
var foo = el.selectable("option", "foo");
|
var foo = el.selectable("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, 'arbitrary option getter after init');
|
||||||
@ -49,7 +49,8 @@ test("destroy", function() {
|
|||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
var fired = false;
|
var expected, actual,
|
||||||
|
fired = false;
|
||||||
|
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
el.selectable({
|
el.selectable({
|
||||||
@ -63,14 +64,15 @@ test("enable", function() {
|
|||||||
equal(fired, true, "start fired");
|
equal(fired, true, "start fired");
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
|
|
||||||
var expected = $('<div></div>').selectable(),
|
expected = $('<div></div>').selectable();
|
||||||
actual = expected.selectable('enable');
|
actual = expected.selectable('enable');
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, 'enable is chainable');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
var fired = false;
|
var expected, actual,
|
||||||
|
fired = false;
|
||||||
|
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
el.selectable({
|
el.selectable({
|
||||||
@ -85,7 +87,7 @@ test("disable", function() {
|
|||||||
equal(fired, false, "start fired");
|
equal(fired, false, "start fired");
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
|
|
||||||
var expected = $('<div></div>').selectable(),
|
expected = $('<div></div>').selectable();
|
||||||
actual = expected.selectable('disable');
|
actual = expected.selectable('disable');
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, 'disable is chainable');
|
||||||
});
|
});
|
||||||
|
@ -8,7 +8,7 @@ module("selectable: options");
|
|||||||
test("autoRefresh", function() {
|
test("autoRefresh", function() {
|
||||||
expect(3);
|
expect(3);
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
var actual, sel = $("*", el), selected = function() { actual += 1 };
|
var actual, sel = $("*", el), selected = function() { actual += 1; };
|
||||||
|
|
||||||
actual = 0;
|
actual = 0;
|
||||||
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
|
el = $("#selectable1").selectable({ autoRefresh: false, selected: selected });
|
||||||
@ -33,12 +33,12 @@ test("autoRefresh", function() {
|
|||||||
test("filter", function() {
|
test("filter", function() {
|
||||||
expect(2);
|
expect(2);
|
||||||
el = $("#selectable1");
|
el = $("#selectable1");
|
||||||
var actual, sel = $("*", el), selected = function() { actual += 1 };
|
var actual, sel = $("*", el), selected = function() { actual += 1; };
|
||||||
|
|
||||||
actual = 0;
|
actual = 0;
|
||||||
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
|
el = $("#selectable1").selectable({ filter: '.special', selected: selected });
|
||||||
drag(1000, 1000);
|
drag(1000, 1000);
|
||||||
ok(sel.length != 1, "this test assumes more than 1 selectee");
|
ok(sel.length !== 1, "this test assumes more than 1 selectee");
|
||||||
equal(actual, 1);
|
equal(actual, 1);
|
||||||
el.selectable("destroy");
|
el.selectable("destroy");
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "slider", {
|
TestHelpers.commonWidgetTests( "slider", {
|
||||||
defaults: {
|
defaults: {
|
||||||
animate: false,
|
animate: false,
|
||||||
cancel: ':input,option',
|
cancel: ':input,option',
|
||||||
|
@ -17,8 +17,8 @@ test("init", function() {
|
|||||||
$('<div></div>').slider().remove();
|
$('<div></div>').slider().remove();
|
||||||
ok(true, '.slider() called on disconnected DOMElement');
|
ok(true, '.slider() called on disconnected DOMElement');
|
||||||
|
|
||||||
var el = $('<div></div>').slider();
|
var el = $('<div></div>').slider(),
|
||||||
var foo = el.slider("option", "foo");
|
foo = el.slider("option", "foo");
|
||||||
el.remove();
|
el.remove();
|
||||||
ok(true, 'arbitrary option getter after init');
|
ok(true, 'arbitrary option getter after init');
|
||||||
|
|
||||||
@ -42,11 +42,12 @@ test("destroy", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("enable", function() {
|
test("enable", function() {
|
||||||
var expected = $('<div></div>').slider(),
|
var el,
|
||||||
|
expected = $('<div></div>').slider(),
|
||||||
actual = expected.slider('enable');
|
actual = expected.slider('enable');
|
||||||
equal(actual, expected, 'enable is chainable');
|
equal(actual, expected, 'enable is chainable');
|
||||||
|
|
||||||
var el = $('<div></div>').slider({ disabled: true });
|
el = $('<div></div>').slider({ disabled: true });
|
||||||
ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call');
|
ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call');
|
||||||
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class before enable method call');
|
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class before enable method call');
|
||||||
el.slider('enable');
|
el.slider('enable');
|
||||||
@ -55,11 +56,12 @@ test("enable", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("disable", function() {
|
test("disable", function() {
|
||||||
var expected = $('<div></div>').slider(),
|
var el,
|
||||||
|
expected = $('<div></div>').slider(),
|
||||||
actual = expected.slider('disable');
|
actual = expected.slider('disable');
|
||||||
equal(actual, expected, 'disable is chainable');
|
equal(actual, expected, 'disable is chainable');
|
||||||
|
|
||||||
var el = $('<div></div>').slider({ disabled: false });
|
el = $('<div></div>').slider({ disabled: false });
|
||||||
ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call');
|
ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call');
|
||||||
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call');
|
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call');
|
||||||
el.slider('disable');
|
el.slider('disable');
|
||||||
|
@ -23,8 +23,8 @@ test("max", function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
ok(el.slider("option", "value") == options.value, "value option is not contained by max");
|
ok(el.slider("option", "value") === options.value, "value option is not contained by max");
|
||||||
ok(el.slider("value") == options.max, "value method is contained by max");
|
ok(el.slider("value") === options.max, "value method is contained by max");
|
||||||
el.slider('destroy');
|
el.slider('destroy');
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -41,8 +41,8 @@ test("min", function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
el.slider(options);
|
el.slider(options);
|
||||||
ok(el.slider("option", "value") == options.value, "value option is not contained by min");
|
ok(el.slider("option", "value") === options.value, "value option is not contained by min");
|
||||||
ok(el.slider("value") == options.min, "value method is contained by min");
|
ok(el.slider("value") === options.min, "value method is contained by min");
|
||||||
el.slider('destroy');
|
el.slider('destroy');
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -73,7 +73,7 @@ test("orientation", function() {
|
|||||||
value: -1
|
value: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
var percentVal = (options.value - options.min) / (options.max - options.min) * 100;
|
percentVal = (options.value - options.min) / (options.max - options.min) * 100;
|
||||||
|
|
||||||
el.slider(options).slider("option", "orientation", "vertical");
|
el.slider(options).slider("option", "orientation", "vertical");
|
||||||
ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical");
|
ok(el.is('.ui-slider-vertical'), "vertical slider has class .ui-slider-vertical");
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
/*
|
TestHelpers.commonWidgetTests( "sortable", {
|
||||||
* sortable_defaults.js
|
defaults: {
|
||||||
*/
|
|
||||||
|
|
||||||
var sortable_defaults = {
|
|
||||||
appendTo: "parent",
|
appendTo: "parent",
|
||||||
axis: false,
|
axis: false,
|
||||||
cancel: ":input,option",
|
cancel: ":input,option",
|
||||||
connectWith: false,
|
connectWith: false,
|
||||||
containment: false,
|
containment: false,
|
||||||
cursor: 'auto',
|
cursor: "auto",
|
||||||
cursorAt: false,
|
cursorAt: false,
|
||||||
delay: 0,
|
delay: 0,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@ -29,6 +26,5 @@ var sortable_defaults = {
|
|||||||
scope: "default",
|
scope: "default",
|
||||||
tolerance: "intersect",
|
tolerance: "intersect",
|
||||||
zIndex: 1000
|
zIndex: 1000
|
||||||
};
|
}
|
||||||
|
});
|
||||||
commonWidgetTests('sortable', { defaults: sortable_defaults });
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
var el, offsetBefore, offsetAfter, dragged;
|
var el, offsetBefore, offsetAfter, dragged;
|
||||||
|
|
||||||
var drag = function(handle, dx, dy) {
|
function drag(handle, dx, dy) {
|
||||||
offsetBefore = $(handle).offset();
|
offsetBefore = $(handle).offset();
|
||||||
$(handle).simulate("drag", {
|
$(handle).simulate("drag", {
|
||||||
dx: dx || 0,
|
dx: dx || 0,
|
||||||
@ -15,7 +15,7 @@ var drag = function(handle, dx, dy) {
|
|||||||
offsetAfter = $(handle).offset();
|
offsetAfter = $(handle).offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
var sort = function(handle, dx, dy, index, msg) {
|
function sort(handle, dx, dy, index, msg) {
|
||||||
drag(handle, dx, dy);
|
drag(handle, dx, dy);
|
||||||
equal($(handle).parent().children().index(handle), index, msg);
|
equal($(handle).parent().children().index(handle), index, msg);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
var el, offsetBefore, offsetAfter, dragged;
|
var el, offsetBefore, offsetAfter, dragged;
|
||||||
|
|
||||||
var drag = function(handle, dx, dy) {
|
function drag(handle, dx, dy) {
|
||||||
offsetBefore = $(handle).offset();
|
offsetBefore = $(handle).offset();
|
||||||
$(handle).simulate("drag", {
|
$(handle).simulate("drag", {
|
||||||
dx: dx || 0,
|
dx: dx || 0,
|
||||||
@ -15,7 +15,7 @@ var drag = function(handle, dx, dy) {
|
|||||||
offsetAfter = $(handle).offset();
|
offsetAfter = $(handle).offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
var sort = function(handle, dx, dy, index, msg) {
|
function sort(handle, dx, dy, index, msg) {
|
||||||
drag(handle, dx, dy);
|
drag(handle, dx, dy);
|
||||||
equal($(handle).parent().children().index(handle), index, msg);
|
equal($(handle).parent().children().index(handle), index, msg);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
|
||||||
|
|
||||||
module( "spinner: core" );
|
module( "spinner: core" );
|
||||||
|
|
||||||
test( "keydown UP on input, increases value not greater than max", function() {
|
test( "keydown UP on input, increases value not greater than max", function() {
|
||||||
@ -9,15 +11,15 @@ test( "keydown UP on input, increases value not greater than max", function() {
|
|||||||
step: 10
|
step: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( element.val(), 80 );
|
equal( element.val(), 80 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( element.val(), 90 );
|
equal( element.val(), 90 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( element.val(), 100 );
|
equal( element.val(), 100 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( element.val(), 100 );
|
equal( element.val(), 100 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( element.val(), 100 );
|
equal( element.val(), 100 );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -28,15 +30,15 @@ test( "keydown DOWN on input, decreases value not less than min", function() {
|
|||||||
step: 10
|
step: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
equal( element.val(), 40 );
|
equal( element.val(), 40 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
equal( element.val(), 30 );
|
equal( element.val(), 30 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
equal( element.val(), 20 );
|
equal( element.val(), 20 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
equal( element.val(), 20 );
|
equal( element.val(), 20 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
equal( element.val(), 20 );
|
equal( element.val(), 20 );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -47,15 +49,15 @@ test( "keydown PAGE_UP on input, increases value not greater than max", function
|
|||||||
page: 10
|
page: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
equal( element.val(), 80 );
|
equal( element.val(), 80 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
equal( element.val(), 90 );
|
equal( element.val(), 90 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
equal( element.val(), 100 );
|
equal( element.val(), 100 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
equal( element.val(), 100 );
|
equal( element.val(), 100 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
equal( element.val(), 100 );
|
equal( element.val(), 100 );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -66,15 +68,15 @@ test( "keydown PAGE_DOWN on input, decreases value not less than min", function(
|
|||||||
page: 10
|
page: 10
|
||||||
});
|
});
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
equal( element.val(), 40 );
|
equal( element.val(), 40 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
equal( element.val(), 30 );
|
equal( element.val(), 30 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
equal( element.val(), 20 );
|
equal( element.val(), 20 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
equal( element.val(), 20 );
|
equal( element.val(), 20 );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
equal( element.val(), 20 );
|
equal( element.val(), 20 );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -189,8 +191,8 @@ test( "don't clear invalid value on blur", function() {
|
|||||||
|
|
||||||
test( "precision", function() {
|
test( "precision", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#spin" ).val( .05 ).spinner({
|
var element = $( "#spin" ).val( 0.05 ).spinner({
|
||||||
step: .0001
|
step: 0.0001
|
||||||
});
|
});
|
||||||
element.spinner( "stepUp" );
|
element.spinner( "stepUp" );
|
||||||
equal( element.val(), "0.0501", "precision from step" );
|
equal( element.val(), "0.0501", "precision from step" );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "spinner", {
|
TestHelpers.commonWidgetTests( "spinner", {
|
||||||
defaults: {
|
defaults: {
|
||||||
culture: null,
|
culture: null,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
|
||||||
|
|
||||||
module( "spinner: events" );
|
module( "spinner: events" );
|
||||||
|
|
||||||
test( "start", function() {
|
test( "start", function() {
|
||||||
@ -13,14 +15,14 @@ test( "start", function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shouldStart( true, "key UP" );
|
shouldStart( true, "key UP" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
shouldStart( true, "key DOWN" );
|
shouldStart( true, "key DOWN" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
|
|
||||||
shouldStart( true, "key PAGE_UP" );
|
shouldStart( true, "key PAGE_UP" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
shouldStart( true, "key PAGE_DOWN" );
|
shouldStart( true, "key PAGE_DOWN" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
|
|
||||||
shouldStart( true, "button up" );
|
shouldStart( true, "button up" );
|
||||||
element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup();
|
element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup();
|
||||||
@ -52,14 +54,14 @@ test( "spin", function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shouldSpin( true, "key UP" );
|
shouldSpin( true, "key UP" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
shouldSpin( true, "key DOWN" );
|
shouldSpin( true, "key DOWN" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
|
|
||||||
shouldSpin( true, "key PAGE_UP" );
|
shouldSpin( true, "key PAGE_UP" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
shouldSpin( true, "key PAGE_DOWN" );
|
shouldSpin( true, "key PAGE_DOWN" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
|
|
||||||
shouldSpin( true, "button up" );
|
shouldSpin( true, "button up" );
|
||||||
element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup();
|
element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup();
|
||||||
@ -91,14 +93,14 @@ test( "stop", function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shouldStop( true, "key UP" );
|
shouldStop( true, "key UP" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
shouldStop( true, "key DOWN" );
|
shouldStop( true, "key DOWN" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
|
|
||||||
shouldStop( true, "key PAGE_UP" );
|
shouldStop( true, "key PAGE_UP" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
shouldStop( true, "key PAGE_DOWN" );
|
shouldStop( true, "key PAGE_DOWN" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
|
|
||||||
shouldStop( true, "button up" );
|
shouldStop( true, "button up" );
|
||||||
element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup();
|
element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup();
|
||||||
@ -131,42 +133,42 @@ test( "change", function() {
|
|||||||
|
|
||||||
element.focus();
|
element.focus();
|
||||||
shouldChange( false, "key UP, before blur" );
|
shouldChange( false, "key UP, before blur" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
shouldChange( true, "blur after key UP" );
|
shouldChange( true, "blur after key UP" );
|
||||||
element.blur();
|
element.blur();
|
||||||
|
|
||||||
element.focus();
|
element.focus();
|
||||||
shouldChange( false, "key DOWN, before blur" );
|
shouldChange( false, "key DOWN, before blur" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
shouldChange( true, "blur after key DOWN" );
|
shouldChange( true, "blur after key DOWN" );
|
||||||
element.blur();
|
element.blur();
|
||||||
|
|
||||||
element.focus();
|
element.focus();
|
||||||
shouldChange( false, "key PAGE_UP, before blur" );
|
shouldChange( false, "key PAGE_UP, before blur" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
shouldChange( true, "blur after key PAGE_UP" );
|
shouldChange( true, "blur after key PAGE_UP" );
|
||||||
element.blur();
|
element.blur();
|
||||||
|
|
||||||
element.focus();
|
element.focus();
|
||||||
shouldChange( false, "key PAGE_DOWN, before blur" );
|
shouldChange( false, "key PAGE_DOWN, before blur" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
shouldChange( true, "blur after key PAGE_DOWN" );
|
shouldChange( true, "blur after key PAGE_DOWN" );
|
||||||
element.blur();
|
element.blur();
|
||||||
|
|
||||||
shouldChange( false, "many keys, before blur" );
|
shouldChange( false, "many keys, before blur" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
shouldChange( true, "blur after many keys" );
|
shouldChange( true, "blur after many keys" );
|
||||||
element.blur();
|
element.blur();
|
||||||
|
|
||||||
shouldChange( false, "many keys, same final value, before blur" );
|
shouldChange( false, "many keys, same final value, before blur" );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
shouldChange( false, "blur after many keys, same final value" );
|
shouldChange( false, "blur after many keys, same final value" );
|
||||||
|
|
||||||
shouldChange( false, "button up, before blur" );
|
shouldChange( false, "button up, before blur" );
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
|
||||||
|
|
||||||
module( "spinner: methods" );
|
module( "spinner: methods" );
|
||||||
|
|
||||||
test( "destroy", function() {
|
test( "destroy", function() {
|
||||||
@ -21,16 +23,16 @@ test( "disable", function() {
|
|||||||
ok( wrapper.hasClass( "ui-spinner-disabled" ), "after: wrapper has ui-spinner-disabled class" );
|
ok( wrapper.hasClass( "ui-spinner-disabled" ), "after: wrapper has ui-spinner-disabled class" );
|
||||||
ok( element.is( ":disabled"), "after: input has disabled attribute" );
|
ok( element.is( ":disabled"), "after: input has disabled attribute" );
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( 2, element.val(), "keyboard - value does not change on key UP" );
|
equal( 2, element.val(), "keyboard - value does not change on key UP" );
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.DOWN );
|
||||||
equal( 2, element.val(), "keyboard - value does not change on key DOWN" );
|
equal( 2, element.val(), "keyboard - value does not change on key DOWN" );
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_UP );
|
||||||
equal( 2, element.val(), "keyboard - value does not change on key PGUP" );
|
equal( 2, element.val(), "keyboard - value does not change on key PGUP" );
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN );
|
||||||
equal( 2, element.val(), "keyboard - value does not change on key PGDN" );
|
equal( 2, element.val(), "keyboard - value does not change on key PGDN" );
|
||||||
|
|
||||||
wrapper.find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" );
|
wrapper.find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" );
|
||||||
@ -54,7 +56,7 @@ test( "disable", function() {
|
|||||||
|
|
||||||
test( "enable", function() {
|
test( "enable", function() {
|
||||||
expect( 5 );
|
expect( 5 );
|
||||||
var element = $( "#spin" ).val( 1 ).spinner({ disabled: true })
|
var element = $( "#spin" ).val( 1 ).spinner({ disabled: true }),
|
||||||
wrapper = element.spinner( "widget" );
|
wrapper = element.spinner( "widget" );
|
||||||
|
|
||||||
ok( wrapper.hasClass( "ui-spinner-disabled" ), "before: wrapper has ui-spinner-disabled class" );
|
ok( wrapper.hasClass( "ui-spinner-disabled" ), "before: wrapper has ui-spinner-disabled class" );
|
||||||
@ -65,7 +67,7 @@ test( "enable", function() {
|
|||||||
ok( !wrapper.hasClass( ".ui-spinner-disabled" ), "after: wrapper does not have ui-spinner-disabled class" );
|
ok( !wrapper.hasClass( ".ui-spinner-disabled" ), "after: wrapper does not have ui-spinner-disabled class" );
|
||||||
ok( !element.is( ":disabled" ), "after: input does not have disabled attribute" );
|
ok( !element.is( ":disabled" ), "after: input does not have disabled attribute" );
|
||||||
|
|
||||||
spinner_simulateKeyDownUp( element, $.ui.keyCode.UP );
|
simulateKeyDownUp( element, $.ui.keyCode.UP );
|
||||||
equal( 2, element.val(), "keyboard - value changes on key UP" );
|
equal( 2, element.val(), "keyboard - value changes on key UP" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var simulateKeyDownUp = TestHelpers.spinner.simulateKeyDownUp;
|
||||||
|
|
||||||
module( "spinner: options" );
|
module( "spinner: options" );
|
||||||
|
|
||||||
// culture is tested after numberFormat, since it depends on numberFormat
|
// culture is tested after numberFormat, since it depends on numberFormat
|
||||||
@ -191,7 +193,7 @@ test( "min, string", function() {
|
|||||||
equal( element.spinner( "option", "min" ), -100, "option converted to number" );
|
equal( element.spinner( "option", "min" ), -100, "option converted to number" );
|
||||||
|
|
||||||
element.spinner( "value", -1000 );
|
element.spinner( "value", -1000 );
|
||||||
equal( element.val(), "($100.00)", "min constrained in value method")
|
equal( element.val(), "($100.00)", "min constrained in value method" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "step, 2", function() {
|
test( "step, 2", function() {
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
var spinner_simulateKeyDownUp = function( element, keyCode, shift ) {
|
TestHelpers.spinner = {
|
||||||
|
simulateKeyDownUp: function( element, keyCode, shift ) {
|
||||||
element
|
element
|
||||||
.simulate( "keydown", { keyCode: keyCode, shiftKey: shift || false } )
|
.simulate( "keydown", { keyCode: keyCode, shiftKey: shift || false } )
|
||||||
.simulate( "keyup", { keyCode: keyCode, shiftKey: shift || false } );
|
.simulate( "keyup", { keyCode: keyCode, shiftKey: shift || false } );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var versions = [ "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", "1.7", "1.7.1", "1.7.2", "git" ];
|
var versions = [ "1.6", "1.6.1", "1.6.2", "1.6.3", "1.6.4", "1.7", "1.7.1", "1.7.2", "git" ],
|
||||||
|
additionalTests = {
|
||||||
var additionalTests = {
|
|
||||||
accordion: [ "accordion_deprecated.html" ],
|
accordion: [ "accordion_deprecated.html" ],
|
||||||
position: [ "position_deprecated.html" ],
|
position: [ "position_deprecated.html" ],
|
||||||
tabs: [ "tabs_deprecated.html" ]
|
tabs: [ "tabs_deprecated.html" ]
|
||||||
};
|
};
|
||||||
|
|
||||||
window.testAllVersions = function( widget ) {
|
window.testAllVersions = function( widget ) {
|
||||||
QUnit.testSuites( $.map(
|
QUnit.testSuites( $.map(
|
||||||
|
@ -4,13 +4,16 @@ var subsuiteFrame;
|
|||||||
|
|
||||||
QUnit.extend( QUnit, {
|
QUnit.extend( QUnit, {
|
||||||
testSuites: function( suites ) {
|
testSuites: function( suites ) {
|
||||||
for ( var i = 0; i < suites.length; i++ ) {
|
function generateSuite( suite ) {
|
||||||
(function( suite ) {
|
|
||||||
asyncTest( suite, function() {
|
asyncTest( suite, function() {
|
||||||
QUnit.runSuite( suite );
|
QUnit.runSuite( suite );
|
||||||
});
|
});
|
||||||
}( suites[i] ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( var i = 0; i < suites.length; i++ ) {
|
||||||
|
generateSuite( suites[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
QUnit.done = function() {
|
QUnit.done = function() {
|
||||||
subsuiteFrame.style.display = "none";
|
subsuiteFrame.style.display = "none";
|
||||||
};
|
};
|
||||||
@ -23,10 +26,12 @@ QUnit.extend( QUnit, {
|
|||||||
|
|
||||||
testDone: function() {
|
testDone: function() {
|
||||||
var current = QUnit.id( this.config.current.id ),
|
var current = QUnit.id( this.config.current.id ),
|
||||||
children = current.children;
|
children = current.children,
|
||||||
|
i = 0,
|
||||||
|
length = children.length;
|
||||||
|
|
||||||
// undo the auto-expansion of failed tests
|
// undo the auto-expansion of failed tests
|
||||||
for ( var i = 0; i < children.length; i++ ) {
|
for ( ; i < length; i++ ) {
|
||||||
if ( children[i].nodeName === "OL" ) {
|
if ( children[i].nodeName === "OL" ) {
|
||||||
children[i].style.display = "none";
|
children[i].style.display = "none";
|
||||||
}
|
}
|
||||||
@ -34,10 +39,11 @@ QUnit.extend( QUnit, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
runSuite: function( suite ) {
|
runSuite: function( suite ) {
|
||||||
var body = document.getElementsByTagName( "body" )[0],
|
var iframeWin,
|
||||||
iframe = subsuiteFrame = document.createElement( "iframe" ),
|
body = document.getElementsByTagName( "body" )[0],
|
||||||
iframeWin;
|
iframe = document.createElement( "iframe" );
|
||||||
|
|
||||||
|
subsuiteFrame = iframe;
|
||||||
iframe.className = "qunit-subsuite";
|
iframe.className = "qunit-subsuite";
|
||||||
body.appendChild( iframe );
|
body.appendChild( iframe );
|
||||||
|
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
if ( !url || url.indexOf("http") !== 0 ) {
|
if ( !url || url.indexOf("http") !== 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
document.write("<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date).getTime() + "'></scr" + "ipt>");
|
document.write( "<scr" + "ipt src='http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() + "'></scr" + "ipt>" );
|
||||||
})();
|
})();
|
||||||
|
@ -25,68 +25,13 @@
|
|||||||
<script src="../../jquery.simulate.js"></script>
|
<script src="../../jquery.simulate.js"></script>
|
||||||
<script src="../testsuite.js"></script>
|
<script src="../testsuite.js"></script>
|
||||||
|
|
||||||
|
<script src="tabs_test_helpers.js"></script>
|
||||||
<script src="tabs_defaults.js"></script>
|
<script src="tabs_defaults.js"></script>
|
||||||
<script src="tabs_core.js"></script>
|
<script src="tabs_core.js"></script>
|
||||||
<script src="tabs_events.js"></script>
|
<script src="tabs_events.js"></script>
|
||||||
<script src="tabs_methods.js"></script>
|
<script src="tabs_methods.js"></script>
|
||||||
<script src="tabs_options.js"></script>
|
<script src="tabs_options.js"></script>
|
||||||
|
|
||||||
<script>
|
|
||||||
function tabs_state( tabs ) {
|
|
||||||
var expected = $.makeArray( arguments ).slice( 1 );
|
|
||||||
var actual = tabs.find( ".ui-tabs-nav li" ).map(function() {
|
|
||||||
var tab = $( this ),
|
|
||||||
panel = $( $.ui.tabs.prototype._sanitizeSelector(
|
|
||||||
"#" + tab.find( "a" ).attr( "aria-controls" ) ) ),
|
|
||||||
tabIsActive = tab.hasClass( "ui-state-active" ),
|
|
||||||
panelIsActive = panel.css( "display" ) !== "none";
|
|
||||||
|
|
||||||
if ( tabIsActive && panelIsActive ) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if ( !tabIsActive && !panelIsActive ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1; // mixed state - invalid
|
|
||||||
}).get();
|
|
||||||
deepEqual( actual, expected );
|
|
||||||
}
|
|
||||||
|
|
||||||
function tabs_disabled( tabs, state ) {
|
|
||||||
var expected = $.map( new Array( tabs.find ( ".ui-tabs-nav li" ).length ), function( _, index ) {
|
|
||||||
if ( typeof state === "boolean" ) {
|
|
||||||
return state ? 1 : 0;
|
|
||||||
} else {
|
|
||||||
return $.inArray( index, state ) !== -1 ? 1 : 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var internalState = tabs.tabs( "option", "disabled" );
|
|
||||||
if ( internalState === false ) {
|
|
||||||
internalState = [];
|
|
||||||
}
|
|
||||||
if ( internalState === true ) {
|
|
||||||
internalState = $.map( new Array( tabs.find( ".ui-tabs-nav li" ).length ), function( _, index ) {
|
|
||||||
return index;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var actual = tabs.find( ".ui-tabs-nav li" ).map(function( index ) {
|
|
||||||
var tab = $( this ),
|
|
||||||
tabIsDisabled = tab.hasClass( "ui-state-disabled" );
|
|
||||||
|
|
||||||
if ( tabIsDisabled && $.inArray( index, internalState ) !== -1 ) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if ( !tabIsDisabled && $.inArray( index, internalState ) === -1 ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1; // mixed state - invalid
|
|
||||||
}).get();
|
|
||||||
deepEqual( tabs.tabs( "option", "disabled" ), state );
|
|
||||||
deepEqual( actual, expected );
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script src="../swarminject.js"></script>
|
<script src="../swarminject.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var state = TestHelpers.tabs.state;
|
||||||
|
|
||||||
module( "tabs: core" );
|
module( "tabs: core" );
|
||||||
|
|
||||||
test( "markup structure", function() {
|
test( "markup structure", function() {
|
||||||
@ -89,7 +91,7 @@ test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", funct
|
|||||||
});
|
});
|
||||||
|
|
||||||
equal( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" );
|
equal( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" );
|
||||||
tabs_state( element, 1 );
|
state( element, 1 );
|
||||||
});
|
});
|
||||||
|
|
||||||
}( jQuery ) );
|
}( jQuery ) );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "tabs", {
|
TestHelpers.commonWidgetTests( "tabs", {
|
||||||
defaults: {
|
defaults: {
|
||||||
active: null,
|
active: null,
|
||||||
collapsible: false,
|
collapsible: false,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "tabs", {
|
TestHelpers.commonWidgetTests( "tabs", {
|
||||||
defaults: {
|
defaults: {
|
||||||
active: null,
|
active: null,
|
||||||
ajaxOptions: null,
|
ajaxOptions: null,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<script src="../../jquery.simulate.js"></script>
|
<script src="../../jquery.simulate.js"></script>
|
||||||
<script src="../testsuite.js"></script>
|
<script src="../testsuite.js"></script>
|
||||||
|
|
||||||
|
<script src="tabs_test_helpers.js"></script>
|
||||||
<script src="tabs_defaults_deprecated.js"></script>
|
<script src="tabs_defaults_deprecated.js"></script>
|
||||||
<script src="tabs_core.js"></script>
|
<script src="tabs_core.js"></script>
|
||||||
<script src="tabs_events.js"></script>
|
<script src="tabs_events.js"></script>
|
||||||
@ -30,62 +31,6 @@
|
|||||||
<script src="tabs_options.js"></script>
|
<script src="tabs_options.js"></script>
|
||||||
<script src="tabs_deprecated.js"></script>
|
<script src="tabs_deprecated.js"></script>
|
||||||
|
|
||||||
<script>
|
|
||||||
function tabs_state( tabs ) {
|
|
||||||
var expected = $.makeArray( arguments ).slice( 1 );
|
|
||||||
var actual = tabs.find( ".ui-tabs-nav li" ).map(function() {
|
|
||||||
var tab = $( this ),
|
|
||||||
panel = $( $.ui.tabs.prototype._sanitizeSelector(
|
|
||||||
"#" + tab.find( "a" ).attr( "aria-controls" ) ) ),
|
|
||||||
tabIsActive = tab.hasClass( "ui-state-active" ),
|
|
||||||
panelIsActive = panel.css( "display" ) !== "none";
|
|
||||||
|
|
||||||
if ( tabIsActive && panelIsActive ) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if ( !tabIsActive && !panelIsActive ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1; // mixed state - invalid
|
|
||||||
}).get();
|
|
||||||
deepEqual( actual, expected );
|
|
||||||
}
|
|
||||||
|
|
||||||
function tabs_disabled( tabs, state ) {
|
|
||||||
var expected = $.map( new Array( tabs.find ( ".ui-tabs-nav li" ).length ), function( _, index ) {
|
|
||||||
if ( typeof state === "boolean" ) {
|
|
||||||
return state ? 1 : 0;
|
|
||||||
} else {
|
|
||||||
return $.inArray( index, state ) !== -1 ? 1 : 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var internalState = tabs.tabs( "option", "disabled" );
|
|
||||||
if ( internalState === false ) {
|
|
||||||
internalState = [];
|
|
||||||
}
|
|
||||||
if ( internalState === true ) {
|
|
||||||
internalState = $.map( new Array( tabs.find( ".ui-tabs-nav li" ).length ), function( _, index ) {
|
|
||||||
return index;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var actual = tabs.find( ".ui-tabs-nav li" ).map(function( index ) {
|
|
||||||
var tab = $( this ),
|
|
||||||
tabIsDisabled = tab.hasClass( "ui-state-disabled" );
|
|
||||||
|
|
||||||
if ( tabIsDisabled && $.inArray( index, internalState ) !== -1 ) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if ( !tabIsDisabled && $.inArray( index, internalState ) === -1 ) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1; // mixed state - invalid
|
|
||||||
}).get();
|
|
||||||
deepEqual( tabs.tabs( "option", "disabled" ), state );
|
|
||||||
deepEqual( actual, expected );
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script src="../swarminject.js"></script>
|
<script src="../swarminject.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var state = TestHelpers.tabs.state;
|
||||||
|
|
||||||
module( "tabs (deprecated): core" );
|
module( "tabs (deprecated): core" );
|
||||||
|
|
||||||
test( "panel ids", function() {
|
test( "panel ids", function() {
|
||||||
@ -48,17 +50,17 @@ asyncTest( "cache", function() {
|
|||||||
cache: true
|
cache: true
|
||||||
});
|
});
|
||||||
element.one( "tabsshow", function( event, ui ) {
|
element.one( "tabsshow", function( event, ui ) {
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
element.one( "tabsload", function( event, ui ) {
|
element.one( "tabsload", function( event, ui ) {
|
||||||
ok( true, "tabsload" );
|
ok( true, "tabsload" );
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
tabs_state( element, 1, 0, 0, 0, 0 );
|
state( element, 1, 0, 0, 0, 0 );
|
||||||
|
|
||||||
element.one( "tabsshow", function( event, ui ) {
|
element.one( "tabsshow", function( event, ui ) {
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
element.one( "tabsload", function( event, ui ) {
|
element.one( "tabsload", function( event, ui ) {
|
||||||
ok( false, "should be cached" );
|
ok( false, "should be cached" );
|
||||||
@ -68,7 +70,7 @@ asyncTest( "cache", function() {
|
|||||||
}, 1 );
|
}, 1 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 2 );
|
element.tabs( "option", "active", 2 );
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "idPrefix", function() {
|
test( "idPrefix", function() {
|
||||||
@ -89,7 +91,8 @@ test( "tabTemplate + panelTemplate", function() {
|
|||||||
// defaults are tested in the add method test
|
// defaults are tested in the add method test
|
||||||
expect( 11 );
|
expect( 11 );
|
||||||
|
|
||||||
var element = $( "#tabs2" ).tabs({
|
var tab, anchor,
|
||||||
|
element = $( "#tabs2" ).tabs({
|
||||||
tabTemplate: "<li class='customTab'><a href='http://example.com/#{href}'>#{label}</a></li>",
|
tabTemplate: "<li class='customTab'><a href='http://example.com/#{href}'>#{label}</a></li>",
|
||||||
panelTemplate: "<div class='customPanel'></div>"
|
panelTemplate: "<div class='customPanel'></div>"
|
||||||
});
|
});
|
||||||
@ -103,7 +106,7 @@ test( "tabTemplate + panelTemplate", function() {
|
|||||||
ok( $( ui.panel ).hasClass( "customPanel" ), "panel custom class" );
|
ok( $( ui.panel ).hasClass( "customPanel" ), "panel custom class" );
|
||||||
});
|
});
|
||||||
element.tabs( "add", "#new", "New" );
|
element.tabs( "add", "#new", "New" );
|
||||||
var tab = element.find( ".ui-tabs-nav li" ).last(),
|
tab = element.find( ".ui-tabs-nav li" ).last();
|
||||||
anchor = tab.find( "a" );
|
anchor = tab.find( "a" );
|
||||||
equal( tab.text(), "New", "label" );
|
equal( tab.text(), "New", "label" );
|
||||||
ok( tab.hasClass( "customTab" ), "tab custom class" );
|
ok( tab.hasClass( "customTab" ), "tab custom class" );
|
||||||
@ -170,50 +173,50 @@ test( "selected", function() {
|
|||||||
|
|
||||||
var element = $( "#tabs1" ).tabs();
|
var element = $( "#tabs1" ).tabs();
|
||||||
equal( element.tabs( "option", "selected" ), 0, "should be 0 by default" );
|
equal( element.tabs( "option", "selected" ), 0, "should be 0 by default" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
location.hash = "#fragment-3";
|
location.hash = "#fragment-3";
|
||||||
element = $( "#tabs1" ).tabs();
|
element = $( "#tabs1" ).tabs();
|
||||||
equal( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" );
|
equal( element.tabs( "option", "selected" ), 2, "should be 2 based on URL" );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
el = $('#tabs1').tabs({
|
el = $('#tabs1').tabs({
|
||||||
selected: -1,
|
selected: -1,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
});
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
|
equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
|
||||||
strictEqual( element.tabs( "option", "selected" ), -1 );
|
strictEqual( element.tabs( "option", "selected" ), -1 );
|
||||||
|
|
||||||
element.tabs( "option", "collapsible", false );
|
element.tabs( "option", "collapsible", false );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
equal( element.tabs( "option", "selected" ), 0 );
|
equal( element.tabs( "option", "selected" ), 0 );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs({
|
element.tabs({
|
||||||
selected: -1
|
selected: -1
|
||||||
});
|
});
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
strictEqual( element.tabs( "option", "selected" ), 0 );
|
strictEqual( element.tabs( "option", "selected" ), 0 );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs({ selected: 2 });
|
element.tabs({ selected: 2 });
|
||||||
equal( element.tabs( "option", "selected" ), 2 );
|
equal( element.tabs( "option", "selected" ), 2 );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.tabs( "option", "selected", 0 );
|
element.tabs( "option", "selected", 0 );
|
||||||
equal( element.tabs( "option", "selected" ), 0 );
|
equal( element.tabs( "option", "selected" ), 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
|
element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
|
||||||
equal( element.tabs( "option", "selected" ), 1 );
|
equal( element.tabs( "option", "selected" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.tabs( "option", "selected", 10 );
|
element.tabs( "option", "selected", 10 );
|
||||||
equal( element.tabs( "option", "selected" ), 1 );
|
equal( element.tabs( "option", "selected" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
location.hash = "#";
|
location.hash = "#";
|
||||||
});
|
});
|
||||||
@ -236,7 +239,7 @@ asyncTest( "load", function() {
|
|||||||
strictEqual( ui.tab, tab[ 0 ], "tab" );
|
strictEqual( ui.tab, tab[ 0 ], "tab" );
|
||||||
strictEqual( ui.panel, panel[ 0 ], "panel" );
|
strictEqual( ui.panel, panel[ 0 ], "panel" );
|
||||||
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
|
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
tabsload1();
|
tabsload1();
|
||||||
});
|
});
|
||||||
element.tabs({ active: 2 });
|
element.tabs({ active: 2 });
|
||||||
@ -252,7 +255,7 @@ asyncTest( "load", function() {
|
|||||||
strictEqual( ui.tab, tab[ 0 ], "tab" );
|
strictEqual( ui.tab, tab[ 0 ], "tab" );
|
||||||
strictEqual( ui.panel, panel[ 0 ], "panel" );
|
strictEqual( ui.panel, panel[ 0 ], "panel" );
|
||||||
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
|
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
tabsload2();
|
tabsload2();
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 3 );
|
element.tabs( "option", "active", 3 );
|
||||||
@ -269,7 +272,7 @@ asyncTest( "load", function() {
|
|||||||
strictEqual( ui.tab, tab[ 0 ], "tab" );
|
strictEqual( ui.tab, tab[ 0 ], "tab" );
|
||||||
strictEqual( ui.panel, panel[ 0 ], "panel" );
|
strictEqual( ui.panel, panel[ 0 ], "panel" );
|
||||||
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
|
equal( $( ui.panel ).find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 0, 0, 0, 0, 1 );
|
state( element, 0, 0, 0, 0, 1 );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
|
element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
|
||||||
@ -324,10 +327,10 @@ test( "show", function() {
|
|||||||
strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
|
strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
|
||||||
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
|
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
|
||||||
equal( ui.index, 0, "ui.index" );
|
equal( ui.index, 0, "ui.index" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
// switching tabs
|
// switching tabs
|
||||||
element.one( "tabsshow", function( event, ui ) {
|
element.one( "tabsshow", function( event, ui ) {
|
||||||
@ -335,17 +338,17 @@ test( "show", function() {
|
|||||||
strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
|
strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
|
||||||
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
|
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
|
||||||
equal( ui.index, 1, "ui.index" );
|
equal( ui.index, 1, "ui.index" );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
tabs.eq( 1 ).click();
|
tabs.eq( 1 ).click();
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// collapsing
|
// collapsing
|
||||||
element.one( "tabsshow", function( event, ui ) {
|
element.one( "tabsshow", function( event, ui ) {
|
||||||
ok( false, "collapsing" );
|
ok( false, "collapsing" );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", false );
|
element.tabs( "option", "active", false );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "select", function() {
|
test( "select", function() {
|
||||||
@ -364,10 +367,10 @@ test( "select", function() {
|
|||||||
strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
|
strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
|
||||||
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
|
strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
|
||||||
equal( ui.index, 0, "ui.index" );
|
equal( ui.index, 0, "ui.index" );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
// switching tabs
|
// switching tabs
|
||||||
element.one( "tabsselect", function( event, ui ) {
|
element.one( "tabsselect", function( event, ui ) {
|
||||||
@ -375,17 +378,17 @@ test( "select", function() {
|
|||||||
strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
|
strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
|
||||||
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
|
strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
|
||||||
equal( ui.index, 1, "ui.index" );
|
equal( ui.index, 1, "ui.index" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
tabs.eq( 1 ).click();
|
tabs.eq( 1 ).click();
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// collapsing
|
// collapsing
|
||||||
element.one( "tabsselect", function( event, ui ) {
|
element.one( "tabsselect", function( event, ui ) {
|
||||||
ok( false, "collapsing" );
|
ok( false, "collapsing" );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", false );
|
element.tabs( "option", "active", false );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
module( "tabs (deprecated): methods" );
|
module( "tabs (deprecated): methods" );
|
||||||
@ -393,8 +396,9 @@ module( "tabs (deprecated): methods" );
|
|||||||
test( "add", function() {
|
test( "add", function() {
|
||||||
expect( 27 );
|
expect( 27 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs();
|
var tab, anchor,
|
||||||
tabs_state( element, 1, 0, 0 );
|
element = $( "#tabs1" ).tabs();
|
||||||
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
// add without index
|
// add without index
|
||||||
element.one( "tabsadd", function( event, ui ) {
|
element.one( "tabsadd", function( event, ui ) {
|
||||||
@ -403,8 +407,8 @@ test( "add", function() {
|
|||||||
equal( ui.panel.id, "new", "ui.panel" );
|
equal( ui.panel.id, "new", "ui.panel" );
|
||||||
});
|
});
|
||||||
element.tabs( "add", "#new", "New" );
|
element.tabs( "add", "#new", "New" );
|
||||||
tabs_state( element, 1, 0, 0, 0 );
|
state( element, 1, 0, 0, 0 );
|
||||||
var tab = element.find( ".ui-tabs-nav li" ).last(),
|
tab = element.find( ".ui-tabs-nav li" ).last();
|
||||||
anchor = tab.find( "a" );
|
anchor = tab.find( "a" );
|
||||||
equal( tab.text(), "New", "label" );
|
equal( tab.text(), "New", "label" );
|
||||||
equal( anchor.attr( "href" ), "#new", "href" );
|
equal( anchor.attr( "href" ), "#new", "href" );
|
||||||
@ -413,7 +417,7 @@ test( "add", function() {
|
|||||||
anchor.simulate( "mouseover" );
|
anchor.simulate( "mouseover" );
|
||||||
ok( tab.hasClass( "ui-state-hover" ), "hovered" );
|
ok( tab.hasClass( "ui-state-hover" ), "hovered" );
|
||||||
anchor.simulate( "click" );
|
anchor.simulate( "click" );
|
||||||
tabs_state( element, 0, 0, 0, 1 );
|
state( element, 0, 0, 0, 1 );
|
||||||
|
|
||||||
// add remote tab with index
|
// add remote tab with index
|
||||||
element.one( "tabsadd", function( event, ui ) {
|
element.one( "tabsadd", function( event, ui ) {
|
||||||
@ -422,7 +426,7 @@ test( "add", function() {
|
|||||||
equal( ui.panel.id, $( ui.tab ).attr( "aria-controls" ), "ui.panel" );
|
equal( ui.panel.id, $( ui.tab ).attr( "aria-controls" ), "ui.panel" );
|
||||||
});
|
});
|
||||||
element.tabs( "add", "data/test.html", "New Remote", 1 );
|
element.tabs( "add", "data/test.html", "New Remote", 1 );
|
||||||
tabs_state( element, 0, 0, 0, 0, 1 );
|
state( element, 0, 0, 0, 0, 1 );
|
||||||
tab = element.find( ".ui-tabs-nav li" ).eq( 1 );
|
tab = element.find( ".ui-tabs-nav li" ).eq( 1 );
|
||||||
anchor = tab.find( "a" );
|
anchor = tab.find( "a" );
|
||||||
equal( tab.text(), "New Remote", "label" );
|
equal( tab.text(), "New Remote", "label" );
|
||||||
@ -432,7 +436,7 @@ test( "add", function() {
|
|||||||
anchor.simulate( "mouseover" );
|
anchor.simulate( "mouseover" );
|
||||||
ok( tab.hasClass( "ui-state-hover" ), "hovered" );
|
ok( tab.hasClass( "ui-state-hover" ), "hovered" );
|
||||||
anchor.simulate( "click" );
|
anchor.simulate( "click" );
|
||||||
tabs_state( element, 0, 1, 0, 0, 0 );
|
state( element, 0, 1, 0, 0, 0 );
|
||||||
|
|
||||||
// add to empty tab set
|
// add to empty tab set
|
||||||
element = $( "<div><ul></ul></div>" ).tabs();
|
element = $( "<div><ul></ul></div>" ).tabs();
|
||||||
@ -443,7 +447,7 @@ test( "add", function() {
|
|||||||
equal( ui.panel.id, "first", "ui.panel" );
|
equal( ui.panel.id, "first", "ui.panel" );
|
||||||
});
|
});
|
||||||
element.tabs( "add", "#first", "First" );
|
element.tabs( "add", "#first", "First" );
|
||||||
tabs_state( element, 1 );
|
state( element, 1 );
|
||||||
equal( element.tabs( "option", "active" ), 0, "active: 0 after add" );
|
equal( element.tabs( "option", "active" ), 0, "active: 0 after add" );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -460,7 +464,7 @@ test( "remove", function() {
|
|||||||
expect( 17 );
|
expect( 17 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs({ active: 1 });
|
var element = $( "#tabs1" ).tabs({ active: 1 });
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.one( "tabsremove", function( event, ui ) {
|
element.one( "tabsremove", function( event, ui ) {
|
||||||
equal( ui.index, -1, "ui.index" );
|
equal( ui.index, -1, "ui.index" );
|
||||||
@ -468,7 +472,7 @@ test( "remove", function() {
|
|||||||
equal( ui.panel.id, "fragment-2", "ui.panel" );
|
equal( ui.panel.id, "fragment-2", "ui.panel" );
|
||||||
});
|
});
|
||||||
element.tabs( "remove", 1 );
|
element.tabs( "remove", 1 );
|
||||||
tabs_state( element, 0, 1 );
|
state( element, 0, 1 );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
equal( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0,
|
equal( element.find( ".ui-tabs-nav li a[href$='fragment-2']" ).length, 0,
|
||||||
"remove correct list item" );
|
"remove correct list item" );
|
||||||
@ -480,7 +484,7 @@ test( "remove", function() {
|
|||||||
equal( ui.panel.id, "fragment-3", "ui.panel" );
|
equal( ui.panel.id, "fragment-3", "ui.panel" );
|
||||||
});
|
});
|
||||||
element.tabs( "remove", 1 );
|
element.tabs( "remove", 1 );
|
||||||
tabs_state( element, 1 );
|
state( element, 1 );
|
||||||
equal( element.tabs( "option", "active"), 0 );
|
equal( element.tabs( "option", "active"), 0 );
|
||||||
|
|
||||||
element.one( "tabsremove", function( event, ui ) {
|
element.one( "tabsremove", function( event, ui ) {
|
||||||
@ -496,43 +500,43 @@ test( "select", function() {
|
|||||||
expect( 23 );
|
expect( 23 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs();
|
var element = $( "#tabs1" ).tabs();
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.tabs( "select", 1 );
|
element.tabs( "select", 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
equal( element.tabs( "option", "active" ), 1, "active" );
|
equal( element.tabs( "option", "active" ), 1, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), 1, "selected" );
|
equal( element.tabs( "option", "selected" ), 1, "selected" );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs({ collapsible: true });
|
element.tabs({ collapsible: true });
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.tabs( "select", 0 );
|
element.tabs( "select", 0 );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
equal( element.tabs( "option", "active" ), false, "active" );
|
equal( element.tabs( "option", "active" ), false, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), -1, "selected" );
|
equal( element.tabs( "option", "selected" ), -1, "selected" );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs({ collapsible: true });
|
element.tabs({ collapsible: true });
|
||||||
element.tabs( "select", -1 );
|
element.tabs( "select", -1 );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
equal( element.tabs( "option", "active" ), false, "active" );
|
equal( element.tabs( "option", "active" ), false, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), -1, "selected" );
|
equal( element.tabs( "option", "selected" ), -1, "selected" );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs();
|
element.tabs();
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
equal( element.tabs( "option", "active" ), 0, "active" );
|
equal( element.tabs( "option", "active" ), 0, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), 0, "selected" );
|
equal( element.tabs( "option", "selected" ), 0, "selected" );
|
||||||
element.tabs( "select", 0 );
|
element.tabs( "select", 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
equal( element.tabs( "option", "active" ), 0, "active" );
|
equal( element.tabs( "option", "active" ), 0, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), 0, "selected" );
|
equal( element.tabs( "option", "selected" ), 0, "selected" );
|
||||||
element.tabs( "select", -1 );
|
element.tabs( "select", -1 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
equal( element.tabs( "option", "active" ), 0, "active" );
|
equal( element.tabs( "option", "active" ), 0, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), 0, "selected" );
|
equal( element.tabs( "option", "selected" ), 0, "selected" );
|
||||||
|
|
||||||
element.tabs( "select", "#fragment-2" );
|
element.tabs( "select", "#fragment-2" );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
equal( element.tabs( "option", "active" ), 1, "active" );
|
equal( element.tabs( "option", "active" ), 1, "active" );
|
||||||
equal( element.tabs( "option", "selected" ), 1, "selected" );
|
equal( element.tabs( "option", "selected" ), 1, "selected" );
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var state = TestHelpers.tabs.state;
|
||||||
|
|
||||||
module( "tabs: events" );
|
module( "tabs: events" );
|
||||||
|
|
||||||
test( "create", function() {
|
test( "create", function() {
|
||||||
@ -60,10 +62,10 @@ test( "beforeActivate", function() {
|
|||||||
strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
|
strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
|
||||||
equal( ui.newPanel.size(), 1, "newPanel size" );
|
equal( ui.newPanel.size(), 1, "newPanel size" );
|
||||||
strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
|
strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
// switching tabs
|
// switching tabs
|
||||||
element.one( "tabsbeforeactivate", function( event, ui ) {
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
||||||
@ -76,10 +78,10 @@ test( "beforeActivate", function() {
|
|||||||
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
||||||
equal( ui.newPanel.size(), 1, "newPanel size" );
|
equal( ui.newPanel.size(), 1, "newPanel size" );
|
||||||
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
tabs.eq( 1 ).click();
|
tabs.eq( 1 ).click();
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// collapsing
|
// collapsing
|
||||||
element.one( "tabsbeforeactivate", function( event, ui ) {
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
||||||
@ -90,10 +92,10 @@ test( "beforeActivate", function() {
|
|||||||
strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
|
strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
|
||||||
equal( ui.newTab.size(), 0, "newTab size" );
|
equal( ui.newTab.size(), 0, "newTab size" );
|
||||||
equal( ui.newPanel.size(), 0, "newPanel size" );
|
equal( ui.newPanel.size(), 0, "newPanel size" );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", false );
|
element.tabs( "option", "active", false );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
|
|
||||||
// prevent activation
|
// prevent activation
|
||||||
element.one( "tabsbeforeactivate", function( event, ui ) {
|
element.one( "tabsbeforeactivate", function( event, ui ) {
|
||||||
@ -105,10 +107,10 @@ test( "beforeActivate", function() {
|
|||||||
equal( ui.newPanel.size(), 1, "newPanel size" );
|
equal( ui.newPanel.size(), 1, "newPanel size" );
|
||||||
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 1 );
|
element.tabs( "option", "active", 1 );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "activate", function() {
|
test( "activate", function() {
|
||||||
@ -130,10 +132,10 @@ test( "activate", function() {
|
|||||||
strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
|
strictEqual( ui.newTab[ 0 ], tabs[ 0 ], "newTab" );
|
||||||
equal( ui.newPanel.size(), 1, "newPanel size" );
|
equal( ui.newPanel.size(), 1, "newPanel size" );
|
||||||
strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
|
strictEqual( ui.newPanel[ 0 ], panels[ 0 ], "newPanel" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
// switching tabs
|
// switching tabs
|
||||||
element.one( "tabsactivate", function( event, ui ) {
|
element.one( "tabsactivate", function( event, ui ) {
|
||||||
@ -146,10 +148,10 @@ test( "activate", function() {
|
|||||||
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
strictEqual( ui.newTab[ 0 ], tabs[ 1 ], "newTab" );
|
||||||
equal( ui.newPanel.size(), 1, "newPanel size" );
|
equal( ui.newPanel.size(), 1, "newPanel size" );
|
||||||
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
tabs.eq( 1 ).click();
|
tabs.eq( 1 ).click();
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// collapsing
|
// collapsing
|
||||||
element.one( "tabsactivate", function( event, ui ) {
|
element.one( "tabsactivate", function( event, ui ) {
|
||||||
@ -160,10 +162,10 @@ test( "activate", function() {
|
|||||||
strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
|
strictEqual( ui.oldPanel[ 0 ], panels[ 1 ], "oldPanel" );
|
||||||
equal( ui.newTab.size(), 0, "newTab size" );
|
equal( ui.newTab.size(), 0, "newTab size" );
|
||||||
equal( ui.newPanel.size(), 0, "newPanel size" );
|
equal( ui.newPanel.size(), 0, "newPanel size" );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", false );
|
element.tabs( "option", "active", false );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
|
|
||||||
// prevent activation
|
// prevent activation
|
||||||
element.one( "tabsbeforeactivate", function( event ) {
|
element.one( "tabsbeforeactivate", function( event ) {
|
||||||
@ -197,10 +199,10 @@ test( "beforeLoad", function() {
|
|||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
equal( ui.panel.html(), "", "panel html" );
|
equal( ui.panel.html(), "", "panel html" );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs({ active: 2 });
|
element.tabs({ active: 2 });
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
equal( panel.html(), "", "panel html after" );
|
equal( panel.html(), "", "panel html after" );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
@ -219,11 +221,11 @@ test( "beforeLoad", function() {
|
|||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
equal( ui.panel.html(), "", "panel html" );
|
equal( ui.panel.html(), "", "panel html" );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
tabs_state( element, 1, 0, 0, 0, 0 );
|
state( element, 1, 0, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.tabs();
|
element.tabs();
|
||||||
element.tabs( "option", "active", 2 );
|
element.tabs( "option", "active", 2 );
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
equal( panel.html(), "", "panel html after" );
|
equal( panel.html(), "", "panel html after" );
|
||||||
|
|
||||||
// click, change panel content
|
// click, change panel content
|
||||||
@ -241,10 +243,10 @@ test( "beforeLoad", function() {
|
|||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
ui.panel.html( "<p>testing</p>" );
|
ui.panel.html( "<p>testing</p>" );
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 3 ).click();
|
element.find( ".ui-tabs-nav a" ).eq( 3 ).click();
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
// .toLowerCase() is needed to convert <P> to <p> in old IEs
|
// .toLowerCase() is needed to convert <P> to <p> in old IEs
|
||||||
equal( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
|
equal( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
|
||||||
});
|
});
|
||||||
@ -268,7 +270,7 @@ if ( $.uiBackCompat === false ) {
|
|||||||
equal( ui.panel.size(), 1, "panel size" );
|
equal( ui.panel.size(), 1, "panel size" );
|
||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 0, 0, 1, 0, 0 );
|
state( element, 0, 0, 1, 0, 0 );
|
||||||
tabsload1();
|
tabsload1();
|
||||||
});
|
});
|
||||||
element.tabs({ active: 2 });
|
element.tabs({ active: 2 });
|
||||||
@ -286,7 +288,7 @@ if ( $.uiBackCompat === false ) {
|
|||||||
equal( ui.panel.size(), 1, "panel size" );
|
equal( ui.panel.size(), 1, "panel size" );
|
||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
tabsload2();
|
tabsload2();
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 3 );
|
element.tabs( "option", "active", 3 );
|
||||||
@ -305,7 +307,7 @@ if ( $.uiBackCompat === false ) {
|
|||||||
equal( ui.panel.size(), 1, "panel size" );
|
equal( ui.panel.size(), 1, "panel size" );
|
||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
equal( ui.panel.find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 0, 0, 0, 0, 1 );
|
state( element, 0, 0, 0, 0, 1 );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
|
element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var disabled = TestHelpers.tabs.disabled,
|
||||||
|
state = TestHelpers.tabs.state;
|
||||||
|
|
||||||
module( "tabs: methods" );
|
module( "tabs: methods" );
|
||||||
|
|
||||||
test( "destroy", function() {
|
test( "destroy", function() {
|
||||||
@ -12,95 +15,95 @@ test( "enable", function() {
|
|||||||
expect( 8 );
|
expect( 8 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs({ disabled: true });
|
var element = $( "#tabs1" ).tabs({ disabled: true });
|
||||||
tabs_disabled( element, true );
|
disabled( element, true );
|
||||||
element.tabs( "enable" );
|
element.tabs( "enable" );
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs({ disabled: [ 0, 1 ] });
|
element.tabs({ disabled: [ 0, 1 ] });
|
||||||
tabs_disabled( element, [ 0, 1 ] );
|
disabled( element, [ 0, 1 ] );
|
||||||
element.tabs( "enable" );
|
element.tabs( "enable" );
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "enable( index )", function() {
|
test( "enable( index )", function() {
|
||||||
expect( 10 );
|
expect( 10 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs({ disabled: true });
|
var element = $( "#tabs1" ).tabs({ disabled: true });
|
||||||
tabs_disabled( element, true );
|
disabled( element, true );
|
||||||
// fully disabled -> partially disabled
|
// fully disabled -> partially disabled
|
||||||
element.tabs( "enable", 1 );
|
element.tabs( "enable", 1 );
|
||||||
tabs_disabled( element, [ 0, 2 ] );
|
disabled( element, [ 0, 2 ] );
|
||||||
// partially disabled -> partially disabled
|
// partially disabled -> partially disabled
|
||||||
element.tabs( "enable", 2 );
|
element.tabs( "enable", 2 );
|
||||||
tabs_disabled( element, [ 0 ] );
|
disabled( element, [ 0 ] );
|
||||||
// already enabled tab, no change
|
// already enabled tab, no change
|
||||||
element.tabs( "enable", 2 );
|
element.tabs( "enable", 2 );
|
||||||
tabs_disabled( element, [ 0 ] );
|
disabled( element, [ 0 ] );
|
||||||
// partially disabled -> fully enabled
|
// partially disabled -> fully enabled
|
||||||
element.tabs( "enable", 0 );
|
element.tabs( "enable", 0 );
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "disable", function() {
|
test( "disable", function() {
|
||||||
expect( 8 );
|
expect( 8 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs({ disabled: false });
|
var element = $( "#tabs1" ).tabs({ disabled: false });
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
element.tabs( "disable" );
|
element.tabs( "disable" );
|
||||||
tabs_disabled( element, true );
|
disabled( element, true );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
element.tabs({ disabled: [ 0, 1 ] });
|
element.tabs({ disabled: [ 0, 1 ] });
|
||||||
tabs_disabled( element, [ 0, 1 ] );
|
disabled( element, [ 0, 1 ] );
|
||||||
element.tabs( "disable" );
|
element.tabs( "disable" );
|
||||||
tabs_disabled( element, true );
|
disabled( element, true );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "disable( index )", function() {
|
test( "disable( index )", function() {
|
||||||
expect( 10 );
|
expect( 10 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs({ disabled: false });
|
var element = $( "#tabs1" ).tabs({ disabled: false });
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
// fully enabled -> partially disabled
|
// fully enabled -> partially disabled
|
||||||
element.tabs( "disable", 1 );
|
element.tabs( "disable", 1 );
|
||||||
tabs_disabled( element, [ 1 ] );
|
disabled( element, [ 1 ] );
|
||||||
// partially disabled -> partially disabled
|
// partially disabled -> partially disabled
|
||||||
element.tabs( "disable", 2 );
|
element.tabs( "disable", 2 );
|
||||||
tabs_disabled( element, [ 1, 2 ] );
|
disabled( element, [ 1, 2 ] );
|
||||||
// already disabled tab, no change
|
// already disabled tab, no change
|
||||||
element.tabs( "disable", 2 );
|
element.tabs( "disable", 2 );
|
||||||
tabs_disabled( element, [ 1, 2 ] );
|
disabled( element, [ 1, 2 ] );
|
||||||
// partially disabled -> fully disabled
|
// partially disabled -> fully disabled
|
||||||
element.tabs( "disable", 0 );
|
element.tabs( "disable", 0 );
|
||||||
tabs_disabled( element, true );
|
disabled( element, true );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "refresh", function() {
|
test( "refresh", function() {
|
||||||
expect( 27 );
|
expect( 27 );
|
||||||
|
|
||||||
var element = $( "#tabs1" ).tabs();
|
var element = $( "#tabs1" ).tabs();
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
|
|
||||||
// disable tab via markup
|
// disable tab via markup
|
||||||
element.find( ".ui-tabs-nav li" ).eq( 1 ).addClass( "ui-state-disabled" );
|
element.find( ".ui-tabs-nav li" ).eq( 1 ).addClass( "ui-state-disabled" );
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
tabs_disabled( element, [ 1 ] );
|
disabled( element, [ 1 ] );
|
||||||
|
|
||||||
// add remote tab
|
// add remote tab
|
||||||
element.find( ".ui-tabs-nav" ).append( "<li id='newTab'><a href='data/test.html'>new</a></li>" );
|
element.find( ".ui-tabs-nav" ).append( "<li id='newTab'><a href='data/test.html'>new</a></li>" );
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element, 1, 0, 0, 0 );
|
state( element, 1, 0, 0, 0 );
|
||||||
tabs_disabled( element, [ 1 ] );
|
disabled( element, [ 1 ] );
|
||||||
equal( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1,
|
equal( element.find( "#" + $( "#newTab a" ).attr( "aria-controls" ) ).length, 1,
|
||||||
"panel added for remote tab" );
|
"panel added for remote tab" );
|
||||||
|
|
||||||
// remove all tabs
|
// remove all tabs
|
||||||
element.find( ".ui-tabs-nav li, .ui-tabs-panel" ).remove();
|
element.find( ".ui-tabs-nav li, .ui-tabs-panel" ).remove();
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element );
|
state( element );
|
||||||
equal( element.tabs( "option", "active" ), false, "no active tab" );
|
equal( element.tabs( "option", "active" ), false, "no active tab" );
|
||||||
|
|
||||||
// add tabs
|
// add tabs
|
||||||
@ -115,34 +118,34 @@ test( "refresh", function() {
|
|||||||
.append( "<div id='newTab4'>new 4</div>" )
|
.append( "<div id='newTab4'>new 4</div>" )
|
||||||
.append( "<div id='newTab5'>new 5</div>" );
|
.append( "<div id='newTab5'>new 5</div>" );
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element, 0, 0, 0, 0 );
|
state( element, 0, 0, 0, 0 );
|
||||||
tabs_disabled( element, [ 0 ] );
|
disabled( element, [ 0 ] );
|
||||||
|
|
||||||
// activate third tab
|
// activate third tab
|
||||||
element.tabs( "option", "active", 2 );
|
element.tabs( "option", "active", 2 );
|
||||||
tabs_state( element, 0, 0, 1, 0 );
|
state( element, 0, 0, 1, 0 );
|
||||||
tabs_disabled( element, [ 0 ] );
|
disabled( element, [ 0 ] );
|
||||||
|
|
||||||
// remove fourth tab, third tab should stay active
|
// remove fourth tab, third tab should stay active
|
||||||
element.find( ".ui-tabs-nav li" ).eq( 3 ).remove();
|
element.find( ".ui-tabs-nav li" ).eq( 3 ).remove();
|
||||||
element.find( ".ui-tabs-panel" ).eq( 3 ).remove();
|
element.find( ".ui-tabs-panel" ).eq( 3 ).remove();
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
tabs_disabled( element, [ 0 ] );
|
disabled( element, [ 0 ] );
|
||||||
|
|
||||||
// remove third (active) tab, second tab should become active
|
// remove third (active) tab, second tab should become active
|
||||||
element.find( ".ui-tabs-nav li" ).eq( 2 ).remove();
|
element.find( ".ui-tabs-nav li" ).eq( 2 ).remove();
|
||||||
element.find( ".ui-tabs-panel" ).eq( 2 ).remove();
|
element.find( ".ui-tabs-panel" ).eq( 2 ).remove();
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element, 0, 1 );
|
state( element, 0, 1 );
|
||||||
tabs_disabled( element, [ 0 ] );
|
disabled( element, [ 0 ] );
|
||||||
|
|
||||||
// remove first tab, previously active tab (now first) should stay active
|
// remove first tab, previously active tab (now first) should stay active
|
||||||
element.find( ".ui-tabs-nav li" ).eq( 0 ).remove();
|
element.find( ".ui-tabs-nav li" ).eq( 0 ).remove();
|
||||||
element.find( ".ui-tabs-panel" ).eq( 0 ).remove();
|
element.find( ".ui-tabs-panel" ).eq( 0 ).remove();
|
||||||
element.tabs( "refresh" );
|
element.tabs( "refresh" );
|
||||||
tabs_state( element, 1 );
|
state( element, 1 );
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "load", function() {
|
asyncTest( "load", function() {
|
||||||
@ -162,14 +165,13 @@ asyncTest( "load", function() {
|
|||||||
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
||||||
equal( ui.panel.size(), 1, "panel size" );
|
equal( ui.panel.size(), 1, "panel size" );
|
||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
tabs_state( element, 1, 0, 0, 0, 0 );
|
state( element, 1, 0, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
element.one( "tabsload", function( event, ui ) {
|
element.one( "tabsload", function( event, ui ) {
|
||||||
// TODO: remove wrapping in 2.0
|
// TODO: remove wrapping in 2.0
|
||||||
var uiTab = $( ui.tab ),
|
var uiTab = $( ui.tab ),
|
||||||
uiPanel = $( ui.panel );
|
uiPanel = $( ui.panel ),
|
||||||
|
tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
|
||||||
var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
|
|
||||||
panelId = tab.attr( "aria-controls" ),
|
panelId = tab.attr( "aria-controls" ),
|
||||||
panel = $( "#" + panelId );
|
panel = $( "#" + panelId );
|
||||||
|
|
||||||
@ -179,11 +181,11 @@ asyncTest( "load", function() {
|
|||||||
equal( uiPanel.size(), 1, "panel size" );
|
equal( uiPanel.size(), 1, "panel size" );
|
||||||
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
|
||||||
equal( uiPanel.find( "p" ).length, 1, "panel html" );
|
equal( uiPanel.find( "p" ).length, 1, "panel html" );
|
||||||
tabs_state( element, 1, 0, 0, 0, 0 );
|
state( element, 1, 0, 0, 0, 0 );
|
||||||
setTimeout( tabsload1, 100 );
|
setTimeout( tabsload1, 100 );
|
||||||
});
|
});
|
||||||
element.tabs( "load", 3 );
|
element.tabs( "load", 3 );
|
||||||
tabs_state( element, 1, 0, 0, 0, 0 );
|
state( element, 1, 0, 0, 0, 0 );
|
||||||
|
|
||||||
function tabsload1() {
|
function tabsload1() {
|
||||||
// no need to test details of event (tested in events tests)
|
// no need to test details of event (tested in events tests)
|
||||||
@ -195,7 +197,7 @@ asyncTest( "load", function() {
|
|||||||
setTimeout( tabsload2, 100 );
|
setTimeout( tabsload2, 100 );
|
||||||
});
|
});
|
||||||
element.tabs( "option", "active", 3 );
|
element.tabs( "option", "active", 3 );
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function tabsload2() {
|
function tabsload2() {
|
||||||
@ -210,14 +212,13 @@ asyncTest( "load", function() {
|
|||||||
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
|
||||||
equal( ui.panel.size(), 1, "panel size" );
|
equal( ui.panel.size(), 1, "panel size" );
|
||||||
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
element.one( "tabsload", function( event, ui ) {
|
element.one( "tabsload", function( event, ui ) {
|
||||||
// TODO: remove wrapping in 2.0
|
// TODO: remove wrapping in 2.0
|
||||||
var uiTab = $( ui.tab ),
|
var uiTab = $( ui.tab ),
|
||||||
uiPanel = $( ui.panel );
|
uiPanel = $( ui.panel ),
|
||||||
|
tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
|
||||||
var tab = element.find( ".ui-tabs-nav a" ).eq( 3 ),
|
|
||||||
panelId = tab.attr( "aria-controls" ),
|
panelId = tab.attr( "aria-controls" ),
|
||||||
panel = $( "#" + panelId );
|
panel = $( "#" + panelId );
|
||||||
|
|
||||||
@ -226,11 +227,11 @@ asyncTest( "load", function() {
|
|||||||
strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
|
strictEqual( uiTab[ 0 ], tab[ 0 ], "tab" );
|
||||||
equal( uiPanel.size(), 1, "panel size" );
|
equal( uiPanel.size(), 1, "panel size" );
|
||||||
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
|
strictEqual( uiPanel[ 0 ], panel[ 0 ], "panel" );
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
element.tabs( "load", 3 );
|
element.tabs( "load", 3 );
|
||||||
tabs_state( element, 0, 0, 0, 1, 0 );
|
state( element, 0, 0, 0, 1, 0 );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
var disabled = TestHelpers.tabs.disabled,
|
||||||
|
state = TestHelpers.tabs.state;
|
||||||
|
|
||||||
module( "tabs: options" );
|
module( "tabs: options" );
|
||||||
|
|
||||||
test( "{ active: default }", function() {
|
test( "{ active: default }", function() {
|
||||||
@ -7,13 +10,13 @@ test( "{ active: default }", function() {
|
|||||||
|
|
||||||
var element = $( "#tabs1" ).tabs();
|
var element = $( "#tabs1" ).tabs();
|
||||||
equal( element.tabs( "option", "active" ), 0, "should be 0 by default" );
|
equal( element.tabs( "option", "active" ), 0, "should be 0 by default" );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
|
|
||||||
location.hash = "#fragment-3";
|
location.hash = "#fragment-3";
|
||||||
element = $( "#tabs1" ).tabs();
|
element = $( "#tabs1" ).tabs();
|
||||||
equal( element.tabs( "option", "active" ), 2, "should be 2 based on URL" );
|
equal( element.tabs( "option", "active" ), 2, "should be 2 based on URL" );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
location.hash = "#";
|
location.hash = "#";
|
||||||
});
|
});
|
||||||
@ -25,19 +28,19 @@ test( "{ active: false }", function() {
|
|||||||
active: false,
|
active: false,
|
||||||
collapsible: true
|
collapsible: true
|
||||||
});
|
});
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
|
equal( element.find( ".ui-tabs-nav .ui-state-active" ).size(), 0, "no tabs selected" );
|
||||||
strictEqual( element.tabs( "option", "active" ), false );
|
strictEqual( element.tabs( "option", "active" ), false );
|
||||||
|
|
||||||
element.tabs( "option", "collapsible", false );
|
element.tabs( "option", "collapsible", false );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
equal( element.tabs( "option", "active" ), 0 );
|
equal( element.tabs( "option", "active" ), 0 );
|
||||||
|
|
||||||
element.tabs( "destroy" );
|
element.tabs( "destroy" );
|
||||||
element.tabs({
|
element.tabs({
|
||||||
active: false
|
active: false
|
||||||
});
|
});
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
strictEqual( element.tabs( "option", "active" ), 0 );
|
strictEqual( element.tabs( "option", "active" ), 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,19 +51,19 @@ test( "{ active: Number }", function() {
|
|||||||
active: 2
|
active: 2
|
||||||
});
|
});
|
||||||
equal( element.tabs( "option", "active" ), 2 );
|
equal( element.tabs( "option", "active" ), 2 );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
equal( element.tabs( "option", "active" ), 0 );
|
equal( element.tabs( "option", "active" ), 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
|
element.find( ".ui-tabs-nav a" ).eq( 1 ).click();
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.tabs( "option", "active", 10 );
|
element.tabs( "option", "active", 10 );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( $.uiBackCompat === false ) {
|
if ( $.uiBackCompat === false ) {
|
||||||
@ -69,19 +72,19 @@ if ( $.uiBackCompat === false ) {
|
|||||||
active: -1
|
active: -1
|
||||||
});
|
});
|
||||||
equal( element.tabs( "option", "active" ), 2 );
|
equal( element.tabs( "option", "active" ), 2 );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.tabs( "option", "active", -2 );
|
element.tabs( "option", "active", -2 );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.tabs( "option", "active", -10 );
|
element.tabs( "option", "active", -10 );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.tabs( "option", "active", -3 );
|
element.tabs( "option", "active", -3 );
|
||||||
equal( element.tabs( "option", "active" ), 0 );
|
equal( element.tabs( "option", "active" ), 0 );
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +94,9 @@ test( "active - mismatched tab/panel order", function() {
|
|||||||
location.hash = "#tabs7-2";
|
location.hash = "#tabs7-2";
|
||||||
var element = $( "#tabs7" ).tabs();
|
var element = $( "#tabs7" ).tabs();
|
||||||
equal( element.tabs( "option", "active" ), 1, "should be 1 based on URL" );
|
equal( element.tabs( "option", "active" ), 1, "should be 1 based on URL" );
|
||||||
tabs_state( element, 0, 1 );
|
state( element, 0, 1 );
|
||||||
element.tabs( "option", "active", 0 );
|
element.tabs( "option", "active", 0 );
|
||||||
tabs_state( element, 1, 0 );
|
state( element, 1, 0 );
|
||||||
location.hash = "#";
|
location.hash = "#";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -105,11 +108,11 @@ test( "{ collapsible: false }", function() {
|
|||||||
});
|
});
|
||||||
element.tabs( "option", "active", false );
|
element.tabs( "option", "active", false );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.find( ".ui-state-active a" ).eq( 1 ).click();
|
element.find( ".ui-state-active a" ).eq( 1 ).click();
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ collapsible: true }", function() {
|
test( "{ collapsible: true }", function() {
|
||||||
@ -122,15 +125,15 @@ test( "{ collapsible: true }", function() {
|
|||||||
|
|
||||||
element.tabs( "option", "active", false );
|
element.tabs( "option", "active", false );
|
||||||
equal( element.tabs( "option", "active" ), false );
|
equal( element.tabs( "option", "active" ), false );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
|
|
||||||
element.tabs( "option", "active", 1 );
|
element.tabs( "option", "active", 1 );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.find( ".ui-state-active a" ).click();
|
element.find( ".ui-state-active a" ).click();
|
||||||
equal( element.tabs( "option", "active" ), false );
|
equal( element.tabs( "option", "active" ), false );
|
||||||
tabs_state( element, 0, 0, 0 );
|
state( element, 0, 0, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "disabled", function() {
|
test( "disabled", function() {
|
||||||
@ -138,23 +141,23 @@ test( "disabled", function() {
|
|||||||
|
|
||||||
// fully enabled by default
|
// fully enabled by default
|
||||||
var element = $( "#tabs1" ).tabs();
|
var element = $( "#tabs1" ).tabs();
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
|
|
||||||
// disable single tab
|
// disable single tab
|
||||||
element.tabs( "option", "disabled", [ 1 ] );
|
element.tabs( "option", "disabled", [ 1 ] );
|
||||||
tabs_disabled( element, [ 1 ] );
|
disabled( element, [ 1 ] );
|
||||||
|
|
||||||
// disabled active tab
|
// disabled active tab
|
||||||
element.tabs( "option", "disabled", [ 0, 1 ] );
|
element.tabs( "option", "disabled", [ 0, 1 ] );
|
||||||
tabs_disabled( element, [ 0, 1 ] );
|
disabled( element, [ 0, 1 ] );
|
||||||
|
|
||||||
// disable all tabs
|
// disable all tabs
|
||||||
element.tabs( "option", "disabled", [ 0, 1, 2 ] );
|
element.tabs( "option", "disabled", [ 0, 1, 2 ] );
|
||||||
tabs_disabled( element, true );
|
disabled( element, true );
|
||||||
|
|
||||||
// enable all tabs
|
// enable all tabs
|
||||||
element.tabs( "option", "disabled", [] );
|
element.tabs( "option", "disabled", [] );
|
||||||
tabs_disabled( element, false );
|
disabled( element, false );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ event: null }", function() {
|
test( "{ event: null }", function() {
|
||||||
@ -163,16 +166,16 @@ test( "{ event: null }", function() {
|
|||||||
var element = $( "#tabs1" ).tabs({
|
var element = $( "#tabs1" ).tabs({
|
||||||
event: null
|
event: null
|
||||||
});
|
});
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.tabs( "option", "active", 1 );
|
element.tabs( "option", "active", 1 );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// ensure default click handler isn't bound
|
// ensure default click handler isn't bound
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 2 ).click();
|
element.find( ".ui-tabs-nav a" ).eq( 2 ).click();
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "{ event: custom }", function() {
|
test( "{ event: custom }", function() {
|
||||||
@ -181,31 +184,31 @@ test( "{ event: custom }", function() {
|
|||||||
var element = $( "#tabs1" ).tabs({
|
var element = $( "#tabs1" ).tabs({
|
||||||
event: "custom1 custom2"
|
event: "custom1 custom2"
|
||||||
});
|
});
|
||||||
tabs_state( element, 1, 0, 0 );
|
state( element, 1, 0, 0 );
|
||||||
|
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
|
element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
// ensure default click handler isn't bound
|
// ensure default click handler isn't bound
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" );
|
element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
|
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" );
|
element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" );
|
||||||
equal( element.tabs( "option", "active" ), 2 );
|
equal( element.tabs( "option", "active" ), 2 );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.tabs( "option", "event", "custom3" );
|
element.tabs( "option", "event", "custom3" );
|
||||||
|
|
||||||
// ensure old event handlers are unbound
|
// ensure old event handlers are unbound
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
|
element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
|
||||||
equal( element.tabs( "option", "active" ), 2 );
|
equal( element.tabs( "option", "active" ), 2 );
|
||||||
tabs_state( element, 0, 0, 1 );
|
state( element, 0, 0, 1 );
|
||||||
|
|
||||||
element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" );
|
element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" );
|
||||||
equal( element.tabs( "option", "active" ), 1 );
|
equal( element.tabs( "option", "active" ), 1 );
|
||||||
tabs_state( element, 0, 1, 0 );
|
state( element, 0, 1, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: add animation tests
|
// TODO: add animation tests
|
||||||
|
61
tests/unit/tabs/tabs_test_helpers.js
Normal file
61
tests/unit/tabs/tabs_test_helpers.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
TestHelpers.tabs = {
|
||||||
|
disabled: function( tabs, state ) {
|
||||||
|
var expected, actual,
|
||||||
|
internalState = tabs.tabs( "option", "disabled" );
|
||||||
|
|
||||||
|
if ( internalState === false ) {
|
||||||
|
internalState = [];
|
||||||
|
}
|
||||||
|
if ( internalState === true ) {
|
||||||
|
internalState = $.map( new Array( tabs.find( ".ui-tabs-nav li" ).length ), function( _, index ) {
|
||||||
|
return index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
expected = $.map( new Array( tabs.find ( ".ui-tabs-nav li" ).length ), function( _, index ) {
|
||||||
|
if ( typeof state === "boolean" ) {
|
||||||
|
return state ? 1 : 0;
|
||||||
|
} else {
|
||||||
|
return $.inArray( index, state ) !== -1 ? 1 : 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
actual = tabs.find( ".ui-tabs-nav li" ).map(function( index ) {
|
||||||
|
var tab = $( this ),
|
||||||
|
tabIsDisabled = tab.hasClass( "ui-state-disabled" );
|
||||||
|
|
||||||
|
if ( tabIsDisabled && $.inArray( index, internalState ) !== -1 ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ( !tabIsDisabled && $.inArray( index, internalState ) === -1 ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// mixed state - invalid
|
||||||
|
return -1;
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
deepEqual( tabs.tabs( "option", "disabled" ), state );
|
||||||
|
deepEqual( actual, expected );
|
||||||
|
},
|
||||||
|
|
||||||
|
state: function( tabs ) {
|
||||||
|
var expected = $.makeArray( arguments ).slice( 1 ),
|
||||||
|
actual = tabs.find( ".ui-tabs-nav li" ).map(function() {
|
||||||
|
var tab = $( this ),
|
||||||
|
panel = $( $.ui.tabs.prototype._sanitizeSelector(
|
||||||
|
"#" + tab.find( "a" ).attr( "aria-controls" ) ) ),
|
||||||
|
tabIsActive = tab.hasClass( "ui-state-active" ),
|
||||||
|
panelIsActive = panel.css( "display" ) !== "none";
|
||||||
|
|
||||||
|
if ( tabIsActive && panelIsActive ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ( !tabIsActive && !panelIsActive ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1; // mixed state - invalid
|
||||||
|
}).get();
|
||||||
|
deepEqual( actual, expected );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,5 +1,7 @@
|
|||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
window.TestHelpers = {};
|
||||||
|
|
||||||
function testWidgetDefaults( widget, defaults ) {
|
function testWidgetDefaults( widget, defaults ) {
|
||||||
var pluginDefaults = $.ui[ widget ].prototype.options;
|
var pluginDefaults = $.ui[ widget ].prototype.options;
|
||||||
|
|
||||||
@ -54,7 +56,7 @@ function testBasicUsage( widget ) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
window.commonWidgetTests = function( widget, settings ) {
|
TestHelpers.commonWidgetTests = function( widget, settings ) {
|
||||||
module( widget + ": common widget" );
|
module( widget + ": common widget" );
|
||||||
|
|
||||||
testWidgetDefaults( widget, settings.defaults );
|
testWidgetDefaults( widget, settings.defaults );
|
||||||
@ -63,7 +65,7 @@ window.commonWidgetTests = function( widget, settings ) {
|
|||||||
test( "version", function() {
|
test( "version", function() {
|
||||||
ok( "version" in $.ui[ widget ].prototype, "version property exists" );
|
ok( "version" in $.ui[ widget ].prototype, "version property exists" );
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Experimental assertion for comparing DOM objects.
|
* Experimental assertion for comparing DOM objects.
|
||||||
@ -72,20 +74,22 @@ window.commonWidgetTests = function( widget, settings ) {
|
|||||||
* Then compares the result using deepEqual.
|
* Then compares the result using deepEqual.
|
||||||
*/
|
*/
|
||||||
window.domEqual = function( selector, modifier, message ) {
|
window.domEqual = function( selector, modifier, message ) {
|
||||||
var attributes = ["class", "role", "id", "tabIndex", "aria-activedescendant"];
|
var expected, actual,
|
||||||
|
attributes = ["class", "role", "id", "tabIndex", "aria-activedescendant"];
|
||||||
|
|
||||||
function extract(value) {
|
function extract(value) {
|
||||||
if (!value || !value.length) {
|
if (!value || !value.length) {
|
||||||
QUnit.push( false, actual, expected, "domEqual failed, can't extract " + selector + ", message was: " + message );
|
QUnit.push( false, actual, expected, "domEqual failed, can't extract " + selector + ", message was: " + message );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var result = {};
|
var children,
|
||||||
|
result = {};
|
||||||
result.nodeName = value[0].nodeName;
|
result.nodeName = value[0].nodeName;
|
||||||
$.each(attributes, function(index, attr) {
|
$.each(attributes, function(index, attr) {
|
||||||
result[attr] = value.prop(attr);
|
result[attr] = value.prop(attr);
|
||||||
});
|
});
|
||||||
result.children = [];
|
result.children = [];
|
||||||
var children = value.children();
|
children = value.children();
|
||||||
if (children.length) {
|
if (children.length) {
|
||||||
children.each(function() {
|
children.each(function() {
|
||||||
result.children.push(extract($(this)));
|
result.children.push(extract($(this)));
|
||||||
@ -95,11 +99,11 @@ window.domEqual = function( selector, modifier, message ) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
var expected = extract($(selector));
|
expected = extract( $( selector ) );
|
||||||
modifier($(selector));
|
modifier( $( selector ) );
|
||||||
|
|
||||||
var actual = extract($(selector));
|
actual = extract( $( selector ) );
|
||||||
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
|
QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
|
||||||
}
|
};
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
commonWidgetTests( "tooltip", {
|
TestHelpers.commonWidgetTests( "tooltip", {
|
||||||
defaults: {
|
defaults: {
|
||||||
content: function() {},
|
content: function() {},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
@ -16,11 +16,12 @@ test( "destroy", function() {
|
|||||||
test( "open/close", function() {
|
test( "open/close", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
$.fx.off = true;
|
$.fx.off = true;
|
||||||
var element = $( "#tooltipped1" ).tooltip();
|
var tooltip,
|
||||||
|
element = $( "#tooltipped1" ).tooltip();
|
||||||
equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
||||||
|
|
||||||
element.tooltip( "open" );
|
element.tooltip( "open" );
|
||||||
var tooltip = $( "#" + element.attr( "aria-describedby" ) );
|
tooltip = $( "#" + element.attr( "aria-describedby" ) );
|
||||||
ok( tooltip.is( ":visible" ) );
|
ok( tooltip.is( ":visible" ) );
|
||||||
|
|
||||||
element.tooltip( "close" );
|
element.tooltip( "close" );
|
||||||
@ -31,11 +32,12 @@ test( "open/close", function() {
|
|||||||
test( "enable/disable", function() {
|
test( "enable/disable", function() {
|
||||||
expect( 7 );
|
expect( 7 );
|
||||||
$.fx.off = true;
|
$.fx.off = true;
|
||||||
var element = $( "#tooltipped1" ).tooltip();
|
var tooltip,
|
||||||
|
element = $( "#tooltipped1" ).tooltip();
|
||||||
equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
equal( $( ".ui-tooltip" ).length, 0, "no tooltip on init" );
|
||||||
|
|
||||||
element.tooltip( "open" );
|
element.tooltip( "open" );
|
||||||
var tooltip = $( "#" + element.attr( "aria-describedby" ) );
|
tooltip = $( "#" + element.attr( "aria-describedby" ) );
|
||||||
ok( tooltip.is( ":visible" ) );
|
ok( tooltip.is( ":visible" ) );
|
||||||
|
|
||||||
element.tooltip( "disable" );
|
element.tooltip( "disable" );
|
||||||
|
@ -45,11 +45,12 @@ asyncTest( "content: sync + async callback", function() {
|
|||||||
|
|
||||||
test( "items", function() {
|
test( "items", function() {
|
||||||
expect( 2 );
|
expect( 2 );
|
||||||
var element = $( "#qunit-fixture" ).tooltip({
|
var event,
|
||||||
|
element = $( "#qunit-fixture" ).tooltip({
|
||||||
items: "#fixture-span"
|
items: "#fixture-span"
|
||||||
});
|
});
|
||||||
|
|
||||||
var event = $.Event( "mouseenter" );
|
event = $.Event( "mouseenter" );
|
||||||
event.target = $( "#fixture-span" )[ 0 ];
|
event.target = $( "#fixture-span" )[ 0 ];
|
||||||
element.tooltip( "open", event );
|
element.tooltip( "open", event );
|
||||||
deepEqual( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" );
|
deepEqual( $( "#" + $( "#fixture-span" ).attr( "aria-describedby" ) ).text(), "title-text" );
|
||||||
@ -63,7 +64,7 @@ test( "items", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( "tooltipClass", function() {
|
test( "tooltipClass", function() {
|
||||||
expect( 1 )
|
expect( 1 );
|
||||||
var element = $( "#tooltipped1" ).tooltip({
|
var element = $( "#tooltipped1" ).tooltip({
|
||||||
tooltipClass: "custom"
|
tooltipClass: "custom"
|
||||||
}).tooltip( "open" );
|
}).tooltip( "open" );
|
||||||
|
@ -84,7 +84,8 @@ test( "custom selector expression", function() {
|
|||||||
test( "jQuery usage", function() {
|
test( "jQuery usage", function() {
|
||||||
expect( 16 );
|
expect( 16 );
|
||||||
|
|
||||||
var shouldCreate = false;
|
var elem, instance, ret, bcInstance,
|
||||||
|
shouldCreate = false;
|
||||||
|
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
getterSetterVal: 5,
|
getterSetterVal: 5,
|
||||||
@ -113,22 +114,22 @@ test( "jQuery usage", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
shouldCreate = true;
|
shouldCreate = true;
|
||||||
var elem = $( "<div>" )
|
elem = $( "<div>" )
|
||||||
.bind( "testwidgetcreate", function() {
|
.bind( "testwidgetcreate", function() {
|
||||||
ok( shouldCreate, "create event triggered on instantiation" );
|
ok( shouldCreate, "create event triggered on instantiation" );
|
||||||
})
|
})
|
||||||
.testWidget();
|
.testWidget();
|
||||||
shouldCreate = false;
|
shouldCreate = false;
|
||||||
|
|
||||||
var instance = elem.data( "ui-testWidget" );
|
instance = elem.data( "ui-testWidget" );
|
||||||
equal( typeof instance, "object", "instance stored in .data(pluginName)" );
|
equal( typeof instance, "object", "instance stored in .data(pluginName)" );
|
||||||
equal( instance.element[0], elem[0], "element stored on widget" );
|
equal( instance.element[0], elem[0], "element stored on widget" );
|
||||||
var ret = elem.testWidget( "methodWithParams", "value1", "value2" );
|
ret = elem.testWidget( "methodWithParams", "value1", "value2" );
|
||||||
equal( ret, elem, "jQuery object returned from method call" );
|
equal( ret, elem, "jQuery object returned from method call" );
|
||||||
|
|
||||||
// 1.9 BC for #7810
|
// 1.9 BC for #7810
|
||||||
// TODO remove
|
// TODO remove
|
||||||
var bcInstance = elem.data("testWidget");
|
bcInstance = elem.data("testWidget");
|
||||||
equal( typeof bcInstance, "object", "instance stored in .data(pluginName)" );
|
equal( typeof bcInstance, "object", "instance stored in .data(pluginName)" );
|
||||||
equal( bcInstance.element[0], elem[0], "element stored on widget" );
|
equal( bcInstance.element[0], elem[0], "element stored on widget" );
|
||||||
|
|
||||||
@ -148,7 +149,8 @@ test( "jQuery usage", function() {
|
|||||||
test( "direct usage", function() {
|
test( "direct usage", function() {
|
||||||
expect( 9 );
|
expect( 9 );
|
||||||
|
|
||||||
var shouldCreate = false;
|
var elem, instance, ret,
|
||||||
|
shouldCreate = false;
|
||||||
|
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
getterSetterVal: 5,
|
getterSetterVal: 5,
|
||||||
@ -171,17 +173,17 @@ test( "direct usage", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var elem = $( "<div>" )[ 0 ];
|
elem = $( "<div>" )[ 0 ];
|
||||||
|
|
||||||
shouldCreate = true;
|
shouldCreate = true;
|
||||||
var instance = new $.ui.testWidget( {}, elem );
|
instance = new $.ui.testWidget( {}, elem );
|
||||||
shouldCreate = false;
|
shouldCreate = false;
|
||||||
|
|
||||||
equal( $( elem ).data( "ui-testWidget" ), instance,
|
equal( $( elem ).data( "ui-testWidget" ), instance,
|
||||||
"instance stored in .data(pluginName)" );
|
"instance stored in .data(pluginName)" );
|
||||||
equal( instance.element[ 0 ], elem, "element stored on widget" );
|
equal( instance.element[ 0 ], elem, "element stored on widget" );
|
||||||
|
|
||||||
var ret = instance.methodWithParams( "value1", "value2" );
|
ret = instance.methodWithParams( "value1", "value2" );
|
||||||
equal( ret, instance, "plugin returned from method call" );
|
equal( ret, instance, "plugin returned from method call" );
|
||||||
|
|
||||||
ret = instance.getterSetterMethod();
|
ret = instance.getterSetterMethod();
|
||||||
@ -439,7 +441,8 @@ test( ".option() - getter", function() {
|
|||||||
_create: function() {}
|
_create: function() {}
|
||||||
});
|
});
|
||||||
|
|
||||||
var div = $( "<div>" ).testWidget({
|
var options,
|
||||||
|
div = $( "<div>" ).testWidget({
|
||||||
foo: "bar",
|
foo: "bar",
|
||||||
baz: 5,
|
baz: 5,
|
||||||
qux: [ "quux", "quuux" ]
|
qux: [ "quux", "quuux" ]
|
||||||
@ -451,7 +454,7 @@ test( ".option() - getter", function() {
|
|||||||
deepEqual( div.testWidget( "option", "qux"), [ "quux", "quuux" ],
|
deepEqual( div.testWidget( "option", "qux"), [ "quux", "quuux" ],
|
||||||
"single option - array" );
|
"single option - array" );
|
||||||
|
|
||||||
var options = div.testWidget( "option" );
|
options = div.testWidget( "option" );
|
||||||
deepEqual( options, {
|
deepEqual( options, {
|
||||||
create: null,
|
create: null,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@ -483,14 +486,15 @@ test( ".option() - deep option getter", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( ".option() - delegate to ._setOptions()", function() {
|
test( ".option() - delegate to ._setOptions()", function() {
|
||||||
var calls = [];
|
var div,
|
||||||
|
calls = [];
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
_create: function() {},
|
_create: function() {},
|
||||||
_setOptions: function( options ) {
|
_setOptions: function( options ) {
|
||||||
calls.push( options );
|
calls.push( options );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var div = $( "<div>" ).testWidget();
|
div = $( "<div>" ).testWidget();
|
||||||
|
|
||||||
calls = [];
|
calls = [];
|
||||||
div.testWidget( "option", "foo", "bar" );
|
div.testWidget( "option", "foo", "bar" );
|
||||||
@ -506,7 +510,8 @@ test( ".option() - delegate to ._setOptions()", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( ".option() - delegate to ._setOption()", function() {
|
test( ".option() - delegate to ._setOption()", function() {
|
||||||
var calls = [];
|
var div,
|
||||||
|
calls = [];
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
_create: function() {},
|
_create: function() {},
|
||||||
_setOption: function( key, val ) {
|
_setOption: function( key, val ) {
|
||||||
@ -516,7 +521,7 @@ test( ".option() - delegate to ._setOption()", function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var div = $( "<div>" ).testWidget();
|
div = $( "<div>" ).testWidget();
|
||||||
|
|
||||||
calls = [];
|
calls = [];
|
||||||
div.testWidget( "option", "foo", "bar" );
|
div.testWidget( "option", "foo", "bar" );
|
||||||
@ -603,7 +608,7 @@ test( ".widget() - overriden", function() {
|
|||||||
|
|
||||||
test( "._bind() to element (default)", function() {
|
test( "._bind() to element (default)", function() {
|
||||||
expect( 12 );
|
expect( 12 );
|
||||||
var that;
|
var that, widget;
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
_create: function() {
|
_create: function() {
|
||||||
that = this;
|
that = this;
|
||||||
@ -623,7 +628,7 @@ test( "._bind() to element (default)", function() {
|
|||||||
equal( "keydown", event.type );
|
equal( "keydown", event.type );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var widget = $( "<div></div>" )
|
widget = $( "<div></div>" )
|
||||||
.testWidget()
|
.testWidget()
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
@ -643,7 +648,7 @@ test( "._bind() to element (default)", function() {
|
|||||||
|
|
||||||
test( "._bind() to descendent", function() {
|
test( "._bind() to descendent", function() {
|
||||||
expect( 12 );
|
expect( 12 );
|
||||||
var that;
|
var that, widget, descendant;
|
||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
_create: function() {
|
_create: function() {
|
||||||
that = this;
|
that = this;
|
||||||
@ -664,28 +669,28 @@ test( "._bind() to descendent", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// trigger events on both widget and descendent to ensure that only descendent receives them
|
// trigger events on both widget and descendent to ensure that only descendent receives them
|
||||||
var widget = $( "<div><p><strong>hello</strong> world</p></div>" )
|
widget = $( "<div><p><strong>hello</strong> world</p></div>" )
|
||||||
.testWidget()
|
.testWidget()
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
var descendent = widget.find( "strong" )
|
descendant = widget.find( "strong" )
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
widget
|
widget
|
||||||
.testWidget( "disable" )
|
.testWidget( "disable" )
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
descendent
|
descendant
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
widget
|
widget
|
||||||
.testWidget( "enable" )
|
.testWidget( "enable" )
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
descendent
|
descendant
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
descendent
|
descendant
|
||||||
.addClass( "ui-state-disabled" )
|
.addClass( "ui-state-disabled" )
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
@ -693,7 +698,7 @@ test( "._bind() to descendent", function() {
|
|||||||
.testWidget( "destroy" )
|
.testWidget( "destroy" )
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
descendent
|
descendant
|
||||||
.trigger( "keyup" )
|
.trigger( "keyup" )
|
||||||
.trigger( "keydown" );
|
.trigger( "keydown" );
|
||||||
});
|
});
|
||||||
@ -942,8 +947,8 @@ test( "._trigger() - array as ui", function() {
|
|||||||
qux: 5,
|
qux: 5,
|
||||||
quux: 20
|
quux: 20
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
var extra = {
|
extra = {
|
||||||
bar: 5
|
bar: 5
|
||||||
};
|
};
|
||||||
this._trigger( "foo", null, [ ui, extra ] );
|
this._trigger( "foo", null, [ ui, extra ] );
|
||||||
@ -983,8 +988,7 @@ test( "._trigger() - instance as element", function() {
|
|||||||
$.widget( "ui.testWidget", {
|
$.widget( "ui.testWidget", {
|
||||||
defaultElement: null,
|
defaultElement: null,
|
||||||
testEvent: function() {
|
testEvent: function() {
|
||||||
var ui = { foo: "bar" };
|
this._trigger( "foo", null, { foo: "bar" } );
|
||||||
this._trigger( "foo", null, ui );
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var instance = $.ui.testWidget({
|
var instance = $.ui.testWidget({
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
test( "$.widget.extend()", function() {
|
test( "$.widget.extend()", function() {
|
||||||
expect( 26 );
|
expect( 26 );
|
||||||
|
|
||||||
var settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
|
var ret, empty, optionsWithLength, optionsWithDate, myKlass, customObject, optionsWithCustomObject, nullUndef,
|
||||||
|
target, recursive, obj, input, output,
|
||||||
|
settings = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
|
||||||
options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
|
options = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
|
||||||
optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
|
optionsCopy = { xnumber2: 1, xstring2: "x", xxx: "newstring" },
|
||||||
merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
|
merged = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "x", xxx: "newstring" },
|
||||||
@ -11,7 +13,13 @@ test( "$.widget.extend()", function() {
|
|||||||
deepmerged = { foo: { bar: true, baz: true }, foo2: document },
|
deepmerged = { foo: { bar: true, baz: true }, foo2: document },
|
||||||
arr = [1, 2, 3],
|
arr = [1, 2, 3],
|
||||||
nestedarray = { arr: arr },
|
nestedarray = { arr: arr },
|
||||||
ret;
|
defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
|
||||||
|
defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
|
||||||
|
options1 = { xnumber2: 1, xstring2: "x" },
|
||||||
|
options1Copy = { xnumber2: 1, xstring2: "x" },
|
||||||
|
options2 = { xstring2: "xx", xxx: "newstringx" },
|
||||||
|
options2Copy = { xstring2: "xx", xxx: "newstringx" },
|
||||||
|
merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" };
|
||||||
|
|
||||||
$.widget.extend( settings, options );
|
$.widget.extend( settings, options );
|
||||||
deepEqual( settings, merged, "Check if extended: settings must be extended" );
|
deepEqual( settings, merged, "Check if extended: settings must be extended" );
|
||||||
@ -25,19 +33,19 @@ test( "$.widget.extend()", function() {
|
|||||||
strictEqual( $.widget.extend({}, nestedarray).arr, arr, "Don't clone arrays" );
|
strictEqual( $.widget.extend({}, nestedarray).arr, arr, "Don't clone arrays" );
|
||||||
ok( $.isPlainObject( $.widget.extend({ arr: arr }, { arr: {} }).arr ), "Cloned object heve to be an plain object" );
|
ok( $.isPlainObject( $.widget.extend({ arr: arr }, { arr: {} }).arr ), "Cloned object heve to be an plain object" );
|
||||||
|
|
||||||
var empty = {};
|
empty = {};
|
||||||
var optionsWithLength = { foo: { length: -1 } };
|
optionsWithLength = { foo: { length: -1 } };
|
||||||
$.widget.extend( empty, optionsWithLength );
|
$.widget.extend( empty, optionsWithLength );
|
||||||
deepEqual( empty.foo, optionsWithLength.foo, "The length property must copy correctly" );
|
deepEqual( empty.foo, optionsWithLength.foo, "The length property must copy correctly" );
|
||||||
|
|
||||||
empty = {};
|
empty = {};
|
||||||
var optionsWithDate = { foo: { date: new Date } };
|
optionsWithDate = { foo: { date: new Date() } };
|
||||||
$.widget.extend( empty, optionsWithDate );
|
$.widget.extend( empty, optionsWithDate );
|
||||||
deepEqual( empty.foo, optionsWithDate.foo, "Dates copy correctly" );
|
deepEqual( empty.foo, optionsWithDate.foo, "Dates copy correctly" );
|
||||||
|
|
||||||
var myKlass = function() {};
|
myKlass = function() {};
|
||||||
var customObject = new myKlass();
|
customObject = new myKlass();
|
||||||
var optionsWithCustomObject = { foo: { date: customObject } };
|
optionsWithCustomObject = { foo: { date: customObject } };
|
||||||
empty = {};
|
empty = {};
|
||||||
$.widget.extend( empty, optionsWithCustomObject );
|
$.widget.extend( empty, optionsWithCustomObject );
|
||||||
strictEqual( empty.foo.date, customObject, "Custom objects copy correctly (no methods)" );
|
strictEqual( empty.foo.date, customObject, "Custom objects copy correctly (no methods)" );
|
||||||
@ -48,10 +56,9 @@ test( "$.widget.extend()", function() {
|
|||||||
$.widget.extend( empty, optionsWithCustomObject );
|
$.widget.extend( empty, optionsWithCustomObject );
|
||||||
strictEqual( empty.foo.date, customObject, "Custom objects copy correctly" );
|
strictEqual( empty.foo.date, customObject, "Custom objects copy correctly" );
|
||||||
|
|
||||||
ret = $.widget.extend({ foo: 4 }, { foo: new Number(5) } );
|
ret = $.widget.extend({ foo: 4 }, { foo: Number(5) } );
|
||||||
equal( ret.foo, 5, "Wrapped numbers copy correctly" );
|
equal( ret.foo, 5, "Wrapped numbers copy correctly" );
|
||||||
|
|
||||||
var nullUndef;
|
|
||||||
nullUndef = $.widget.extend( {}, options, { xnumber2: null } );
|
nullUndef = $.widget.extend( {}, options, { xnumber2: null } );
|
||||||
strictEqual( nullUndef.xnumber2, null, "Check to make sure null values are copied");
|
strictEqual( nullUndef.xnumber2, null, "Check to make sure null values are copied");
|
||||||
|
|
||||||
@ -61,8 +68,8 @@ test( "$.widget.extend()", function() {
|
|||||||
nullUndef = $.widget.extend( {}, options, { xnumber0: null } );
|
nullUndef = $.widget.extend( {}, options, { xnumber0: null } );
|
||||||
strictEqual( nullUndef.xnumber0, null, "Check to make sure null values are inserted");
|
strictEqual( nullUndef.xnumber0, null, "Check to make sure null values are inserted");
|
||||||
|
|
||||||
var target = {};
|
target = {};
|
||||||
var recursive = { foo:target, bar:5 };
|
recursive = { foo:target, bar:5 };
|
||||||
$.widget.extend( target, recursive );
|
$.widget.extend( target, recursive );
|
||||||
deepEqual( target, { foo: {}, bar: 5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
|
deepEqual( target, { foo: {}, bar: 5 }, "Check to make sure a recursive obj doesn't go never-ending loop by not copying it over" );
|
||||||
|
|
||||||
@ -75,28 +82,20 @@ test( "$.widget.extend()", function() {
|
|||||||
ret = $.widget.extend( { foo:"bar" }, { foo:null } );
|
ret = $.widget.extend( { foo:"bar" }, { foo:null } );
|
||||||
strictEqual( typeof ret.foo, "object", "Make sure a null value doesn't crash with deep extend, for #1908" );
|
strictEqual( typeof ret.foo, "object", "Make sure a null value doesn't crash with deep extend, for #1908" );
|
||||||
|
|
||||||
var obj = { foo:null };
|
obj = { foo:null };
|
||||||
$.widget.extend( obj, { foo:"notnull" } );
|
$.widget.extend( obj, { foo:"notnull" } );
|
||||||
equal( obj.foo, "notnull", "Make sure a null value can be overwritten" );
|
equal( obj.foo, "notnull", "Make sure a null value can be overwritten" );
|
||||||
|
|
||||||
var defaults = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
|
settings = $.widget.extend( {}, defaults, options1, options2 );
|
||||||
defaultsCopy = { xnumber1: 5, xnumber2: 7, xstring1: "peter", xstring2: "pan" },
|
|
||||||
options1 = { xnumber2: 1, xstring2: "x" },
|
|
||||||
options1Copy = { xnumber2: 1, xstring2: "x" },
|
|
||||||
options2 = { xstring2: "xx", xxx: "newstringx" },
|
|
||||||
options2Copy = { xstring2: "xx", xxx: "newstringx" },
|
|
||||||
merged2 = { xnumber1: 5, xnumber2: 1, xstring1: "peter", xstring2: "xx", xxx: "newstringx" };
|
|
||||||
|
|
||||||
var settings = $.widget.extend( {}, defaults, options1, options2 );
|
|
||||||
deepEqual( settings, merged2, "Check if extended: settings must be extended" );
|
deepEqual( settings, merged2, "Check if extended: settings must be extended" );
|
||||||
deepEqual( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
|
deepEqual( defaults, defaultsCopy, "Check if not modified: options1 must not be modified" );
|
||||||
deepEqual( options1, options1Copy, "Check if not modified: options1 must not be modified" );
|
deepEqual( options1, options1Copy, "Check if not modified: options1 must not be modified" );
|
||||||
deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
|
deepEqual( options2, options2Copy, "Check if not modified: options2 must not be modified" );
|
||||||
|
|
||||||
var input = {
|
input = {
|
||||||
key: [ 1, 2, 3 ]
|
key: [ 1, 2, 3 ]
|
||||||
};
|
};
|
||||||
var output = $.widget.extend( {}, input );
|
output = $.widget.extend( {}, input );
|
||||||
deepEqual( input, output, "don't clone arrays" );
|
deepEqual( input, output, "don't clone arrays" );
|
||||||
input.key[0] = 10;
|
input.key[0] = 10;
|
||||||
deepEqual( input, output, "don't clone arrays" );
|
deepEqual( input, output, "don't clone arrays" );
|
||||||
|
@ -118,7 +118,7 @@
|
|||||||
<li class="ui-state-disabled"><a href="#"><span class="ui-icon ui-icon-scissors"></span>Ada</a></li>
|
<li class="ui-state-disabled"><a href="#"><span class="ui-icon ui-icon-scissors"></span>Ada</a></li>
|
||||||
<li><a href="#">Adamsville</a></li>
|
<li><a href="#">Adamsville</a></li>
|
||||||
<li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Addyston</a></li>
|
<li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Addyston</a></li>
|
||||||
<li>
|
<li class="ui-state-disabled">
|
||||||
<a href="#">Delphi</a>
|
<a href="#">Delphi</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#">Ada</a></li>
|
<li><a href="#">Ada</a></li>
|
||||||
|
2
themes/base/jquery.ui.menu.css
vendored
2
themes/base/jquery.ui.menu.css
vendored
@ -10,7 +10,7 @@
|
|||||||
.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
|
.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
|
||||||
.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
|
.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
|
||||||
.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
|
.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
|
||||||
.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; }
|
.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
|
||||||
.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
|
.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
|
||||||
.ui-menu .ui-menu-item a.ui-state-focus,
|
.ui-menu .ui-menu-item a.ui-state-focus,
|
||||||
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
|
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
|
||||||
|
2
themes/base/jquery.ui.resizable.css
vendored
2
themes/base/jquery.ui.resizable.css
vendored
@ -8,7 +8,7 @@
|
|||||||
* http://docs.jquery.com/UI/Resizable#theming
|
* http://docs.jquery.com/UI/Resizable#theming
|
||||||
*/
|
*/
|
||||||
.ui-resizable { position: relative;}
|
.ui-resizable { position: relative;}
|
||||||
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; }
|
.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
|
||||||
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
||||||
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
||||||
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
||||||
|
18
ui/i18n/jquery.ui.datepicker-hi.js
vendored
18
ui/i18n/jquery.ui.datepicker-hi.js
vendored
@ -2,19 +2,19 @@
|
|||||||
/* Written by Michael Dawart. */
|
/* Written by Michael Dawart. */
|
||||||
jQuery(function($){
|
jQuery(function($){
|
||||||
$.datepicker.regional['hi'] = {
|
$.datepicker.regional['hi'] = {
|
||||||
closeText: 'होकर',
|
closeText: 'बंद',
|
||||||
prevText: 'अगला',
|
prevText: 'पिछला',
|
||||||
nextText: 'नेक्स्ट',
|
nextText: 'अगला',
|
||||||
currentText: 'आज',
|
currentText: 'आज',
|
||||||
monthNames: ['जनवरी ','फरवरी','मार्च','अप्रेल','मै','जून',
|
monthNames: ['जनवरी ','फरवरी','मार्च','अप्रेल','मई','जून',
|
||||||
'जूलाई','अगस्त ','सितम्बर','आक्टोबर','नवम्बर','दिसम्बर'],
|
'जूलाई','अगस्त ','सितम्बर','अक्टूबर','नवम्बर','दिसम्बर'],
|
||||||
monthNamesShort: ['जन', 'फर', 'मार्च', 'अप्रेल', 'मै', 'जून',
|
monthNamesShort: ['जन', 'फर', 'मार्च', 'अप्रेल', 'मई', 'जून',
|
||||||
'जूलाई', 'अग', 'सित', 'आक्ट', 'नव', 'िद'],
|
'जूलाई', 'अग', 'सित', अक्ट', 'नव', 'दि'],
|
||||||
dayNames: ['रविवासर', 'सोमवासर', 'मंगलवासर', 'बुधवासर', 'गुरुवासर', 'शुक्रवासर', 'शनिवासर'],
|
dayNames: ['रविवार', 'सोमवार', 'मंगलवार', 'बुधवार', 'गुरुवार', 'शुक्रवार', 'शनिवार'],
|
||||||
dayNamesShort: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
|
dayNamesShort: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
|
||||||
dayNamesMin: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
|
dayNamesMin: ['रवि', 'सोम', 'मंगल', 'बुध', 'गुरु', 'शुक्र', 'शनि'],
|
||||||
weekHeader: 'हफ्ता',
|
weekHeader: 'हफ्ता',
|
||||||
dateFormat: 'mm/dd/yy',
|
dateFormat: 'dd/mm/yy',
|
||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
isRTL: false,
|
isRTL: false,
|
||||||
showMonthAfterYear: false,
|
showMonthAfterYear: false,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user