diff --git a/packages/core-js-compat/src/data.mjs b/packages/core-js-compat/src/data.mjs index 3214e1052165..7f3618c75e85 100644 --- a/packages/core-js-compat/src/data.mjs +++ b/packages/core-js-compat/src/data.mjs @@ -862,7 +862,7 @@ export const data = { safari: '7.1', rhino: '1.7.13', }, - // TODO: remove this module from `core-js@4` since it's split to below modules + // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.promise': { // V8 6.6 has a serious bug chrome: '67', // '51', @@ -1704,8 +1704,15 @@ export const data = { // TODO: Remove from `core-js@4` 'esnext.object.iterate-values': { }, + // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'esnext.observable': { }, + 'esnext.observable.constructor': { + }, + 'esnext.observable.from': { + }, + 'esnext.observable.of': { + }, // TODO: Remove from `core-js@4` 'esnext.promise.all-settled': null, // TODO: Remove from `core-js@4` @@ -1978,5 +1985,8 @@ delete data['es.promise.catch']; delete data['es.promise.race']; delete data['es.promise.reject']; delete data['es.promise.resolve']; +delete data['esnext.observable.constructor']; +delete data['esnext.observable.from']; +delete data['esnext.observable.of']; export const modules = Object.keys(data); diff --git a/packages/core-js/internals/observable-forced.js b/packages/core-js/internals/observable-forced.js new file mode 100644 index 000000000000..f828806fe0a2 --- /dev/null +++ b/packages/core-js/internals/observable-forced.js @@ -0,0 +1,13 @@ +var global = require('../internals/global'); +var isCallable = require('../internals/is-callable'); +var wellKnownSymbol = require('../internals/well-known-symbol'); + +var $$OBSERVABLE = wellKnownSymbol('observable'); +var NativeObservable = global.Observable; +var NativeObservablePrototype = NativeObservable && NativeObservable.prototype; + +module.exports = !isCallable(NativeObservable) + || !isCallable(NativeObservable.from) + || !isCallable(NativeObservable.of) + || !isCallable(NativeObservablePrototype.subscribe) + || !isCallable(NativeObservablePrototype[$$OBSERVABLE]); diff --git a/packages/core-js/modules/es.promise.js b/packages/core-js/modules/es.promise.js index b97903e7ac65..f4f3091d8e93 100644 --- a/packages/core-js/modules/es.promise.js +++ b/packages/core-js/modules/es.promise.js @@ -1,4 +1,4 @@ -// TODO: remove this module from `core-js@4` since it's split to below modules +// TODO: Remove this module from `core-js@4` since it's split to modules listed below require('../modules/es.promise.constructor'); require('../modules/es.promise.all'); require('../modules/es.promise.catch'); diff --git a/packages/core-js/modules/esnext.observable.constructor.js b/packages/core-js/modules/esnext.observable.constructor.js new file mode 100644 index 000000000000..4ecad9799e73 --- /dev/null +++ b/packages/core-js/modules/esnext.observable.constructor.js @@ -0,0 +1,187 @@ +'use strict'; +// https://github.com/tc39/proposal-observable +var $ = require('../internals/export'); +var call = require('../internals/function-call'); +var DESCRIPTORS = require('../internals/descriptors'); +var setSpecies = require('../internals/set-species'); +var aCallable = require('../internals/a-callable'); +var isCallable = require('../internals/is-callable'); +var anObject = require('../internals/an-object'); +var isObject = require('../internals/is-object'); +var anInstance = require('../internals/an-instance'); +var getMethod = require('../internals/get-method'); +var defineProperty = require('../internals/object-define-property').f; +var redefine = require('../internals/redefine'); +var redefineAll = require('../internals/redefine-all'); +var hostReportErrors = require('../internals/host-report-errors'); +var wellKnownSymbol = require('../internals/well-known-symbol'); +var InternalStateModule = require('../internals/internal-state'); +var OBSERVABLE_FORCED = require('../internals/observable-forced'); + +var $$OBSERVABLE = wellKnownSymbol('observable'); +var OBSERVABLE = 'Observable'; +var SUBSCRIPTION = 'Subscription'; +var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver'; +var getterFor = InternalStateModule.getterFor; +var setInternalState = InternalStateModule.set; +var getObservableInternalState = getterFor(OBSERVABLE); +var getSubscriptionInternalState = getterFor(SUBSCRIPTION); +var getSubscriptionObserverInternalState = getterFor(SUBSCRIPTION_OBSERVER); + +var SubscriptionState = function (observer) { + this.observer = anObject(observer); + this.cleanup = undefined; + this.subscriptionObserver = undefined; +}; + +SubscriptionState.prototype = { + type: SUBSCRIPTION, + clean: function () { + var cleanup = this.cleanup; + if (cleanup) { + this.cleanup = undefined; + try { + cleanup(); + } catch (error) { + hostReportErrors(error); + } + } + }, + close: function () { + if (!DESCRIPTORS) { + var subscription = this.facade; + var subscriptionObserver = this.subscriptionObserver; + subscription.closed = true; + if (subscriptionObserver) subscriptionObserver.closed = true; + } this.observer = undefined; + }, + isClosed: function () { + return this.observer === undefined; + } +}; + +var Subscription = function (observer, subscriber) { + var subscriptionState = setInternalState(this, new SubscriptionState(observer)); + var start; + if (!DESCRIPTORS) this.closed = false; + try { + if (start = getMethod(observer, 'start')) call(start, observer, this); + } catch (error) { + hostReportErrors(error); + } + if (subscriptionState.isClosed()) return; + var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState); + try { + var cleanup = subscriber(subscriptionObserver); + var subscription = cleanup; + if (cleanup != null) subscriptionState.cleanup = isCallable(cleanup.unsubscribe) + ? function () { subscription.unsubscribe(); } + : aCallable(cleanup); + } catch (error) { + subscriptionObserver.error(error); + return; + } if (subscriptionState.isClosed()) subscriptionState.clean(); +}; + +Subscription.prototype = redefineAll({}, { + unsubscribe: function unsubscribe() { + var subscriptionState = getSubscriptionInternalState(this); + if (!subscriptionState.isClosed()) { + subscriptionState.close(); + subscriptionState.clean(); + } + } +}); + +if (DESCRIPTORS) defineProperty(Subscription.prototype, 'closed', { + configurable: true, + get: function () { + return getSubscriptionInternalState(this).isClosed(); + } +}); + +var SubscriptionObserver = function (subscriptionState) { + setInternalState(this, { + type: SUBSCRIPTION_OBSERVER, + subscriptionState: subscriptionState + }); + if (!DESCRIPTORS) this.closed = false; +}; + +SubscriptionObserver.prototype = redefineAll({}, { + next: function next(value) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { + var observer = subscriptionState.observer; + try { + var nextMethod = getMethod(observer, 'next'); + if (nextMethod) call(nextMethod, observer, value); + } catch (error) { + hostReportErrors(error); + } + } + }, + error: function error(value) { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { + var observer = subscriptionState.observer; + subscriptionState.close(); + try { + var errorMethod = getMethod(observer, 'error'); + if (errorMethod) call(errorMethod, observer, value); + else hostReportErrors(value); + } catch (err) { + hostReportErrors(err); + } subscriptionState.clean(); + } + }, + complete: function complete() { + var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; + if (!subscriptionState.isClosed()) { + var observer = subscriptionState.observer; + subscriptionState.close(); + try { + var completeMethod = getMethod(observer, 'complete'); + if (completeMethod) call(completeMethod, observer); + } catch (error) { + hostReportErrors(error); + } subscriptionState.clean(); + } + } +}); + +if (DESCRIPTORS) defineProperty(SubscriptionObserver.prototype, 'closed', { + configurable: true, + get: function () { + return getSubscriptionObserverInternalState(this).subscriptionState.isClosed(); + } +}); + +var $Observable = function Observable(subscriber) { + anInstance(this, ObservablePrototype); + setInternalState(this, { + type: OBSERVABLE, + subscriber: aCallable(subscriber) + }); +}; + +var ObservablePrototype = $Observable.prototype; + +redefineAll(ObservablePrototype, { + subscribe: function subscribe(observer) { + var length = arguments.length; + return new Subscription(isCallable(observer) ? { + next: observer, + error: length > 1 ? arguments[1] : undefined, + complete: length > 2 ? arguments[2] : undefined + } : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber); + } +}); + +redefine(ObservablePrototype, $$OBSERVABLE, function () { return this; }); + +$({ global: true, forced: OBSERVABLE_FORCED }, { + Observable: $Observable +}); + +setSpecies(OBSERVABLE); diff --git a/packages/core-js/modules/esnext.observable.from.js b/packages/core-js/modules/esnext.observable.from.js new file mode 100644 index 000000000000..c579c252307e --- /dev/null +++ b/packages/core-js/modules/esnext.observable.from.js @@ -0,0 +1,36 @@ +'use strict'; +var $ = require('../internals/export'); +var getBuiltIn = require('../internals/get-built-in'); +var call = require('../internals/function-call'); +var anObject = require('../internals/an-object'); +var isConstructor = require('../internals/is-constructor'); +var getIterator = require('../internals/get-iterator'); +var getMethod = require('../internals/get-method'); +var iterate = require('../internals/iterate'); +var wellKnownSymbol = require('../internals/well-known-symbol'); +var OBSERVABLE_FORCED = require('../internals/observable-forced'); + +var $$OBSERVABLE = wellKnownSymbol('observable'); + +// `Observable.from` method +// https://github.com/tc39/proposal-observable +$({ target: 'Observable', stat: true, forced: OBSERVABLE_FORCED }, { + from: function from(x) { + var C = isConstructor(this) ? this : getBuiltIn('Observable'); + var observableMethod = getMethod(anObject(x), $$OBSERVABLE); + if (observableMethod) { + var observable = anObject(call(observableMethod, x)); + return observable.constructor === C ? observable : new C(function (observer) { + return observable.subscribe(observer); + }); + } + var iterator = getIterator(x); + return new C(function (observer) { + iterate(iterator, function (it, stop) { + observer.next(it); + if (observer.closed) return stop(); + }, { IS_ITERATOR: true, INTERRUPTED: true }); + observer.complete(); + }); + } +}); diff --git a/packages/core-js/modules/esnext.observable.js b/packages/core-js/modules/esnext.observable.js index 742703c93ce9..c3ae30ed1575 100644 --- a/packages/core-js/modules/esnext.observable.js +++ b/packages/core-js/modules/esnext.observable.js @@ -1,233 +1,4 @@ -'use strict'; -// https://github.com/tc39/proposal-observable -var $ = require('../internals/export'); -var global = require('../internals/global'); -var call = require('../internals/function-call'); -var DESCRIPTORS = require('../internals/descriptors'); -var setSpecies = require('../internals/set-species'); -var aCallable = require('../internals/a-callable'); -var isCallable = require('../internals/is-callable'); -var isConstructor = require('../internals/is-constructor'); -var anObject = require('../internals/an-object'); -var isObject = require('../internals/is-object'); -var anInstance = require('../internals/an-instance'); -var defineProperty = require('../internals/object-define-property').f; -var redefine = require('../internals/redefine'); -var redefineAll = require('../internals/redefine-all'); -var getIterator = require('../internals/get-iterator'); -var getMethod = require('../internals/get-method'); -var iterate = require('../internals/iterate'); -var hostReportErrors = require('../internals/host-report-errors'); -var wellKnownSymbol = require('../internals/well-known-symbol'); -var InternalStateModule = require('../internals/internal-state'); - -var $$OBSERVABLE = wellKnownSymbol('observable'); -var OBSERVABLE = 'Observable'; -var SUBSCRIPTION = 'Subscription'; -var SUBSCRIPTION_OBSERVER = 'SubscriptionObserver'; -var getterFor = InternalStateModule.getterFor; -var setInternalState = InternalStateModule.set; -var getObservableInternalState = getterFor(OBSERVABLE); -var getSubscriptionInternalState = getterFor(SUBSCRIPTION); -var getSubscriptionObserverInternalState = getterFor(SUBSCRIPTION_OBSERVER); -var Array = global.Array; -var NativeObservable = global.Observable; -var NativeObservablePrototype = NativeObservable && NativeObservable.prototype; - -var FORCED = !isCallable(NativeObservable) - || !isCallable(NativeObservable.from) - || !isCallable(NativeObservable.of) - || !isCallable(NativeObservablePrototype.subscribe) - || !isCallable(NativeObservablePrototype[$$OBSERVABLE]); - -var SubscriptionState = function (observer) { - this.observer = anObject(observer); - this.cleanup = undefined; - this.subscriptionObserver = undefined; -}; - -SubscriptionState.prototype = { - type: SUBSCRIPTION, - clean: function () { - var cleanup = this.cleanup; - if (cleanup) { - this.cleanup = undefined; - try { - cleanup(); - } catch (error) { - hostReportErrors(error); - } - } - }, - close: function () { - if (!DESCRIPTORS) { - var subscription = this.facade; - var subscriptionObserver = this.subscriptionObserver; - subscription.closed = true; - if (subscriptionObserver) subscriptionObserver.closed = true; - } this.observer = undefined; - }, - isClosed: function () { - return this.observer === undefined; - } -}; - -var Subscription = function (observer, subscriber) { - var subscriptionState = setInternalState(this, new SubscriptionState(observer)); - var start; - if (!DESCRIPTORS) this.closed = false; - try { - if (start = getMethod(observer, 'start')) call(start, observer, this); - } catch (error) { - hostReportErrors(error); - } - if (subscriptionState.isClosed()) return; - var subscriptionObserver = subscriptionState.subscriptionObserver = new SubscriptionObserver(subscriptionState); - try { - var cleanup = subscriber(subscriptionObserver); - var subscription = cleanup; - if (cleanup != null) subscriptionState.cleanup = isCallable(cleanup.unsubscribe) - ? function () { subscription.unsubscribe(); } - : aCallable(cleanup); - } catch (error) { - subscriptionObserver.error(error); - return; - } if (subscriptionState.isClosed()) subscriptionState.clean(); -}; - -Subscription.prototype = redefineAll({}, { - unsubscribe: function unsubscribe() { - var subscriptionState = getSubscriptionInternalState(this); - if (!subscriptionState.isClosed()) { - subscriptionState.close(); - subscriptionState.clean(); - } - } -}); - -if (DESCRIPTORS) defineProperty(Subscription.prototype, 'closed', { - configurable: true, - get: function () { - return getSubscriptionInternalState(this).isClosed(); - } -}); - -var SubscriptionObserver = function (subscriptionState) { - setInternalState(this, { - type: SUBSCRIPTION_OBSERVER, - subscriptionState: subscriptionState - }); - if (!DESCRIPTORS) this.closed = false; -}; - -SubscriptionObserver.prototype = redefineAll({}, { - next: function next(value) { - var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; - if (!subscriptionState.isClosed()) { - var observer = subscriptionState.observer; - try { - var nextMethod = getMethod(observer, 'next'); - if (nextMethod) call(nextMethod, observer, value); - } catch (error) { - hostReportErrors(error); - } - } - }, - error: function error(value) { - var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; - if (!subscriptionState.isClosed()) { - var observer = subscriptionState.observer; - subscriptionState.close(); - try { - var errorMethod = getMethod(observer, 'error'); - if (errorMethod) call(errorMethod, observer, value); - else hostReportErrors(value); - } catch (err) { - hostReportErrors(err); - } subscriptionState.clean(); - } - }, - complete: function complete() { - var subscriptionState = getSubscriptionObserverInternalState(this).subscriptionState; - if (!subscriptionState.isClosed()) { - var observer = subscriptionState.observer; - subscriptionState.close(); - try { - var completeMethod = getMethod(observer, 'complete'); - if (completeMethod) call(completeMethod, observer); - } catch (error) { - hostReportErrors(error); - } subscriptionState.clean(); - } - } -}); - -if (DESCRIPTORS) defineProperty(SubscriptionObserver.prototype, 'closed', { - configurable: true, - get: function () { - return getSubscriptionObserverInternalState(this).subscriptionState.isClosed(); - } -}); - -var $Observable = function Observable(subscriber) { - anInstance(this, ObservablePrototype); - setInternalState(this, { - type: OBSERVABLE, - subscriber: aCallable(subscriber) - }); -}; - -var ObservablePrototype = $Observable.prototype; - -redefineAll(ObservablePrototype, { - subscribe: function subscribe(observer) { - var length = arguments.length; - return new Subscription(isCallable(observer) ? { - next: observer, - error: length > 1 ? arguments[1] : undefined, - complete: length > 2 ? arguments[2] : undefined - } : isObject(observer) ? observer : {}, getObservableInternalState(this).subscriber); - } -}); - -redefineAll($Observable, { - from: function from(x) { - var C = isConstructor(this) ? this : $Observable; - var observableMethod = getMethod(anObject(x), $$OBSERVABLE); - if (observableMethod) { - var observable = anObject(call(observableMethod, x)); - return observable.constructor === C ? observable : new C(function (observer) { - return observable.subscribe(observer); - }); - } - var iterator = getIterator(x); - return new C(function (observer) { - iterate(iterator, function (it, stop) { - observer.next(it); - if (observer.closed) return stop(); - }, { IS_ITERATOR: true, INTERRUPTED: true }); - observer.complete(); - }); - }, - of: function of() { - var C = isConstructor(this) ? this : $Observable; - var length = arguments.length; - var items = Array(length); - var index = 0; - while (index < length) items[index] = arguments[index++]; - return new C(function (observer) { - for (var i = 0; i < length; i++) { - observer.next(items[i]); - if (observer.closed) return; - } observer.complete(); - }); - } -}); - -redefine(ObservablePrototype, $$OBSERVABLE, function () { return this; }); - -$({ global: true, forced: FORCED }, { - Observable: $Observable -}); - -setSpecies(OBSERVABLE); +// TODO: Remove this module from `core-js@4` since it's split to modules listed below +require('../modules/esnext.observable.constructor'); +require('../modules/esnext.observable.from'); +require('../modules/esnext.observable.of'); diff --git a/packages/core-js/modules/esnext.observable.of.js b/packages/core-js/modules/esnext.observable.of.js new file mode 100644 index 000000000000..ecf5674d74f8 --- /dev/null +++ b/packages/core-js/modules/esnext.observable.of.js @@ -0,0 +1,25 @@ +'use strict'; +var $ = require('../internals/export'); +var getBuiltIn = require('../internals/get-built-in'); +var isConstructor = require('../internals/is-constructor'); +var OBSERVABLE_FORCED = require('../internals/observable-forced'); + +var Array = getBuiltIn('Array'); + +// `Observable.of` method +// https://github.com/tc39/proposal-observable +$({ target: 'Observable', stat: true, forced: OBSERVABLE_FORCED }, { + of: function of() { + var C = isConstructor(this) ? this : getBuiltIn('Observable'); + var length = arguments.length; + var items = Array(length); + var index = 0; + while (index < length) items[index] = arguments[index++]; + return new C(function (observer) { + for (var i = 0; i < length; i++) { + observer.next(items[i]); + if (observer.closed) return; + } observer.complete(); + }); + } +}); diff --git a/scripts/check-compat-tests.mjs b/scripts/check-compat-tests.mjs index 9576faa5fd87..2e50a4ced6f0 100644 --- a/scripts/check-compat-tests.mjs +++ b/scripts/check-compat-tests.mjs @@ -10,6 +10,9 @@ const modulesSet = new Set([ 'es.promise.race', 'es.promise.reject', 'es.promise.resolve', + 'esnext.observable.constructor', + 'esnext.observable.from', + 'esnext.observable.of', ]); const tested = new Set(Object.keys(globalThis.tests)); const ignore = new Set([ diff --git a/scripts/check-unused-modules.mjs b/scripts/check-unused-modules.mjs index 525e4427d2c0..73278d25ab89 100644 --- a/scripts/check-unused-modules.mjs +++ b/scripts/check-unused-modules.mjs @@ -23,6 +23,9 @@ const definedModules = new Set([ 'es.promise.reject', 'es.promise.resolve', 'esnext.string.at-alternative', + 'esnext.observable.constructor', + 'esnext.observable.from', + 'esnext.observable.of', ]); globalModules.forEach(it => definedModules.has(it) && globalModules.delete(it)); diff --git a/tests/compat/tests.js b/tests/compat/tests.js index 785f077478d6..ec109e507131 100644 --- a/tests/compat/tests.js +++ b/tests/compat/tests.js @@ -819,7 +819,7 @@ GLOBAL.tests = { && parseInt(WHITESPACES + '0x16') === 22; } }, - // TODO: remove this module from `core-js@4` since it's split to below modules + // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.promise': PROMISES_SUPPORT, 'es.promise.constructor': PROMISES_SUPPORT, 'es.promise.all': [PROMISES_SUPPORT, SAFE_ITERATION_CLOSING_SUPPORT, PROMISE_STATICS_ITERATION, function () { @@ -1532,9 +1532,19 @@ GLOBAL.tests = { 'esnext.number.range': function () { return Number.range; }, + // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'esnext.observable': function () { return Observable; }, + 'esnext.observable.constructor': function () { + return Observable; + }, + 'esnext.observable.from': function () { + return Observable.from; + }, + 'esnext.observable.of': function () { + return Observable.of; + }, 'esnext.set.add-all': function () { return Set.prototype.addAll; }, diff --git a/tests/pure/esnext.observable.js b/tests/pure/esnext.observable.constructor.js similarity index 88% rename from tests/pure/esnext.observable.js rename to tests/pure/esnext.observable.constructor.js index dd397925a615..8874fa6508fb 100644 --- a/tests/pure/esnext.observable.js +++ b/tests/pure/esnext.observable.constructor.js @@ -44,13 +44,3 @@ QUnit.test('Observable#@@observable', assert => { const observable = new Observable(() => { /* empty*/ }); assert.same(observable[Symbol.observable](), observable); }); - -QUnit.test('Observable.of', assert => { - assert.isFunction(Observable.of); - assert.arity(Observable.of, 0); -}); - -QUnit.test('Observable.from', assert => { - assert.isFunction(Observable.from); - assert.arity(Observable.from, 1); -}); diff --git a/tests/pure/esnext.observable.from.js b/tests/pure/esnext.observable.from.js new file mode 100644 index 000000000000..217b139e2aaa --- /dev/null +++ b/tests/pure/esnext.observable.from.js @@ -0,0 +1,6 @@ +import Observable from 'core-js-pure/features/observable'; + +QUnit.test('Observable.from', assert => { + assert.isFunction(Observable.from); + assert.arity(Observable.from, 1); +}); diff --git a/tests/pure/esnext.observable.of.js b/tests/pure/esnext.observable.of.js new file mode 100644 index 000000000000..13bf42d00d88 --- /dev/null +++ b/tests/pure/esnext.observable.of.js @@ -0,0 +1,6 @@ +import Observable from 'core-js-pure/features/observable'; + +QUnit.test('Observable.of', assert => { + assert.isFunction(Observable.of); + assert.arity(Observable.of, 0); +}); diff --git a/tests/tests/esnext.observable.js b/tests/tests/esnext.observable.constructor.js similarity index 82% rename from tests/tests/esnext.observable.js rename to tests/tests/esnext.observable.constructor.js index 22e71d3b8f03..df30b77eab0e 100644 --- a/tests/tests/esnext.observable.js +++ b/tests/tests/esnext.observable.constructor.js @@ -45,17 +45,3 @@ QUnit.test('Observable#@@observable', assert => { const observable = new Observable(() => { /* empty*/ }); assert.same(observable[Symbol.observable](), observable); }); - -QUnit.test('Observable.of', assert => { - assert.isFunction(Observable.of); - assert.arity(Observable.of, 0); - assert.name(Observable.of, 'of'); - assert.looksNative(Observable.of); -}); - -QUnit.test('Observable.from', assert => { - assert.isFunction(Observable.from); - assert.arity(Observable.from, 1); - assert.name(Observable.from, 'from'); - assert.looksNative(Observable.from); -}); diff --git a/tests/tests/esnext.observable.from.js b/tests/tests/esnext.observable.from.js new file mode 100644 index 000000000000..93f17b5be65e --- /dev/null +++ b/tests/tests/esnext.observable.from.js @@ -0,0 +1,6 @@ +QUnit.test('Observable.from', assert => { + assert.isFunction(Observable.from); + assert.arity(Observable.from, 1); + assert.name(Observable.from, 'from'); + assert.looksNative(Observable.from); +}); diff --git a/tests/tests/esnext.observable.of.js b/tests/tests/esnext.observable.of.js new file mode 100644 index 000000000000..4307aa9140aa --- /dev/null +++ b/tests/tests/esnext.observable.of.js @@ -0,0 +1,6 @@ +QUnit.test('Observable.of', assert => { + assert.isFunction(Observable.of); + assert.arity(Observable.of, 0); + assert.name(Observable.of, 'of'); + assert.looksNative(Observable.of); +});