Skip to content

Commit

Permalink
Merge remote-tracking branch 'next/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
alancutter committed Aug 3, 2016
2 parents ef3b4d9 + 9779cac commit d5c345e
Show file tree
Hide file tree
Showing 119 changed files with 2,447 additions and 2,495 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "test/web-platform-tests"]
path = test/web-platform-tests
url = https://github.com/alancutter/web-platform-tests.git
branch = nativeShippingAPI
8 changes: 5 additions & 3 deletions .travis-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ Chrome)
Firefox)
sudo rm -f /usr/local/bin/firefox
case $VERSION in
stable)
;;
beta)
yes "\n" | sudo add-apt-repository -y ppa:mozillateam/firefox-next
;;
aurora)
yes "\n" | sudo add-apt-repository -y ppa:ubuntu-mozilla-daily/firefox-aurora
;;
# TODO(alancutter): Add support for firefox-aurora.
# This will need to download the binary manually as the ubuntu-mozilla-daily
# ppa doesn't support the version of linux that Travis uses.
esac
sudo apt-get update --fix-missing
sudo apt-get install firefox
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: node_js

node_js:
- "0.10"
- "4.4.4"

install:
- BROWSER="Firefox-aurora" ./.travis-setup.sh
- BROWSER="Firefox-stable" ./.travis-setup.sh

before_script:
- export DISPLAY=:99.0
Expand Down
105 changes: 105 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
## Developer setup instructions

1. `git clone git@github.com:web-animations/web-animations-next.git`
1. `git submodule update --init --recursive` (Necessary for running tests.)
1. Install [node](https://nodejs.org/en/) and make sure `npm` is in your $PATH
1. Run `npm install` in the respository to pull in development dependencies.
1. Run `npm install -g grunt grunt-cli` to get the build tools for the command line.
1. Run `grunt` to build the polyfill.
1. Run `grunt test` to run polyfill and web-platform-tests tests.


## Debugging tests

You can run the tests in an interactive mode with `grunt debug`. This starts the
Karma server once for each polyfill target for each test framework.
Navigate to `http://localhost:9876/debug.html` to open the test runner in your
browser of choice, all test results appear in the Javascript console.
Test failures can be accessed via `window.failures` and `window.formattedFailures`
once the tests have completed.

The polyfill target and tests can be specified as arguments to the `debug` task.
Example: `grunt debug:web-animations-next:test/web-platform-tests/web-animations/animation/pause.html`
Multiple test files may be listed with comma separation. Specifying files will output their URL in the command line.
Example: `http://localhost:9876/base/test/web-platform-tests/web-animations/animation/pause.html`


## Design notes

[Design diagrams](https://drive.google.com/folderview?id=0B9rpPoIDv3vTNlZxOVp6a2tNa1E&usp=sharing)


## Publishing a release

1. Determine the version number for the release

* Increment the first number and reset others to 0 when there are large breaking changes
* Increment the second number and reset the third to 0 when there are significant new, but backwards compatible features
* Otherwise, increment the third number

1. Add versioned release notes to `History.md`, for example:

### 3.13.37 — *November 1, 2001*

* Fixed a bug where nothing worked

Use the following to generate a summary of commits, but edit the list to contain only
relevant information.

git log --first-parent `git describe --tags --abbrev=0 web-animations-js/master`..web-animations-next/master --pretty=format:" * %s"

1. Specify the new version inside `package.json` (for NPM), for example:

```js
"version": "3.13.37",
```

1. Build the polyfill with `npm install && grunt` then update `README.md`'s Build Target Comparison with the current gzipped sizes.
1. Submit both changes to web-animations-next then follow the procedure to push from web-animations-next to web-animations-js.
1. Draft a [new release](https://github.com/web-animations/web-animations-js/releases) at the
commit pushed to web-animations-js in step #4. Copy the release notes from `History.md`
added in step #2.
1. Once you've pushed to web-animations-js, run `npm publish` from that checked-out folder

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.
1. If there are any breaking changes to the API in this release you must notify web-animations-changes@googlegroups.com.
Only owners of the group may post to it so you may need to request ownership or ask someone to post it for you.
## Pushing from web-animations-next to web-animations-js
git fetch web-animations-next
git fetch web-animations-js
git checkout web-animations-js/master
git merge web-animations-next/master --no-edit --quiet
npm install
grunt
# Optional "grunt test" to make sure everything still passes.
git add -f *.min.js*
git rm .gitignore
git commit -m 'Add build artifacts from '`cat .git/refs/remotes/web-animations-next/master`
git push web-animations-js HEAD:refs/heads/master
## Testing architecture
This is an overview of what happens when `grunt test` is run.
1. Polyfill tests written in mocha and chai are run.
1. grunt creates a karma config with mocha and chai adapters.
1. grunt adds the test/js files as includes to the karma config.
1. grunt starts the karma server with the config and waits for the result.
1. The mocha adaptor runs the included tests and reports the results to karma.
1. karma outputs results to the console and returns the final pass/fail result to grunt.
1. web-platform-tests/web-animations tests written in testtharness.js are run.
1. grunt creates a karma config with karma-testharness-adaptor.js included.
1. grunt adds the web-platform-tests/web-animations files to the custom testharnessTests config in the karma config.
1. grunt adds failure expectations to the custom testharnessTests config in the karma config.
1. grunt starts the karma server with the config and waits for the result.
1. The testharness.js adaptor runs the included tests (ignoring expected failures) and reports the results to karma.
1. karma outputs results to the console and returns the final pass/fail result to grunt.
1. grunt exits successfully if both test runs passed.
135 changes: 114 additions & 21 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,30 +182,117 @@ module.exports = function(grunt) {
}
},
test: testTargets,
debug: testTargets,
sauce: testTargets,
});


