Commit c5d1c27f authored by Robert Knight's avatar Robert Knight

Provide a polyfill for window.requestAnimationFrame() in tests

rAF is not available in PhantomJS 1.x but is supported by all of our
target browsers (IE >= 10).
parent 6f49c8f6
...@@ -41,21 +41,9 @@ describe('excerpt directive', function () { ...@@ -41,21 +41,9 @@ describe('excerpt directive', function () {
return el.querySelector('.excerpt').offsetHeight; return el.querySelector('.excerpt').offsetHeight;
} }
var defaultRAF = window.requestAnimationFrame;
before(function () { before(function () {
angular.module('app', []) angular.module('app', [])
.directive('excerpt', excerpt.directive); .directive('excerpt', excerpt.directive);
// requestAnimationFrame() is used internally by <excerpt>
// to schedule overflow state checks
window.requestAnimationFrame = function (callback) {
setTimeout(callback, 0);
};
});
after(function () {
window.requestAnimationFrame = defaultRAF;
}); });
beforeEach(function () { beforeEach(function () {
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
// by all browsers we support (IE >= 10) // by all browsers we support (IE >= 10)
require('core-js/es5'); require('core-js/es5');
// PhantomJS 1.x does not support rAF.
require('raf').polyfill();
// Additional polyfills for newer features. // Additional polyfills for newer features.
// Be careful that any polyfills used here match what is used in the // Be careful that any polyfills used here match what is used in the
// app itself. // app itself.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment