diff --git a/spec/observables/concat-spec.ts b/spec/observables/concat-spec.ts index f06e5d373a..4810df6328 100644 --- a/spec/observables/concat-spec.ts +++ b/spec/observables/concat-spec.ts @@ -1,5 +1,6 @@ import {expect} from 'chai'; import * as Rx from '../../dist/cjs/Rx'; +import {lowerCaseO} from '../helpers/test-helper'; import marbleTestingSignature = require('../helpers/marble-testing'); // tslint:disable-line:no-require-imports declare const hot: typeof marbleTestingSignature.hot; @@ -367,4 +368,20 @@ describe('Observable.concat', () => { expect(e1Subscribed).to.be.false; }); + + it('should return passed observable if no scheduler was passed', () => { + const source = cold('--a---b----c---|'); + const result = Observable.concat(source); + + expect(result).to.equal(source); + expectObservable(result).toBe('--a---b----c---|'); + }); + + it('should return RxJS Observable when single lowerCaseO was passed', () => { + const source = lowerCaseO('a', 'b', 'c'); + const result = Observable.concat(source); + + expect(result).to.be.an.instanceof(Observable); + expectObservable(result).toBe('(abc|)'); + }); }); diff --git a/src/operator/concat.ts b/src/operator/concat.ts index e835ba60fc..be5e43eade 100644 --- a/src/operator/concat.ts +++ b/src/operator/concat.ts @@ -135,7 +135,7 @@ export function concatStatic(...observables: Array | scheduler = args.pop(); } - if (scheduler === null && observables.length === 1) { + if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable) { return >observables[0]; }