diff --git a/modules/@angular/compiler/test/animation/animation_compiler_spec.ts b/modules/@angular/compiler/test/animation/animation_compiler_spec.ts index 2c1be5f224..8801a9699c 100644 --- a/modules/@angular/compiler/test/animation/animation_compiler_spec.ts +++ b/modules/@angular/compiler/test/animation/animation_compiler_spec.ts @@ -44,10 +44,10 @@ export function main() { } expect(capturedErrorMessage) - .toMatchPattern(/Unable to apply styles due to missing a state: "missing_state"/g); + .toMatch(/Unable to apply styles due to missing a state: "missing_state"/g); expect(capturedErrorMessage) - .toMatchPattern(/Animation states via styles must be prefixed with a ":"/); + .toMatch(/Animation states via styles must be prefixed with a ":"/); }); }); } diff --git a/modules/@angular/compiler/test/animation/animation_parser_spec.ts b/modules/@angular/compiler/test/animation/animation_parser_spec.ts index 91312e6a8a..679a6022ab 100644 --- a/modules/@angular/compiler/test/animation/animation_parser_spec.ts +++ b/modules/@angular/compiler/test/animation/animation_parser_spec.ts @@ -221,8 +221,8 @@ export function main() { expect(step.keyframes.length).toEqual(4); expect(step.keyframes[0].offset).toEqual(0); - expect(step.keyframes[1].offset).toMatchPattern(/^0\.33/); - expect(step.keyframes[2].offset).toMatchPattern(/^0\.66/); + expect(step.keyframes[1].offset).toMatch(/^0\.33/); + expect(step.keyframes[2].offset).toMatch(/^0\.66/); expect(step.keyframes[3].offset).toEqual(1); }); @@ -275,7 +275,7 @@ export function main() { expect(errors.length).toEqual(1); var error = errors[0]; - expect(error.msg).toMatchPattern(/Not all style\(\) entries contain an offset/); + expect(error.msg).toMatch(/Not all style\(\) entries contain an offset/); }); it('should use an existing style used earlier in the animation sequence if not defined in the first keyframe', diff --git a/modules/@angular/compiler/test/css_lexer_spec.ts b/modules/@angular/compiler/test/css_lexer_spec.ts index 0d2aa63295..3ededee952 100644 --- a/modules/@angular/compiler/test/css_lexer_spec.ts +++ b/modules/@angular/compiler/test/css_lexer_spec.ts @@ -274,8 +274,7 @@ export function main() { capturedMessage = e.rawMessage; } - expect(capturedMessage) - .toMatchPattern(/Unexpected character \[\>\] at column 0:7 in expression/g); + expect(capturedMessage).toMatch(/Unexpected character \[\>\] at column 0:7 in expression/g); capturedMessage = null; try { diff --git a/modules/@angular/compiler/test/css_parser_spec.ts b/modules/@angular/compiler/test/css_parser_spec.ts index 30a8bc293e..1f80b8d867 100644 --- a/modules/@angular/compiler/test/css_parser_spec.ts +++ b/modules/@angular/compiler/test/css_parser_spec.ts @@ -417,11 +417,11 @@ export function main() { expect(errors.length).toEqual(3); - expect(errors[0].msg).toMatchPattern(/Unexpected character \[\[\] at column 0:7/g); + expect(errors[0].msg).toMatch(/Unexpected character \[\[\] at column 0:7/g); - expect(errors[1].msg).toMatchPattern(/Unexpected character \[%\] at column 0:12/g); + expect(errors[1].msg).toMatch(/Unexpected character \[%\] at column 0:12/g); - expect(errors[2].msg).toMatchPattern(/Unexpected character \[}\] at column 0:19/g); + expect(errors[2].msg).toMatch(/Unexpected character \[}\] at column 0:19/g); }); it('should throw an error if an attribute selector is not closed properly', () => { @@ -429,7 +429,7 @@ export function main() { var output = parse(styles); var errors = output.errors; - expect(errors[0].msg).toMatchPattern(/Unbalanced CSS attribute selector at column 0:12/g); + expect(errors[0].msg).toMatch(/Unbalanced CSS attribute selector at column 0:12/g); }); it('should throw an error if a pseudo function selector is not closed properly', () => { @@ -438,8 +438,7 @@ export function main() { var errors = output.errors; expect(errors[0].msg) - .toMatchPattern( - /Character does not match expected Character value \("{" should match "\)"\)/); + .toMatch(/Character does not match expected Character value \("{" should match "\)"\)/); }); it('should raise an error when a semi colon is missing from a CSS style/pair that isn\'t the last entry', @@ -455,8 +454,7 @@ export function main() { expect(errors.length).toEqual(1); expect(errors[0].msg) - .toMatchPattern( - /The CSS key\/value definition did not end with a semicolon at column 1:15/g); + .toMatch(/The CSS key\/value definition did not end with a semicolon at column 1:15/g); }); it('should parse the inner value of a :not() pseudo-selector as a CSS selector', () => { @@ -520,18 +518,17 @@ export function main() { expect(errors.length).toEqual(4); expect(errors[0].msg) - .toMatchPattern( + .toMatch( /Identifier does not match expected Character value \("color" should match ":"\) at column 1:19/g); expect(errors[1].msg) - .toMatchPattern( - /The CSS key\/value definition did not end with a semicolon at column 2:15/g); + .toMatch(/The CSS key\/value definition did not end with a semicolon at column 2:15/g); expect(errors[2].msg) - .toMatchPattern(/The CSS property was not paired with a style value at column 3:8/g); + .toMatch(/The CSS property was not paired with a style value at column 3:8/g); expect(errors[3].msg) - .toMatchPattern(/The CSS property was not paired with a style value at column 4:8/g); + .toMatch(/The CSS property was not paired with a style value at column 4:8/g); }); it('should recover from CSS key/value parse errors', () => { diff --git a/modules/@angular/core/test/testing_internal_spec.ts b/modules/@angular/core/test/testing_internal_spec.ts index bd0beb0122..ef713ff84b 100644 --- a/modules/@angular/core/test/testing_internal_spec.ts +++ b/modules/@angular/core/test/testing_internal_spec.ts @@ -27,14 +27,6 @@ export function main() { }); }); - describe('toMatchPAttern', () => { - it('should assert that a string matches a given pattern', () => { - expect('matias').toMatchPattern(/ias$/g); - expect('tobias').toMatchPattern(/ias$/g); - expect('joonas').not.toMatchPattern(/ias$/g); - }); - }); - describe('toEqual for Maps', () => { it('should detect equality for same reference', () => { var m1 = MapWrapper.createFromStringMap({'a': 1}); diff --git a/modules/@angular/platform-browser/testing/matchers.ts b/modules/@angular/platform-browser/testing/matchers.ts index ab4f680002..97abbfb9b0 100644 --- a/modules/@angular/platform-browser/testing/matchers.ts +++ b/modules/@angular/platform-browser/testing/matchers.ts @@ -253,21 +253,6 @@ _global.beforeEach(function() { }; }, - toMatchPattern() { - return {compare: buildError(false), negativeCompare: buildError(true)}; - - function buildError(isNot: any /** TODO #???? */) { - return function(actual: any /** TODO #???? */, regex: any /** TODO #???? */) { - return { - pass: regex.test(actual) == !isNot, - get message() { - return `Expected ${actual} ${isNot ? 'not ' : ''}to match ${regex.toString()}`; - } - }; - }; - } - }, - toImplement: function() { return { compare: function(