aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/parseSpec.js
diff options
context:
space:
mode:
authorKen Sheedlo2013-08-13 15:30:52 -0700
committerKen Sheedlo2013-08-15 13:23:18 -0700
commit37123cd2858b4e318ed8109af745312df4848577 (patch)
tree118abe5fd50e1c6fef4281972cf52c0162482fa8 /test/ng/parseSpec.js
parentfe267e30b95e8f48ddc670b97d485f18fb64d39e (diff)
downloadangular.js-37123cd2858b4e318ed8109af745312df4848577.tar.bz2
feat(minerr): log minerr doc url in development
Closes #3566
Diffstat (limited to 'test/ng/parseSpec.js')
-rw-r--r--test/ng/parseSpec.js116
1 files changed, 58 insertions, 58 deletions
diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js
index 568a3b15..f9a80fb6 100644
--- a/test/ng/parseSpec.js
+++ b/test/ng/parseSpec.js
@@ -156,11 +156,11 @@ describe('parser', function() {
it('should throws exception for invalid exponent', function() {
expect(function() {
lex("0.5E-");
- }).toThrow(new Error('[$parse:lexerr] Lexer Error: Invalid exponent at column 4 in expression [0.5E-].'));
+ }).toThrowMinErr('$parse', 'lexerr', 'Lexer Error: Invalid exponent at column 4 in expression [0.5E-].');
expect(function() {
lex("0.5E-A");
- }).toThrow(new Error('[$parse:lexerr] Lexer Error: Invalid exponent at column 4 in expression [0.5E-A].'));
+ }).toThrowMinErr('$parse', 'lexerr', 'Lexer Error: Invalid exponent at column 4 in expression [0.5E-A].');
});
it('should tokenize number starting with a dot', function() {
@@ -171,7 +171,7 @@ describe('parser', function() {
it('should throw error on invalid unicode', function() {
expect(function() {
lex("'\\u1''bla'");
- }).toThrow(new Error("[$parse:lexerr] Lexer Error: Invalid unicode escape [\\u1''b] at column 2 in expression ['\\u1''bla']."));
+ }).toThrowMinErr("$parse", "lexerr", "Lexer Error: Invalid unicode escape [\\u1''b] at column 2 in expression ['\\u1''bla'].");
});
});
@@ -304,7 +304,7 @@ describe('parser', function() {
expect(function() {
scope.$eval("1|nonexistent");
- }).toThrow(new Error("[$injector:unpr] Unknown provider: nonexistentFilterProvider <- nonexistentFilter"));
+ }).toThrowMinErr('$injector', 'unpr', 'Unknown provider: nonexistentFilterProvider <- nonexistentFilter');
scope.offset = 3;
expect(scope.$eval("'abcd'|substring:1:offset")).toEqual("bc");
@@ -492,7 +492,7 @@ describe('parser', function() {
it('should throw exception on non-closed bracket', function() {
expect(function() {
scope.$eval('[].count(');
- }).toThrow('[$parse:ueoe] Unexpected end of expression: [].count(');
+ }).toThrowMinErr('$parse', 'ueoe', 'Unexpected end of expression: [].count(');
});
it('should evaluate double negation', function() {
@@ -558,86 +558,86 @@ describe('parser', function() {
it('should NOT allow access to Function constructor in getter', function() {
expect(function() {
scope.$eval('{}.toString.constructor');
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: {}.toString.constructor'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString.constructor');
expect(function() {
scope.$eval('{}.toString.constructor("alert(1)")');
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: {}.toString.constructor("alert(1)")'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString.constructor("alert(1)")');
expect(function() {
scope.$eval('[].toString.constructor.foo');
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: [].toString.constructor.foo'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: [].toString.constructor.foo');
expect(function() {
scope.$eval('{}.toString["constructor"]');
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: {}.toString["constructor"]'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString["constructor"]');
expect(function() {
scope.$eval('{}["toString"]["constructor"]');
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: {}["toString"]["constructor"]'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: {}["toString"]["constructor"]');
scope.a = [];
expect(function() {
scope.$eval('a.toString.constructor', scope);
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: a.toString.constructor'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: a.toString.constructor');
expect(function() {
scope.$eval('a.toString["constructor"]', scope);
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: a.toString["constructor"]'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: a.toString["constructor"]');
});
it('should NOT allow access to Function constructor in setter', function() {
expect(function() {
scope.$eval('{}.toString.constructor = 1');
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: {}.toString.constructor = 1'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString.constructor = 1');
expect(function() {
scope.$eval('{}.toString.constructor.a = 1');
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: {}.toString.constructor.a = 1'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString.constructor.a = 1');
expect(function() {
scope.$eval('{}.toString["constructor"]["constructor"] = 1');
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: {}.toString["constructor"]["constructor"] = 1'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString["constructor"]["constructor"] = 1');
scope.key1 = "const";
scope.key2 = "ructor";
expect(function() {
scope.$eval('{}.toString[key1 + key2].foo = 1');
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: {}.toString[key1 + key2].foo = 1'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString[key1 + key2].foo = 1');
expect(function() {
scope.$eval('{}.toString["constructor"]["a"] = 1');
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: {}.toString["constructor"]["a"] = 1'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: {}.toString["constructor"]["a"] = 1');
scope.a = [];
expect(function() {
scope.$eval('a.toString.constructor = 1', scope);
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: a.toString.constructor = 1'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: a.toString.constructor = 1');
});
@@ -645,9 +645,9 @@ describe('parser', function() {
scope.foo = { "bar": Function };
expect(function() {
scope.$eval('foo["bar"]');
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: foo["bar"]'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: foo["bar"]');
});
});
@@ -661,14 +661,14 @@ describe('parser', function() {
// index operator.
expect(function() {
scope.$eval('foo.constructor()', scope)
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: foo.constructor()'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: foo.constructor()');
expect(function() {
scope.$eval('foo["constructor"]()', scope)
- }).toThrow(new Error(
- '[$parse:isecfn] Referencing Function in Angular expressions is disallowed! ' +
- 'Expression: foo["constructor"]()'));
+ }).toThrowMinErr(
+ '$parse', 'isecfn', 'Referencing Function in Angular expressions is disallowed! ' +
+ 'Expression: foo["constructor"]()');
// User defined value assigned to constructor.
scope.foo.constructor = function constructor() {
@@ -677,9 +677,9 @@ describe('parser', function() {
// Dot operator should still block it.
expect(function() {
scope.$eval('foo.constructor()', scope)
- }).toThrow(new Error(
- '[$parse:isecfld] Referencing "constructor" field in Angular expressions is disallowed! ' +
- 'Expression: foo.constructor()'));
+ }).toThrowMinErr(
+ '$parse', 'isecfld', 'Referencing "constructor" field in Angular expressions is disallowed! ' +
+ 'Expression: foo.constructor()');
// However, the index operator should allow it.
expect(scope.$eval('foo["constructor"]()', scope)).toBe('custom constructor');
});
@@ -864,10 +864,10 @@ describe('parser', function() {
}));
- it('should evaluate a resolved primitive type promise and set its value', inject(function($parse) {
+ it('should evaluate a resolved primitive type promise and set its value', inject(function($parse) {
scope.greeting = promise;
deferred.resolve('Salut!');
-
+
var getter = $parse('greeting');
expect(getter(scope)).toBe(undefined);