Skip to content

Commit d5c345e

Browse files
committed
Merge remote-tracking branch 'next/master'
2 parents ef3b4d9 + 9779cac commit d5c345e

File tree

119 files changed

+2447
-2495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2447
-2495
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "test/web-platform-tests"]
2+
path = test/web-platform-tests
3+
url = https://github.com/alancutter/web-platform-tests.git
4+
branch = nativeShippingAPI

.travis-setup.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ Chrome)
8181
Firefox)
8282
sudo rm -f /usr/local/bin/firefox
8383
case $VERSION in
84+
stable)
85+
;;
8486
beta)
8587
yes "\n" | sudo add-apt-repository -y ppa:mozillateam/firefox-next
8688
;;
87-
aurora)
88-
yes "\n" | sudo add-apt-repository -y ppa:ubuntu-mozilla-daily/firefox-aurora
89-
;;
89+
# TODO(alancutter): Add support for firefox-aurora.
90+
# This will need to download the binary manually as the ubuntu-mozilla-daily
91+
# ppa doesn't support the version of linux that Travis uses.
9092
esac
9193
sudo apt-get update --fix-missing
9294
sudo apt-get install firefox

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
language: node_js
22

33
node_js:
4-
- "0.10"
4+
- "4.4.4"
55

66
install:
7-
- BROWSER="Firefox-aurora" ./.travis-setup.sh
7+
- BROWSER="Firefox-stable" ./.travis-setup.sh
88

99
before_script:
1010
- export DISPLAY=:99.0

