refactor: delete containsRegexp() (there is escapeRegExp() in the lang facade)

BREAKING CHANGES:

`containsRegexp` is no more exported from `@angular/core/testing`. It should not have been part of the public API in the first place.
This commit is contained in:
Victor Berchet
2016-06-20 14:21:01 -07:00
parent fdf6bc18dd
commit c5c456120c
7 changed files with 23 additions and 42 deletions

View File

@ -1,5 +1,5 @@
import {beforeEach, ddescribe, xdescribe, describe, expect, iit, inject, beforeEachProviders, it, xit,} from '@angular/core/testing/testing_internal';
import {containsRegexp, fakeAsync, tick, clearPendingTimers} from '@angular/core/testing';
import {fakeAsync, tick, clearPendingTimers} from '@angular/core/testing';
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
import {AsyncTestCompleter} from '@angular/core/testing/testing_internal';
import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter';
@ -1663,7 +1663,7 @@ function declareTests({useJit}: {useJit: boolean}) {
.createAsync(MyComp)
.then((fixture) => {
expect(() => fixture.detectChanges()).toThrowError(containsRegexp(`:0:5`));
expect(() => fixture.detectChanges()).toThrowError(/:0:5/);
async.done();
})}));
@ -1676,7 +1676,7 @@ function declareTests({useJit}: {useJit: boolean}) {
.createAsync(MyComp)
.then((fixture) => {
expect(() => fixture.detectChanges()).toThrowError(containsRegexp(`:0:5`));
expect(() => fixture.detectChanges()).toThrowError(/:0:5/);
async.done();
})}));
@ -1692,7 +1692,7 @@ function declareTests({useJit}: {useJit: boolean}) {
.createAsync(MyComp)
.then((fixture) => {
expect(() => fixture.detectChanges()).toThrowError(containsRegexp(`:0:11`));
expect(() => fixture.detectChanges()).toThrowError(/:0:11/);
async.done();
})}));
});

View File

@ -1,5 +1,5 @@
import {describe, ddescribe, it, iit, xit, xdescribe, expect, beforeEach, beforeEachProviders, inject,} from '@angular/core/testing/testing_internal';
import {fakeAsync, flushMicrotasks, Log, tick, containsRegexp} from '@angular/core/testing';
import {fakeAsync, flushMicrotasks, Log, tick} from '@angular/core/testing';
import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing';
import {isBlank} from '../../src/facade/lang';
import {Type, ViewContainerRef, TemplateRef, ElementRef, ChangeDetectorRef, ChangeDetectionStrategy, Directive, Component, DebugElement, forwardRef, Input, PipeTransform, Attribute, ViewMetadata, provide, Optional, Inject, Self, InjectMetadata, Pipe, Host, SkipSelfMetadata} from '@angular/core';
@ -59,8 +59,6 @@ class SimpleDirective {
class SimpleComponent {
}
class SimpleService {}
@Directive({selector: '[someOtherDirective]'})
class SomeOtherDirective {
}
@ -398,7 +396,7 @@ export function main() {
'<div simpleComponent needsService></div>',
tcb.overrideViewProviders(
SimpleComponent, [{provide: 'service', useValue: 'service'}])))
.toThrowError(containsRegexp(`No provider for service!`));
.toThrowError(/No provider for service!/);
}));
it('should instantiate directives that depend on providers of other directives',
@ -510,7 +508,7 @@ export function main() {
it('should throw when a dependency cannot be resolved', fakeAsync(() => {
expect(() => createComp('<div needsService></div>', tcb))
.toThrowError(containsRegexp(`No provider for service!`));
.toThrowError(/No provider for service!/);
}));
it('should inject null when an optional dependency cannot be resolved', fakeAsync(() => {
@ -624,7 +622,7 @@ export function main() {
it('should throw if there is no TemplateRef', fakeAsync(() => {
expect(() => createComp('<div needsTemplateRef></div>', tcb))
.toThrowError(containsRegexp(`No provider for TemplateRef!`));
.toThrowError(/No provider for TemplateRef!/);
}));
it('should inject null if there is no TemplateRef when the dependency is optional',