grunt.task.registerMultiTask('test', 'Run <target> tests under Karma', function() {
var done = this.async();
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config.js'), {});
var config = targetConfig[this.target];
karmaConfig.files = ['test/karma-setup.js'].concat(config.src, config.test);
var karmaServer = require('karma').server;
karmaServer.start(karmaConfig, function(exitCode) {
done(exitCode === 0);
function runKarma(configCallback) {
return new Promise(function(resolve) {
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config.js'), {});
configCallback(karmaConfig);
var karmaServer = require('karma').server;
karmaServer.start(karmaConfig, function(exitCode) {
resolve(exitCode == 0);
});
});
}

function runTests(task, configCallback, testFilter) {
var done = task.async();
var config = targetConfig[task.target];
if (testFilter) {
testFilter = new Set(testFilter.split(','));
}

function filterTests(testFiles) {
if (!testFilter) {
return testFiles;
}
return testFiles.filter(file => testFilter.has(file));
}

function runPolyfillTests() {
var testFiles = filterTests(config.polyfillTests);
if (testFiles.length == 0) {
return Promise.resolve(true);
}

console.info('Running polyfill tests...');
return runKarma(function(karmaConfig) {
configCallback(karmaConfig);
karmaConfig.plugins.push('karma-mocha', 'karma-chai');
karmaConfig.frameworks.push('mocha', 'chai');
karmaConfig.files = ['test/karma-mocha-setup.js'].concat(config.src, testFiles);
});
}
function runWebPlatformTests() {
var testFiles = filterTests(grunt.file.expand(config.webPlatformTests));
if (testFiles.length == 0) {
return Promise.resolve(true);
}

console.info('Running web-platform-tests/web-animations tests...');
return runKarma(function(karmaConfig) {
configCallback(karmaConfig);
karmaConfig.client.testharnessTests = require('./test/web-platform-tests-expectations.js');
karmaConfig.client.testharnessTests.testURLList = testFiles;
karmaConfig.proxies['/base/polyfill.js'] = '/base/' + task.target + '.min.js';
karmaConfig.files.push('test/karma-testharness-adapter.js');
var servedFiles = [
'test/web-platform-tests/resources/**',
'test/web-platform-tests/web-animations/**',
'test/resources/*',
'src/**',
'*.js*',

// TODO(alancutter): Make a separate grunt task for serving these imported Blink tests.
'test/blink/**',
];
for (var pattern of servedFiles) {
karmaConfig.files.push({pattern, included: false, served: true, nocache: true});
}
});
}

var polyfillTestsPassed = false;
runPolyfillTests().then(success => {
polyfillTestsPassed = success;
}).then(runWebPlatformTests).then(webPlatformTestsPassed => {
done(polyfillTestsPassed && webPlatformTestsPassed);
}).catch(function(error) {
console.error(error);
done(false);
});
}

grunt.task.registerMultiTask('test', 'Run <target> tests under Karma', function(testFilter) {
runTests(this, function(karmaConfig) {
karmaConfig.singleRun = true;
}, testFilter);
});

grunt.task.registerMultiTask('debug', 'Debug <target> tests under Karma', function(testFilter) {
if (testFilter) {
console.log('Test file URLs:');
for (var testFile of testFilter.split(',')) {
console.log('http://localhost:9876/base/' + testFile);
}
} else {
console.log('Test runner URL: http://localhost:9876/debug.html');
}
runTests(this, function(karmaConfig) {
karmaConfig.browsers = [];
karmaConfig.singleRun = false;
}, testFilter);
});

grunt.task.registerMultiTask('sauce', 'Run <target> tests under Karma on Saucelabs', function() {
var done = this.async();
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config-ci.js'), {});
var config = targetConfig[this.target];
karmaConfig.files = ['test/karma-setup.js'].concat(config.src, config.test);
karmaConfig.sauceLabs.testName = 'web-animation-next ' + this.target + ' Unit tests';
var karmaServer = require('karma').server;
karmaServer.start(karmaConfig, function(exitCode) {
done(exitCode === 0);
var target = this.target;
runTests(this, function(karmaConfig) {
karmaConfig.singleRun = true;
karmaConfig.plugins.push('karma-saucelabs-launcher');
karmaConfig.sauceLabs = {testName: 'web-animation-next ' + target + ' Unit tests'};
});
});

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

grunt.task.registerTask('clean', 'Remove files generated by grunt', function() {
grunt.file.expand('web-animations*').concat(grunt.file.expand('test/runner-*.html')).concat(grunt.file.expand('inter-*')).forEach(function(file) {
grunt.file.delete(file);
grunt.log.writeln('File ' + file + ' removed');
grunt.task.registerTask('clean', 'Remove files generated by grunt', function(arg) {
var filePatterns = ['inter-*'];
if (arg != 'inter') {
filePatterns.push('*min.js*');
}
filePatterns.forEach(function(filePattern) {
grunt.file.expand(filePattern).forEach(function(file) {
grunt.file.delete(file);
grunt.log.writeln('File ' + file + ' removed');
});
});
});

grunt.task.registerTask('default', ['web-animations', 'web-animations-next', 'web-animations-next-lite', 'gjslint']);
grunt.task.registerTask('default', ['web-animations', 'web-animations-next', 'web-animations-next-lite', 'gjslint', 'clean:inter']);
};
24 changes: 24 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
### 2.2.2 - *August 3 2016*

* [Fixed handling of keyframes with overlapping offsets.](https://github.com/web-animations/web-animations-next/pull/470)

* [Throw TypeError on invalid keyframe input.](https://github.com/web-animations/web-animations-next/pull/471)

* [Fixed display and other animation properties being animated.](https://github.com/web-animations/web-animations-next/pull/474)

* [Throw InvalidStateError when calling play() on reversed infinite animation.](https://github.com/web-animations/web-animations-next/pull/475)

* [Fixed infinite loop in cubic-bezier timing function.](https://github.com/web-animations/web-animations-next/pull/476)

* [Fixed idle animations not becoming paused when seeked.](https://github.com/web-animations/web-animations-next/pull/479)

* [Fixed pause() not rewinding idl animations.](https://github.com/web-animations/web-animations-next/pull/480)

* [Extended cubic-bezier timing function domain from [0, 1] to (-Infinity, Infinity).](https://github.com/web-animations/web-animations-next/pull/481)

* [Fixed timing model to handle corner cases involving Infinity and 0 correctly.](https://github.com/web-animations/web-animations-next/pull/482)

* [Fixed source files missing from npm package.](https://github.com/web-animations/web-animations-next/pull/483)

* [Improved performance of starting and updating individual animations.](https://github.com/web-animations/web-animations-next/pull/485)

### 2.2.1 - *April 28 2016*
* [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.

Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
"type": "git",
"url": "https://github.com/web-animations/web-animations-js.git"
},
"version": "2.2.1",
"version": "2.2.2",
"keywords": [
"animations",
"polyfill"
],
"homepage": "https://github.com/web-animations",
"license": "Apache2",
"license": "Apache-2.0",
"main": "web-animations.min.js",
"files": [
"src/*",
"*.min.js",
"*.min.js.map"
],
Expand All @@ -22,7 +23,8 @@
"chai": "^1.9.1",
"grunt": "~0.4.5",
"grunt-contrib-uglify": "^0.4.0",
"grunt-gjslint": "^0.1.4",
"grunt-gjslint": "^0.2.1",
"closure-linter-wrapper": "^1.0.0",
"grunt-karma": "^0.8.2",
"karma": "^0.12.14",
"karma-mocha": "^0.1.3",
Expand All @@ -40,6 +42,6 @@
"source-map": "~0.1.40"
},
"scripts": {
"test": "grunt test gjslint git-status checkrepo"
"test": "grunt web-animations web-animations-next test gjslint git-status checkrepo"
}
}
Loading

0 comments on commit d5c345e

Please sign in to comment.