CONTRIBUTING.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
## Developer setup instructions
2+
3+
1. `git clone git@github.com:web-animations/web-animations-next.git`
4+
1. `git submodule update --init --recursive` (Necessary for running tests.)
5+
1. Install [node](https://nodejs.org/en/) and make sure `npm` is in your $PATH
6+
1. Run `npm install` in the respository to pull in development dependencies.
7+
1. Run `npm install -g grunt grunt-cli` to get the build tools for the command line.
8+
1. Run `grunt` to build the polyfill.
9+
1. Run `grunt test` to run polyfill and web-platform-tests tests.
10+
11+
12+
## Debugging tests
13+
14+
You can run the tests in an interactive mode with `grunt debug`. This starts the
15+
Karma server once for each polyfill target for each test framework.
16+
Navigate to `http://localhost:9876/debug.html` to open the test runner in your
17+
browser of choice, all test results appear in the Javascript console.
18+
Test failures can be accessed via `window.failures` and `window.formattedFailures`
19+
once the tests have completed.
20+
21+
The polyfill target and tests can be specified as arguments to the `debug` task.
22+
Example: `grunt debug:web-animations-next:test/web-platform-tests/web-animations/animation/pause.html`
23+
Multiple test files may be listed with comma separation. Specifying files will output their URL in the command line.
24+
Example: `http://localhost:9876/base/test/web-platform-tests/web-animations/animation/pause.html`
25+
26+
27+
## Design notes
28+
29+
[Design diagrams](https://drive.google.com/folderview?id=0B9rpPoIDv3vTNlZxOVp6a2tNa1E&usp=sharing)
30+
31+
32+
## Publishing a release
33+
34+
1. Determine the version number for the release
35+
36+
* Increment the first number and reset others to 0 when there are large breaking changes
37+
* Increment the second number and reset the third to 0 when there are significant new, but backwards compatible features
38+
* Otherwise, increment the third number
39+
40+
1. Add versioned release notes to `History.md`, for example:
41+
42+
### 3.13.37 — *November 1, 2001*
43+
44+
* Fixed a bug where nothing worked
45+
46+
Use the following to generate a summary of commits, but edit the list to contain only
47+
relevant information.
48+
49+
git log --first-parent `git describe --tags --abbrev=0 web-animations-js/master`..web-animations-next/master --pretty=format:" * %s"
50+
51+
1. Specify the new version inside `package.json` (for NPM), for example:
52+
53+
```js
54+
"version": "3.13.37",
55+
```
56+
57+
1. Build the polyfill with `npm install && grunt` then update `README.md`'s Build Target Comparison with the current gzipped sizes.
58+
59+
1. Submit both changes to web-animations-next then follow the procedure to push from web-animations-next to web-animations-js.
60+
61+
1. Draft a [new release](https://github.com/web-animations/web-animations-js/releases) at the
62+
commit pushed to web-animations-js in step #4. Copy the release notes from `History.md`
63+
added in step #2.
64+
65+
1. Once you've pushed to web-animations-js, run `npm publish` from that checked-out folder
66+
67+
To do this, you'll need to be a collaborator [on the NPM project](https://www.npmjs.com/package/web-animations-js), or have a collaborator help you.
68+
69+
1. If there are any breaking changes to the API in this release you must notify web-animations-changes@googlegroups.com.
70+
71+
Only owners of the group may post to it so you may need to request ownership or ask someone to post it for you.
72+
73+
## Pushing from web-animations-next to web-animations-js
74+
75+
git fetch web-animations-next
76+
git fetch web-animations-js
77+
git checkout web-animations-js/master
78+
git merge web-animations-next/master --no-edit --quiet
79+
npm install
80+
grunt
81+
# Optional "grunt test" to make sure everything still passes.
82+
git add -f *.min.js*
83+
git rm .gitignore
84+
git commit -m 'Add build artifacts from '`cat .git/refs/remotes/web-animations-next/master`
85+
git push web-animations-js HEAD:refs/heads/master
86+
87+
## Testing architecture
88+
89+
This is an overview of what happens when `grunt test` is run.
90+
91+
1. Polyfill tests written in mocha and chai are run.
92+
1. grunt creates a karma config with mocha and chai adapters.
93+
1. grunt adds the test/js files as includes to the karma config.
94+
1. grunt starts the karma server with the config and waits for the result.
95+
1. The mocha adaptor runs the included tests and reports the results to karma.
96+
1. karma outputs results to the console and returns the final pass/fail result to grunt.
97+
1. web-platform-tests/web-animations tests written in testtharness.js are run.
98+
1. grunt creates a karma config with karma-testharness-adaptor.js included.
99+
1. grunt adds the web-platform-tests/web-animations files to the custom testharnessTests config in the karma config.
100+
1. grunt adds failure expectations to the custom testharnessTests config in the karma config.
101+
1. grunt starts the karma server with the config and waits for the result.
102+
1. The testharness.js adaptor runs the included tests (ignoring expected failures) and reports the results to karma.
103+
1. karma outputs results to the console and returns the final pass/fail result to grunt.
104+
1. grunt exits successfully if both test runs passed.
105+

Gruntfile.js

Lines changed: 114 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -182,30 +182,117 @@ module.exports = function(grunt) {
182182
}
183183
},
184184
test: testTargets,
185+
debug: testTargets,
185186
sauce: testTargets,
186187
});
187188

188189

