Skip to content

Commit

Permalink
add proto version of Promise#finally in library version and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jul 19, 2017
1 parent fd70e24 commit 0bc7a9e
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -7513,7 +7513,7 @@ var global = __webpack_require__(2);
var speciesConstructor = __webpack_require__(59);
var promiseResolve = __webpack_require__(110);

$export($export.P, 'Promise', { 'finally': function (onFinally) {
$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
var C = speciesConstructor(this, core.Promise || global.Promise);
var isFunction = typeof onFinally == 'function';
return this.then(
Expand Down
2 changes: 1 addition & 1 deletion client/core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/core.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -7026,7 +7026,7 @@ var global = __webpack_require__(2);
var speciesConstructor = __webpack_require__(54);
var promiseResolve = __webpack_require__(106);

$export($export.P, 'Promise', { 'finally': function (onFinally) {
$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
var C = speciesConstructor(this, core.Promise || global.Promise);
var isFunction = typeof onFinally == 'function';
return this.then(
Expand Down
2 changes: 1 addition & 1 deletion client/library.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/library.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -7411,7 +7411,7 @@ var global = __webpack_require__(2);
var speciesConstructor = __webpack_require__(56);
var promiseResolve = __webpack_require__(106);

$export($export.P, 'Promise', { 'finally': function (onFinally) {
$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
var C = speciesConstructor(this, core.Promise || global.Promise);
var isFunction = typeof onFinally == 'function';
return this.then(
Expand Down
2 changes: 1 addition & 1 deletion client/shim.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/shim.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion library/modules/es7.promise.finally.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var global = require('./_global');
var speciesConstructor = require('./_species-constructor');
var promiseResolve = require('./_promise-resolve');

$export($export.P, 'Promise', { 'finally': function (onFinally) {
$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
var C = speciesConstructor(this, core.Promise || global.Promise);
var isFunction = typeof onFinally == 'function';
return this.then(
Expand Down
2 changes: 1 addition & 1 deletion modules/es7.promise.finally.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var global = require('./_global');
var speciesConstructor = require('./_species-constructor');
var promiseResolve = require('./_promise-resolve');

$export($export.P, 'Promise', { 'finally': function (onFinally) {
$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
var C = speciesConstructor(this, core.Promise || global.Promise);
var isFunction = typeof onFinally == 'function';
return this.then(
Expand Down
45 changes: 45 additions & 0 deletions tests/library.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions tests/library/es7.promise.finally.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{module, test} = QUnit
module \ES7
{Promise} = core

test 'Promise#finally' (assert)!->
assert.isFunction Promise::finally
assert.arity Promise::finally, 1
assert.nonEnumerable Promise::, \finally
assert.ok Promise.resolve(42).finally(->) instanceof Promise, 'returns a promise'

test 'Promise#finally, resolved' (assert)!->
assert.expect 3
async = assert.async!
called = 0
arg = void
Promise.resolve 42
.finally !->
called++
arg := it
.then !->
assert.same it, 42 'resolved with a correct value'
assert.same called, 1 'onFinally function called one time'
assert.same arg, void 'onFinally function called with a correct argument'
async!

test 'Promise#finally, rejected' (assert)!->
assert.expect 2
async = assert.async!
called = 0
arg = void
Promise.reject 42
.finally !->
called++
arg := it
.catch !->
assert.same called, 1 'onFinally function called one time'
assert.same arg, void 'onFinally function called with a correct argument'
async!

0 comments on commit 0bc7a9e

Please sign in to comment.