2015-05-19 21:48:42 +00:00
|
|
|
( function() {
|
|
|
|
|
|
|
|
// Can't test what ain't there
|
2022-06-28 10:39:01 +00:00
|
|
|
if ( !includesModule( "effects" ) ) {
|
2015-05-19 21:48:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-03-01 13:11:50 +00:00
|
|
|
var fxInterval = 13,
|
|
|
|
oldRaf = window.requestAnimationFrame,
|
2015-05-19 21:48:42 +00:00
|
|
|
defaultPrefilter = jQuery.Animation.prefilters[ 0 ],
|
|
|
|
defaultTweener = jQuery.Animation.tweeners[ "*" ][ 0 ],
|
|
|
|
startTime = 505877050;
|
|
|
|
|
|
|
|
// This module tests jQuery.Animation and the corresponding 1.8+ effects APIs
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.module( "animation", {
|
2019-02-18 18:02:38 +00:00
|
|
|
beforeEach: function() {
|
2019-04-04 14:53:38 +00:00
|
|
|
this.sandbox = sinon.createSandbox();
|
2015-05-19 21:48:42 +00:00
|
|
|
this.clock = this.sandbox.useFakeTimers( startTime );
|
2019-04-04 14:53:38 +00:00
|
|
|
window.requestAnimationFrame = null;
|
2015-05-19 21:48:42 +00:00
|
|
|
jQuery.fx.step = {};
|
|
|
|
jQuery.Animation.prefilters = [ defaultPrefilter ];
|
|
|
|
jQuery.Animation.tweeners = { "*": [ defaultTweener ] };
|
|
|
|
},
|
2019-02-18 18:02:38 +00:00
|
|
|
afterEach: function() {
|
2015-05-19 21:48:42 +00:00
|
|
|
this.sandbox.restore();
|
|
|
|
jQuery.fx.stop();
|
|
|
|
window.requestAnimationFrame = oldRaf;
|
|
|
|
return moduleTeardown.apply( this, arguments );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "Animation( subject, props, opts ) - shape", function( assert ) {
|
|
|
|
assert.expect( 20 );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
var subject = { test: 0 },
|
|
|
|
props = { test: 1 },
|
2022-03-01 13:11:50 +00:00
|
|
|
opts = { queue: "fx", duration: fxInterval * 10 },
|
2015-05-19 21:48:42 +00:00
|
|
|
animation = jQuery.Animation( subject, props, opts );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal(
|
|
|
|
animation.elem,
|
|
|
|
subject,
|
|
|
|
".elem is set to the exact object passed"
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
animation.originalOptions,
|
|
|
|
opts,
|
|
|
|
".originalOptions is set to options passed"
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
animation.originalProperties,
|
|
|
|
props,
|
|
|
|
".originalProperties is set to props passed"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert.notEqual( animation.props, props, ".props is not the original however" );
|
|
|
|
assert.deepEqual( animation.props, props, ".props is a copy of the original" );
|
|
|
|
|
|
|
|
assert.deepEqual( animation.opts, {
|
2022-03-01 13:11:50 +00:00
|
|
|
duration: fxInterval * 10,
|
2015-05-19 21:48:42 +00:00
|
|
|
queue: "fx",
|
|
|
|
specialEasing: { test: undefined },
|
|
|
|
easing: jQuery.easing._default
|
|
|
|
}, ".options is filled with default easing and specialEasing" );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( animation.startTime, startTime, "startTime was set" );
|
2022-03-01 13:11:50 +00:00
|
|
|
assert.equal( animation.duration, fxInterval * 10, ".duration is set" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( animation.tweens.length, 1, ".tweens has one Tween" );
|
|
|
|
assert.equal( typeof animation.tweens[ 0 ].run, "function", "which has a .run function" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( typeof animation.createTween, "function", ".createTween is a function" );
|
|
|
|
assert.equal( typeof animation.stop, "function", ".stop is a function" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( typeof animation.done, "function", ".done is a function" );
|
|
|
|
assert.equal( typeof animation.fail, "function", ".fail is a function" );
|
|
|
|
assert.equal( typeof animation.always, "function", ".always is a function" );
|
|
|
|
assert.equal( typeof animation.progress, "function", ".progress is a function" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( jQuery.timers.length, 1, "Added a timers function" );
|
|
|
|
assert.equal( jQuery.timers[ 0 ].elem, subject, "...with .elem as the subject" );
|
|
|
|
assert.equal( jQuery.timers[ 0 ].anim, animation, "...with .anim as the animation" );
|
|
|
|
assert.equal( jQuery.timers[ 0 ].queue, opts.queue, "...with .queue" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
// Cleanup after ourselves by ticking to the end
|
2022-03-01 13:11:50 +00:00
|
|
|
this.clock.tick( fxInterval * 10 );
|
2015-05-19 21:48:42 +00:00
|
|
|
} );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "Animation.prefilter( fn ) - calls prefilter after defaultPrefilter",
|
|
|
|
function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
var prefilter = this.sandbox.stub(),
|
Tests: migrate testing infrastructure to minimal dependencies
This is a complete rework of our testing infrastructure. The main goal is to modernize and drop deprecated or undermaintained dependencies (specifically, grunt, karma, and testswarm). We've achieved that by limiting our dependency list to ones that are unlikely to drop support any time soon. The new dependency list includes:
- `qunit` (our trusty unit testing library)
- `selenium-webdriver` (for spinning up local browsers)
- `express` (for starting a test server and adding middleware)
- express middleware includes uses of `body-parser` and `raw-body`
- `yargs` (for constructing a CLI with pretty help text)
- BrowserStack (for running each of our QUnit modules separately in all of our supported browsers)
- `browserstack-local` (for opening a local tunnel. This is the same package still currently used in the new Browserstack SDK)
- We are not using any other BrowserStack library. The newest BrowserStack SDK does not fit our needs (and isn't open source). Existing libraries, such as `node-browserstack` or `browserstack-runner`, either do not quite fit our needs, are under-maintained and out-of-date, or are not robust enough to meet all of our requirements. We instead call the [BrowserStack REST API](https://github.com/browserstack/api) directly.
## BrowserStack Runner
- automatically retries individual modules in case of test failure(s)
- automatically attempts to re-establish broken tunnels
- automatically refreshes the page in case a test run has stalled
- runs all browsers concurrently and uses as many sessions as are available under the BrowserStack plan. It will wait for available sessions if there are none.
- supports filtering the available list of browsers by browser name, browser version, device, OS, and OS version (see `npm run test:unit -- --list-browsers` for more info). It will retrieve the latest matching browser available if any of those parameters are not specified.
- cleans up after itself (closes the local tunnel, stops the test server, etc.)
- Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables.
## Selenium Runner
- supports running any local browser as long as the driver is installed, including support for headless mode in Chrome, FF, and Edge
- supports running `basic` tests on the latest [jsdom](https://github.com/jsdom/jsdom#readme), which can be seen in action in this PR (see `test:browserless`)
- Node tests will run as before in PRs and all non-dependabot branches, but now includes tests on real Safari in a GH actions macos image instead of playwright-webkit.
- can run multiple browsers and multiple modules concurrently
Other notes:
- Stale dependencies have been removed and all remaining dependencies have been upgraded with a few exceptions:
- `sinon`: stopped supporting IE in version 10. But, `sinon` has been updated to 9.x.
- `husky`: latest does not support Node 10 and runs on `npm install`. Needed for now until git builds are migrated to GitHub Actions.
- `rollup`: latest does not support Node 10. Needed for now until git builds are migrated to GitHub Actions.
- BrowserStack tests are set to run on each `main` branch commit
- `debug` mode leaves Selenium browsers open whether they pass or fail and leaves browsers with test failures open on BrowserStack. The latter is to avoid leaving open too many sessions.
- This PR includes a workflow to dispatch BrowserStack runs on-demand
- The Node version used for most workflow tests has been upgraded to 20.x
- updated supportjQuery to 3.7.1
Run `npm run test:unit -- --help` for CLI documentation
Close gh-5418
2024-02-26 14:42:10 +00:00
|
|
|
defaultSpy = this.sandbox.spy( jQuery.Animation.prefilters, "0" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
jQuery.Animation.prefilter( prefilter );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
jQuery.Animation( {}, {}, {} );
|
|
|
|
assert.ok( prefilter.calledAfter( defaultSpy ), "our prefilter called after" );
|
|
|
|
}
|
|
|
|
);
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "Animation.prefilter( fn, true ) - calls prefilter before defaultPrefilter",
|
|
|
|
function( assert ) {
|
|
|
|
assert.expect( 1 );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
var prefilter = this.sandbox.stub(),
|
Tests: migrate testing infrastructure to minimal dependencies
This is a complete rework of our testing infrastructure. The main goal is to modernize and drop deprecated or undermaintained dependencies (specifically, grunt, karma, and testswarm). We've achieved that by limiting our dependency list to ones that are unlikely to drop support any time soon. The new dependency list includes:
- `qunit` (our trusty unit testing library)
- `selenium-webdriver` (for spinning up local browsers)
- `express` (for starting a test server and adding middleware)
- express middleware includes uses of `body-parser` and `raw-body`
- `yargs` (for constructing a CLI with pretty help text)
- BrowserStack (for running each of our QUnit modules separately in all of our supported browsers)
- `browserstack-local` (for opening a local tunnel. This is the same package still currently used in the new Browserstack SDK)
- We are not using any other BrowserStack library. The newest BrowserStack SDK does not fit our needs (and isn't open source). Existing libraries, such as `node-browserstack` or `browserstack-runner`, either do not quite fit our needs, are under-maintained and out-of-date, or are not robust enough to meet all of our requirements. We instead call the [BrowserStack REST API](https://github.com/browserstack/api) directly.
## BrowserStack Runner
- automatically retries individual modules in case of test failure(s)
- automatically attempts to re-establish broken tunnels
- automatically refreshes the page in case a test run has stalled
- runs all browsers concurrently and uses as many sessions as are available under the BrowserStack plan. It will wait for available sessions if there are none.
- supports filtering the available list of browsers by browser name, browser version, device, OS, and OS version (see `npm run test:unit -- --list-browsers` for more info). It will retrieve the latest matching browser available if any of those parameters are not specified.
- cleans up after itself (closes the local tunnel, stops the test server, etc.)
- Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables.
## Selenium Runner
- supports running any local browser as long as the driver is installed, including support for headless mode in Chrome, FF, and Edge
- supports running `basic` tests on the latest [jsdom](https://github.com/jsdom/jsdom#readme), which can be seen in action in this PR (see `test:browserless`)
- Node tests will run as before in PRs and all non-dependabot branches, but now includes tests on real Safari in a GH actions macos image instead of playwright-webkit.
- can run multiple browsers and multiple modules concurrently
Other notes:
- Stale dependencies have been removed and all remaining dependencies have been upgraded with a few exceptions:
- `sinon`: stopped supporting IE in version 10. But, `sinon` has been updated to 9.x.
- `husky`: latest does not support Node 10 and runs on `npm install`. Needed for now until git builds are migrated to GitHub Actions.
- `rollup`: latest does not support Node 10. Needed for now until git builds are migrated to GitHub Actions.
- BrowserStack tests are set to run on each `main` branch commit
- `debug` mode leaves Selenium browsers open whether they pass or fail and leaves browsers with test failures open on BrowserStack. The latter is to avoid leaving open too many sessions.
- This PR includes a workflow to dispatch BrowserStack runs on-demand
- The Node version used for most workflow tests has been upgraded to 20.x
- updated supportjQuery to 3.7.1
Run `npm run test:unit -- --help` for CLI documentation
Close gh-5418
2024-02-26 14:42:10 +00:00
|
|
|
defaultSpy = this.sandbox.spy( jQuery.Animation.prefilters, "0" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
jQuery.Animation.prefilter( prefilter, true );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
jQuery.Animation( {}, {}, {} );
|
|
|
|
assert.ok( prefilter.calledBefore( defaultSpy ), "our prefilter called before" );
|
|
|
|
}
|
|
|
|
);
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "Animation.prefilter - prefilter return hooks", function( assert ) {
|
|
|
|
assert.expect( 34 );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
var animation, realAnimation, element,
|
|
|
|
sandbox = this.sandbox,
|
|
|
|
ourAnimation = { stop: this.sandbox.spy() },
|
|
|
|
target = { height: 50 },
|
|
|
|
props = { height: 100 },
|
|
|
|
opts = { duration: 100 },
|
|
|
|
prefilter = this.sandbox.spy( function() {
|
|
|
|
realAnimation = this;
|
|
|
|
sandbox.spy( realAnimation, "createTween" );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.deepEqual( realAnimation.originalProperties, props, "originalProperties" );
|
|
|
|
assert.equal( arguments[ 0 ], this.elem, "first param elem" );
|
|
|
|
assert.equal( arguments[ 1 ], this.props, "second param props" );
|
|
|
|
assert.equal( arguments[ 2 ], this.opts, "third param opts" );
|
2015-05-19 21:48:42 +00:00
|
|
|
return ourAnimation;
|
|
|
|
} ),
|
Tests: migrate testing infrastructure to minimal dependencies
This is a complete rework of our testing infrastructure. The main goal is to modernize and drop deprecated or undermaintained dependencies (specifically, grunt, karma, and testswarm). We've achieved that by limiting our dependency list to ones that are unlikely to drop support any time soon. The new dependency list includes:
- `qunit` (our trusty unit testing library)
- `selenium-webdriver` (for spinning up local browsers)
- `express` (for starting a test server and adding middleware)
- express middleware includes uses of `body-parser` and `raw-body`
- `yargs` (for constructing a CLI with pretty help text)
- BrowserStack (for running each of our QUnit modules separately in all of our supported browsers)
- `browserstack-local` (for opening a local tunnel. This is the same package still currently used in the new Browserstack SDK)
- We are not using any other BrowserStack library. The newest BrowserStack SDK does not fit our needs (and isn't open source). Existing libraries, such as `node-browserstack` or `browserstack-runner`, either do not quite fit our needs, are under-maintained and out-of-date, or are not robust enough to meet all of our requirements. We instead call the [BrowserStack REST API](https://github.com/browserstack/api) directly.
## BrowserStack Runner
- automatically retries individual modules in case of test failure(s)
- automatically attempts to re-establish broken tunnels
- automatically refreshes the page in case a test run has stalled
- runs all browsers concurrently and uses as many sessions as are available under the BrowserStack plan. It will wait for available sessions if there are none.
- supports filtering the available list of browsers by browser name, browser version, device, OS, and OS version (see `npm run test:unit -- --list-browsers` for more info). It will retrieve the latest matching browser available if any of those parameters are not specified.
- cleans up after itself (closes the local tunnel, stops the test server, etc.)
- Requires `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` environment variables.
## Selenium Runner
- supports running any local browser as long as the driver is installed, including support for headless mode in Chrome, FF, and Edge
- supports running `basic` tests on the latest [jsdom](https://github.com/jsdom/jsdom#readme), which can be seen in action in this PR (see `test:browserless`)
- Node tests will run as before in PRs and all non-dependabot branches, but now includes tests on real Safari in a GH actions macos image instead of playwright-webkit.
- can run multiple browsers and multiple modules concurrently
Other notes:
- Stale dependencies have been removed and all remaining dependencies have been upgraded with a few exceptions:
- `sinon`: stopped supporting IE in version 10. But, `sinon` has been updated to 9.x.
- `husky`: latest does not support Node 10 and runs on `npm install`. Needed for now until git builds are migrated to GitHub Actions.
- `rollup`: latest does not support Node 10. Needed for now until git builds are migrated to GitHub Actions.
- BrowserStack tests are set to run on each `main` branch commit
- `debug` mode leaves Selenium browsers open whether they pass or fail and leaves browsers with test failures open on BrowserStack. The latter is to avoid leaving open too many sessions.
- This PR includes a workflow to dispatch BrowserStack runs on-demand
- The Node version used for most workflow tests has been upgraded to 20.x
- updated supportjQuery to 3.7.1
Run `npm run test:unit -- --help` for CLI documentation
Close gh-5418
2024-02-26 14:42:10 +00:00
|
|
|
defaultSpy = sandbox.spy( jQuery.Animation.prefilters, "0" ),
|
2015-05-19 21:48:42 +00:00
|
|
|
queueSpy = sandbox.spy( function( next ) {
|
|
|
|
next();
|
|
|
|
} ),
|
|
|
|
TweenSpy = sandbox.spy( jQuery, "Tween" );
|
|
|
|
|
|
|
|
jQuery.Animation.prefilter( prefilter, true );
|
|
|
|
|
|
|
|
sandbox.stub( jQuery.fx, "timer" );
|
|
|
|
|
|
|
|
animation = jQuery.Animation( target, props, opts );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( prefilter.callCount, 1, "Called prefilter" );
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
defaultSpy.callCount,
|
|
|
|
0,
|
|
|
|
"Returning something from a prefilter caused remaining prefilters to not run"
|
|
|
|
);
|
|
|
|
assert.equal( jQuery.fx.timer.callCount, 0, "Returning something never queues a timer" );
|
|
|
|
assert.equal(
|
|
|
|
animation,
|
|
|
|
ourAnimation,
|
|
|
|
"Returning something returned it from jQuery.Animation"
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
realAnimation.createTween.callCount,
|
|
|
|
0,
|
|
|
|
"Returning something never creates tweens"
|
|
|
|
);
|
|
|
|
assert.equal( TweenSpy.callCount, 0, "Returning something never creates tweens" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-12-04 06:49:23 +00:00
|
|
|
// Test overridden usage on queues:
|
2019-04-04 14:53:38 +00:00
|
|
|
prefilter.resetHistory();
|
2015-05-19 21:48:42 +00:00
|
|
|
element = jQuery( "<div>" )
|
|
|
|
.css( "height", 50 )
|
|
|
|
.animate( props, 100 )
|
|
|
|
.queue( queueSpy )
|
|
|
|
.animate( props, 100 )
|
|
|
|
.queue( queueSpy )
|
|
|
|
.animate( props, 100 )
|
|
|
|
.queue( queueSpy );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( prefilter.callCount, 1, "Called prefilter" );
|
|
|
|
assert.equal( queueSpy.callCount, 0, "Next function in queue not called" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
realAnimation.opts.complete.call( realAnimation.elem );
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( queueSpy.callCount, 1, "Next function in queue called after complete" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( prefilter.callCount, 2, "Called prefilter again - animation #2" );
|
|
|
|
assert.equal( ourAnimation.stop.callCount, 0, ".stop() on our animation hasn't been called" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
element.stop();
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( ourAnimation.stop.callCount, 1, ".stop() called ourAnimation.stop()" );
|
|
|
|
assert.ok(
|
|
|
|
!ourAnimation.stop.args[ 0 ][ 0 ],
|
|
|
|
".stop( falsy ) (undefined or false are both valid)"
|
|
|
|
);
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( queueSpy.callCount, 2, "Next queue function called" );
|
|
|
|
assert.ok( queueSpy.calledAfter( ourAnimation.stop ), "After our animation was told to stop" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
// ourAnimation.stop.reset();
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( prefilter.callCount, 3, "Got the next animation" );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
2019-04-04 14:53:38 +00:00
|
|
|
ourAnimation.stop.resetHistory();
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
// do not clear queue, gotoEnd
|
|
|
|
element.stop( false, true );
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.ok( ourAnimation.stop.calledWith( true ), ".stop(true) calls .stop(true)" );
|
|
|
|
assert.ok( queueSpy.calledAfter( ourAnimation.stop ),
|
2015-05-19 21:48:42 +00:00
|
|
|
"and the next queue function ran after we were told" );
|
|
|
|
} );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "Animation.tweener( fn ) - unshifts a * tweener", function( assert ) {
|
|
|
|
assert.expect( 2 );
|
2015-05-19 21:48:42 +00:00
|
|
|
var starTweeners = jQuery.Animation.tweeners[ "*" ];
|
|
|
|
|
|
|
|
jQuery.Animation.tweener( jQuery.noop );
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( starTweeners.length, 2 );
|
|
|
|
assert.deepEqual( starTweeners, [ jQuery.noop, defaultTweener ] );
|
2015-05-19 21:48:42 +00:00
|
|
|
} );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test( "Animation.tweener( 'prop', fn ) - unshifts a 'prop' tweener", function( assert ) {
|
|
|
|
assert.expect( 4 );
|
2015-05-19 21:48:42 +00:00
|
|
|
var tweeners = jQuery.Animation.tweeners,
|
|
|
|
fn = function() {};
|
|
|
|
|
|
|
|
jQuery.Animation.tweener( "prop", jQuery.noop );
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( tweeners.prop.length, 1 );
|
|
|
|
assert.deepEqual( tweeners.prop, [ jQuery.noop ] );
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
jQuery.Animation.tweener( "prop", fn );
|
2015-08-16 03:45:28 +00:00
|
|
|
assert.equal( tweeners.prop.length, 2 );
|
|
|
|
assert.deepEqual( tweeners.prop, [ fn, jQuery.noop ] );
|
2015-05-19 21:48:42 +00:00
|
|
|
} );
|
|
|
|
|
2015-08-16 03:45:28 +00:00
|
|
|
QUnit.test(
|
|
|
|
"Animation.tweener( 'list of props', fn ) - unshifts a tweener to each prop",
|
|
|
|
function( assert ) {
|
|
|
|
assert.expect( 2 );
|
|
|
|
var tweeners = jQuery.Animation.tweeners,
|
|
|
|
fn = function() {};
|
|
|
|
|
|
|
|
jQuery.Animation.tweener( "list of props", jQuery.noop );
|
|
|
|
assert.deepEqual( tweeners, {
|
|
|
|
list: [ jQuery.noop ],
|
|
|
|
of: [ jQuery.noop ],
|
|
|
|
props: [ jQuery.noop ],
|
|
|
|
"*": [ defaultTweener ]
|
|
|
|
} );
|
|
|
|
|
|
|
|
// Test with extra whitespaces
|
|
|
|
jQuery.Animation.tweener( " list\t of \tprops\n*", fn );
|
|
|
|
assert.deepEqual( tweeners, {
|
|
|
|
list: [ fn, jQuery.noop ],
|
|
|
|
of: [ fn, jQuery.noop ],
|
|
|
|
props: [ fn, jQuery.noop ],
|
|
|
|
"*": [ fn, defaultTweener ]
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
);
|
2015-05-19 21:48:42 +00:00
|
|
|
|
|
|
|
} )();
|