189-
grunt.task.registerMultiTask('test', 'Run <target> tests under Karma', function() {
190-
var done = this.async();
191-
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config.js'), {});
192-
var config = targetConfig[this.target];
193-
karmaConfig.files = ['test/karma-setup.js'].concat(config.src, config.test);
194-
var karmaServer = require('karma').server;
195-
karmaServer.start(karmaConfig, function(exitCode) {
196-
done(exitCode === 0);
190+
function runKarma(configCallback) {
191+
return new Promise(function(resolve) {
192+
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config.js'), {});
193+
configCallback(karmaConfig);
194+
var karmaServer = require('karma').server;
195+
karmaServer.start(karmaConfig, function(exitCode) {
196+
resolve(exitCode == 0);
197+
});
198+
});
199+
}
200+
201+
function runTests(task, configCallback, testFilter) {
202+
var done = task.async();
203+
var config = targetConfig[task.target];
204+
if (testFilter) {
205+
testFilter = new Set(testFilter.split(','));
206+
}
207+
208+
function filterTests(testFiles) {
209+
if (!testFilter) {
210+
return testFiles;
211+
}
212+
return testFiles.filter(file => testFilter.has(file));
213+
}
214+
215+
function runPolyfillTests() {
216+
var testFiles = filterTests(config.polyfillTests);
217+
if (testFiles.length == 0) {
218+
return Promise.resolve(true);
219+
}
220+
221+
console.info('Running polyfill tests...');
222+
return runKarma(function(karmaConfig) {
223+
configCallback(karmaConfig);
224+
karmaConfig.plugins.push('karma-mocha', 'karma-chai');
225+
karmaConfig.frameworks.push('mocha', 'chai');
226+
karmaConfig.files = ['test/karma-mocha-setup.js'].concat(config.src, testFiles);
227+
});
228+
}
229+
function runWebPlatformTests() {
230+
var testFiles = filterTests(grunt.file.expand(config.webPlatformTests));
231+
if (testFiles.length == 0) {
232+
return Promise.resolve(true);
233+
}
234+
235+
console.info('Running web-platform-tests/web-animations tests...');
236+
return runKarma(function(karmaConfig) {
237+
configCallback(karmaConfig);
238+
karmaConfig.client.testharnessTests = require('./test/web-platform-tests-expectations.js');
239+
karmaConfig.client.testharnessTests.testURLList = testFiles;
240+
karmaConfig.proxies['/base/polyfill.js'] = '/base/' + task.target + '.min.js';
241+
karmaConfig.files.push('test/karma-testharness-adapter.js');
242+
var servedFiles = [
243+
'test/web-platform-tests/resources/**',
244+
'test/web-platform-tests/web-animations/**',
245+
'test/resources/*',
246+
'src/**',
247+
'*.js*',
248+
249+
// TODO(alancutter): Make a separate grunt task for serving these imported Blink tests.
250+
'test/blink/**',
251+
];
252+
for (var pattern of servedFiles) {
253+
karmaConfig.files.push({pattern, included: false, served: true, nocache: true});
254+
}
255+
});
256+
}
257+
258+
var polyfillTestsPassed = false;
259+
runPolyfillTests().then(success => {
260+
polyfillTestsPassed = success;
261+
}).then(runWebPlatformTests).then(webPlatformTestsPassed => {
262+
done(polyfillTestsPassed && webPlatformTestsPassed);
263+
}).catch(function(error) {
264+
console.error(error);
265+
done(false);
197266
});
267+
}
268+
269+
grunt.task.registerMultiTask('test', 'Run <target> tests under Karma', function(testFilter) {
270+
runTests(this, function(karmaConfig) {
271+
karmaConfig.singleRun = true;
272+
}, testFilter);
273+
});
274+
275+
grunt.task.registerMultiTask('debug', 'Debug <target> tests under Karma', function(testFilter) {
276+
if (testFilter) {
277+
console.log('Test file URLs:');
278+
for (var testFile of testFilter.split(',')) {
279+
console.log('http://localhost:9876/base/' + testFile);
280+
}
281+
} else {
282+
console.log('Test runner URL: http://localhost:9876/debug.html');
283+
}
284+
runTests(this, function(karmaConfig) {
285+
karmaConfig.browsers = [];
286+
karmaConfig.singleRun = false;
287+
}, testFilter);
198288
});
199289

200290
grunt.task.registerMultiTask('sauce', 'Run <target> tests under Karma on Saucelabs', function() {
201-
var done = this.async();
202-
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config-ci.js'), {});
203-
var config = targetConfig[this.target];
204-
karmaConfig.files = ['test/karma-setup.js'].concat(config.src, config.test);
205-
karmaConfig.sauceLabs.testName = 'web-animation-next ' + this.target + ' Unit tests';
206-
var karmaServer = require('karma').server;
207-
karmaServer.start(karmaConfig, function(exitCode) {
208-
done(exitCode === 0);
291+
var target = this.target;
292+
runTests(this, function(karmaConfig) {
293+
karmaConfig.singleRun = true;
294+
karmaConfig.plugins.push('karma-saucelabs-launcher');
295+
karmaConfig.sauceLabs = {testName: 'web-animation-next ' + target + ' Unit tests'};
209296
});
210297
});
211298

@@ -284,12 +371,18 @@ module.exports = function(grunt) {
284371
grunt.file.write(this.target + '.map', outMapGenerator.toString());
285372
});
286373

287-
grunt.task.registerTask('clean', 'Remove files generated by grunt', function() {
288-
grunt.file.expand('web-animations*').concat(grunt.file.expand('test/runner-*.html')).concat(grunt.file.expand('inter-*')).forEach(function(file) {
289-
grunt.file.delete(file);
290-
grunt.log.writeln('File ' + file + ' removed');
374+
grunt.task.registerTask('clean', 'Remove files generated by grunt', function(arg) {
375+
var filePatterns = ['inter-*'];
376+
if (arg != 'inter') {
377+
filePatterns.push('*min.js*');
378+
}
379+
filePatterns.forEach(function(filePattern) {
380+
grunt.file.expand(filePattern).forEach(function(file) {
381+
grunt.file.delete(file);
382+
grunt.log.writeln('File ' + file + ' removed');
383+
});
291384
});
292385
});
293386

294-
grunt.task.registerTask('default', ['web-animations', 'web-animations-next', 'web-animations-next-lite', 'gjslint']);
387+
grunt.task.registerTask('default', ['web-animations', 'web-animations-next', 'web-animations-next-lite', 'gjslint', 'clean:inter']);
295388
};

History.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
### 2.2.2 - *August 3 2016*
2+
3+
* [Fixed handling of keyframes with overlapping offsets.](https://github.com/web-animations/web-animations-next/pull/470)
4+
5+
* [Throw TypeError on invalid keyframe input.](https://github.com/web-animations/web-animations-next/pull/471)
6+
7+
* [Fixed display and other animation properties being animated.](https://github.com/web-animations/web-animations-next/pull/474)
8+
9+
* [Throw InvalidStateError when calling play() on reversed infinite animation.](https://github.com/web-animations/web-animations-next/pull/475)
10+
11+
* [Fixed infinite loop in cubic-bezier timing function.](https://github.com/web-animations/web-animations-next/pull/476)
12+
13+
* [Fixed idle animations not becoming paused when seeked.](https://github.com/web-animations/web-animations-next/pull/479)
14+
15+
* [Fixed pause() not rewinding idl animations.](https://github.com/web-animations/web-animations-next/pull/480)
16+
17+
* [Extended cubic-bezier timing function domain from [0, 1] to (-Infinity, Infinity).](https://github.com/web-animations/web-animations-next/pull/481)
18+
19+
* [Fixed timing model to handle corner cases involving Infinity and 0 correctly.](https://github.com/web-animations/web-animations-next/pull/482)
20+
21+
* [Fixed source files missing from npm package.](https://github.com/web-animations/web-animations-next/pull/483)
22+
23+
* [Improved performance of starting and updating individual animations.](https://github.com/web-animations/web-animations-next/pull/485)
24+
125
### 2.2.1 - *April 28 2016*
226
* [Deprecated invalid timing inputs](https://github.com/web-animations/web-animations-next/pull/437) as they will soon throw [TypeErrors](https://github.com/web-animations/web-animations-next/pull/426) in native browsers.
327

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
"type": "git",
66
"url": "https://github.com/web-animations/web-animations-js.git"
77
},
8-
"version": "2.2.1",
8+
"version": "2.2.2",
99
"keywords": [
1010
"animations",
1111
"polyfill"
1212
],
1313
"homepage": "https://github.com/web-animations",
14-
"license": "Apache2",
14+
"license": "Apache-2.0",
1515
"main": "web-animations.min.js",
1616
"files": [
17+
"src/*",
1718
"*.min.js",
1819
"*.min.js.map"
1920
],
@@ -22,7 +23,8 @@
2223
"chai": "^1.9.1",
2324
"grunt": "~0.4.5",
2425
"grunt-contrib-uglify": "^0.4.0",
25-
"grunt-gjslint": "^0.1.4",
26+
"grunt-gjslint": "^0.2.1",
27+
"closure-linter-wrapper": "^1.0.0",
2628
"grunt-karma": "^0.8.2",
2729
"karma": "^0.12.14",
2830
"karma-mocha": "^0.1.3",
@@ -40,6 +42,6 @@
4042
"source-map": "~0.1.40"
4143
},
4244
"scripts": {
43-
"test": "grunt test gjslint git-status checkrepo"
45+
"test": "grunt web-animations web-animations-next test gjslint git-status checkrepo"
4446
}
4547
}

0 commit comments

Comments
 (0)