Fix Promise#finaly shim regression and cover with tests

This commit is contained in:
SleepWalker 2016-12-05 21:25:23 +02:00
parent c9254d0681
commit ed41a98d3c
2 changed files with 18 additions and 1 deletions

View File

@ -1,6 +1,8 @@
import 'babel-polyfill';
import 'whatwg-fetch';
import 'promise.prototype.finally';
import { shim as shimPromiseFinaly } from 'promise.prototype.finally';
shimPromiseFinaly();
// allow :active styles in mobile Safary
document.addEventListener('touchstart', () => {}, true);

15
tests/polyfills.test.js Normal file
View File

@ -0,0 +1,15 @@
import expect from 'unexpected';
describe('promise.prototype.finally', () => {
it('should be invoked after promise resolved', () =>
expect(new Promise((resolve) => {
Promise.resolve().finally(resolve)
}), 'to be fulfilled')
);
it('should be invoked after promise rejected', () =>
expect(new Promise((resolve) => {
Promise.reject().finally(resolve)
}), 'to be fulfilled')
);
});