style(*): fix no-useless-escape eslint errors
This commit is contained in:
@@ -63,7 +63,7 @@ angular.module('DocsController', ['currentVersionData'])
|
||||
$scope.loading = 0;
|
||||
|
||||
|
||||
var INDEX_PATH = /^(\/|\/index[^\.]*.html)$/;
|
||||
var INDEX_PATH = /^(\/|\/index[^.]*.html)$/;
|
||||
if (!$location.path() || INDEX_PATH.test($location.path())) {
|
||||
$location.path('/api').replace();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
angular.module('errors', ['ngSanitize'])
|
||||
|
||||
.filter('errorLink', ['$sanitize', function($sanitize) {
|
||||
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s\.;,\(\)\{\}<>]/g,
|
||||
var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/g,
|
||||
MAILTO_REGEXP = /^mailto:/,
|
||||
STACK_TRACE_REGEXP = /:\d+:\d+$/;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ angular.module('search', [])
|
||||
|
||||
.controller('Error404SearchCtrl', ['$scope', '$location', 'docsSearch',
|
||||
function($scope, $location, docsSearch) {
|
||||
docsSearch($location.path().split(/[\/\.:]/).pop()).then(function(results) {
|
||||
docsSearch($location.path().split(/[/.:]/).pop()).then(function(results) {
|
||||
$scope.results = {};
|
||||
angular.forEach(results, function(result) {
|
||||
var area = $scope.results[result.area] || [];
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
|
||||
var areasToSearch;
|
||||
|
||||
// Keywords start with "ng:" or one of $, _ or a letter
|
||||
var KEYWORD_REGEX = /^((ng:|[\$_a-z])[\w\-_]+)/;
|
||||
var KEYWORD_REGEX = /^((ng:|[$_a-z])[\w\-_]+)/;
|
||||
|
||||
// Load up the keywords to ignore, if specified in the config
|
||||
if (this.ignoreWordsFile) {
|
||||
@@ -67,7 +67,7 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
|
||||
|
||||
function extractWords(text, words, keywordMap) {
|
||||
|
||||
var tokens = text.toLowerCase().split(/[\.\s,`'"#]+/mg);
|
||||
var tokens = text.toLowerCase().split(/[.\s,`'"#]+/mg);
|
||||
_.forEach(tokens, function(token) {
|
||||
var match = token.match(KEYWORD_REGEX);
|
||||
if (match) {
|
||||
|
||||
@@ -363,7 +363,7 @@ In the following example we create two directives:
|
||||
<file name="script.js">
|
||||
var app = angular.module('form-example1', []);
|
||||
|
||||
var INTEGER_REGEXP = /^\-?\d+$/;
|
||||
var INTEGER_REGEXP = /^-?\d+$/;
|
||||
app.directive('integer', function() {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Script to initialize angular repo
|
||||
# - install required node packages
|
||||
# - install Karma
|
||||
# - install git hooks
|
||||
|
||||
|
||||
node=`which node 2>&1`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Please install NodeJS."
|
||||
echo "http://nodejs.org/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
npm=`which npm 2>&1`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Please install NPM."
|
||||
fi
|
||||
|
||||
|
||||
echo "Installing required npm packages..."
|
||||
npm install
|
||||
|
||||
karma=`which karma 2>&1`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Installing Karma..."
|
||||
npm install -g karma
|
||||
fi
|
||||
|
||||
echo "Installing git hooks..."
|
||||
ln -sf ../../validate-commit-msg.js .git/hooks/commit-msg
|
||||
+1
-1
@@ -178,7 +178,7 @@ module.exports = {
|
||||
var classPathSep = (process.platform === 'win32') ? ';' : ':';
|
||||
var minFile = file.replace(/\.js$/, '.min.js');
|
||||
var mapFile = minFile + '.map';
|
||||
var mapFileName = mapFile.match(/[^\/]+$/)[0];
|
||||
var mapFileName = mapFile.match(/[^/]+$/)[0];
|
||||
var errorFileName = file.replace(/\.js$/, '-errors.json');
|
||||
var versionNumber = grunt.config('NG_VERSION').full;
|
||||
var compilationLevel = (file === 'build/angular-message-format.js') ?
|
||||
|
||||
@@ -35,7 +35,7 @@ var getPackage = function() {
|
||||
* @return {Object} An object containing the github owner and repository name
|
||||
*/
|
||||
var getGitRepoInfo = function() {
|
||||
var GITURL_REGEX = /^https:\/\/github.com\/([^\/]+)\/(.+).git$/;
|
||||
var GITURL_REGEX = /^https:\/\/github.com\/([^/]+)\/(.+).git$/;
|
||||
var match = GITURL_REGEX.exec(currentPackage.repository.url);
|
||||
var git = {
|
||||
owner: match[1],
|
||||
|
||||
@@ -144,7 +144,7 @@ then(allInSeries(function(branch) {
|
||||
line = line.split(' ');
|
||||
var sha = line.shift();
|
||||
var msg = line.join(' ');
|
||||
return sha + ((/fix\([^\)]+\):/i.test(msg)) ? ' * ' : ' ') + msg;
|
||||
return sha + ((/fix\([^)]+\):/i.test(msg)) ? ' * ' : ' ') + msg;
|
||||
});
|
||||
branch.log = log.map(function(line) {
|
||||
return line.substr(41);
|
||||
@@ -16,7 +16,7 @@ var util = require('util');
|
||||
|
||||
|
||||
var MAX_LENGTH = 100;
|
||||
var PATTERN = /^(?:fixup!\s*)?(\w*)(\(([\w\$\.\*/-]*)\))?: (.*)$/;
|
||||
var PATTERN = /^(?:fixup!\s*)?(\w*)(\(([\w$.*/-]*)\))?: (.*)$/;
|
||||
var IGNORED = /^WIP:/;
|
||||
var TYPES = {
|
||||
feat: true,
|
||||
+4
-4
@@ -710,7 +710,7 @@ function isPromiseLike(obj) {
|
||||
}
|
||||
|
||||
|
||||
var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
|
||||
var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/;
|
||||
function isTypedArray(value) {
|
||||
return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
|
||||
}
|
||||
@@ -729,7 +729,7 @@ var trim = function(value) {
|
||||
// Prereq: s is a string.
|
||||
var escapeForRegexp = function(s) {
|
||||
return s
|
||||
.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1')
|
||||
.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, '\\$1')
|
||||
// eslint-disable-next-line no-control-regex
|
||||
.replace(/\x08/g, '\\x08');
|
||||
};
|
||||
@@ -973,7 +973,7 @@ function copy(source, destination) {
|
||||
return new source.constructor(source.valueOf());
|
||||
|
||||
case '[object RegExp]':
|
||||
var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
|
||||
var re = new RegExp(source.source, source.toString().match(/[^/]*$/)[0]);
|
||||
re.lastIndex = source.lastIndex;
|
||||
return re;
|
||||
|
||||
@@ -1350,7 +1350,7 @@ function startingTag(element) {
|
||||
return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
|
||||
elemHtml.
|
||||
match(/^(<[^>]+>)/)[1].
|
||||
replace(/^<([\w\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
|
||||
replace(/^<([\w-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
|
||||
} catch (e) {
|
||||
return lowercase(elemHtml);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
* Implicit module which gets automatically added to each {@link auto.$injector $injector}.
|
||||
*/
|
||||
|
||||
var ARROW_ARG = /^([^\(]+?)=>/;
|
||||
var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
|
||||
var ARROW_ARG = /^([^(]+?)=>/;
|
||||
var FN_ARGS = /^[^(]*\(\s*([^)]*)\)/m;
|
||||
var FN_ARG_SPLIT = /,/;
|
||||
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
|
||||
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
|
||||
|
||||
+1
-1
@@ -302,7 +302,7 @@ function Browser(window, document, $log, $sniffer) {
|
||||
*/
|
||||
self.baseHref = function() {
|
||||
var href = baseElement.attr('href');
|
||||
return href ? href.replace(/^(https?:)?\/\/[^\/]*/, '') : '';
|
||||
return href ? href.replace(/^(https?:)?\/\/[^/]*/, '') : '';
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -971,8 +971,8 @@ $CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
|
||||
function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
var hasDirectives = {},
|
||||
Suffix = 'Directive',
|
||||
COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w\-]+)\s+(.*)$/,
|
||||
CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?::([^;]+))?;?)/,
|
||||
COMMENT_DIRECTIVE_REGEXP = /^\s*directive:\s*([\w-]+)\s+(.*)$/,
|
||||
CLASS_DIRECTIVE_REGEXP = /(([\w-]+)(?::([^;]+))?;?)/,
|
||||
ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
|
||||
REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
|
||||
|
||||
|
||||
@@ -21,11 +21,11 @@ var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-
|
||||
// 7. Path
|
||||
// 8. Query
|
||||
// 9. Fragment
|
||||
// 1111111111111111 222 333333 44444 555555555555555555555555 666 77777777 8888888 999
|
||||
var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
|
||||
// 1111111111111111 222 333333 44444 55555555555555555555555 666 77777777 8888888 999
|
||||
var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
|
||||
// eslint-disable-next-line max-len
|
||||
var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
|
||||
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
|
||||
var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
|
||||
var NUMBER_REGEXP = /^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
|
||||
var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/;
|
||||
var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
|
||||
var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/;
|
||||
|
||||
@@ -232,8 +232,8 @@ var ngOptionsMinErr = minErr('ngOptions');
|
||||
*/
|
||||
|
||||
/* eslint-disable max-len */
|
||||
// //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999
|
||||
var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
|
||||
// //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555000000000666666666666600000007777777777777000000000000000888888888800000000000000000009999999999
|
||||
var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
|
||||
// 1: value expression (valueFn)
|
||||
// 2: label expression (displayFn)
|
||||
// 3: group by expression (groupByFn)
|
||||
|
||||
@@ -384,7 +384,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
|
||||
var aliasAs = match[3];
|
||||
var trackByExp = match[4];
|
||||
|
||||
match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
|
||||
match = lhs.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/);
|
||||
|
||||
if (!match) {
|
||||
throw ngRepeatMinErr('iidexp', '\'_item_\' in \'_item_ in _collection_\' should be an identifier or \'(_key_, _value_)\' expression, but got \'{0}\'.',
|
||||
|
||||
@@ -476,7 +476,7 @@ var DATE_FORMATS = {
|
||||
};
|
||||
|
||||
var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
|
||||
NUMBER_STRING = /^\-?\d+$/;
|
||||
NUMBER_STRING = /^-?\d+$/;
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
@@ -563,7 +563,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+
|
||||
expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
|
||||
toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
|
||||
expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
|
||||
toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
|
||||
toMatch(/2010-10-2\d \d{2}:\d{2}:\d{2} (-|\+)?\d{4}/);
|
||||
expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
|
||||
toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
|
||||
expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ var JSON_ENDS = {
|
||||
'[': /]$/,
|
||||
'{': /}$/
|
||||
};
|
||||
var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
|
||||
var JSON_PROTECTION_PREFIX = /^\)]\}',?\n/;
|
||||
var $httpMinErr = minErr('$http');
|
||||
|
||||
function serializeValue(v) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
|
||||
var PATH_MATCH = /^([^?#]*)(\?([^#]*))?(#(.*))?$/,
|
||||
DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
|
||||
var $locationMinErr = minErr('$location');
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1588,7 +1588,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
||||
|
||||
url = url
|
||||
.replace(/([().])/g, '\\$1')
|
||||
.replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
|
||||
.replace(/(\/)?:(\w+)([?*])?/g, function(_, slash, key, option) {
|
||||
var optional = option === '?' ? option : null;
|
||||
var star = option === '*' ? option : null;
|
||||
keys.push({ name: key, optional: !!optional });
|
||||
@@ -1602,7 +1602,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
||||
+ ')'
|
||||
+ (optional || '');
|
||||
})
|
||||
.replace(/([\/$\*])/g, '\\$1');
|
||||
.replace(/([/$*])/g, '\\$1');
|
||||
|
||||
ret.regexp = new RegExp('^' + url, 'i');
|
||||
return ret;
|
||||
|
||||
@@ -430,7 +430,7 @@ function shallowClearAndCopy(src, dst) {
|
||||
*/
|
||||
angular.module('ngResource', ['ng']).
|
||||
provider('$resource', function ResourceProvider() {
|
||||
var PROTOCOL_AND_DOMAIN_REGEX = /^https?:\/\/[^\/]*/;
|
||||
var PROTOCOL_AND_DOMAIN_REGEX = /^https?:\/\/[^/]*/;
|
||||
|
||||
var provider = this;
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ function $RouteProvider() {
|
||||
|
||||
path = path
|
||||
.replace(/([().])/g, '\\$1')
|
||||
.replace(/(\/)?:(\w+)(\*\?|[\?\*])?/g, function(_, slash, key, option) {
|
||||
.replace(/(\/)?:(\w+)(\*\?|[?*])?/g, function(_, slash, key, option) {
|
||||
var optional = (option === '?' || option === '*?') ? '?' : null;
|
||||
var star = (option === '*' || option === '*?') ? '*' : null;
|
||||
keys.push({ name: key, optional: !!optional });
|
||||
@@ -275,7 +275,7 @@ function $RouteProvider() {
|
||||
+ ')'
|
||||
+ (optional || '');
|
||||
})
|
||||
.replace(/([\/$\*])/g, '\\$1');
|
||||
.replace(/([/$*])/g, '\\$1');
|
||||
|
||||
ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
|
||||
return ret;
|
||||
|
||||
@@ -418,7 +418,7 @@ describe('injector', function() {
|
||||
expect(function() {
|
||||
createInjector(['IDontExist'], {});
|
||||
}).toThrowMinErr('$injector', 'modulerr',
|
||||
/\[\$injector:nomod\] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it/);
|
||||
/\[\$injector:nomod] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it/);
|
||||
});
|
||||
|
||||
|
||||
@@ -782,7 +782,7 @@ describe('injector', function() {
|
||||
createInjector([
|
||||
{}
|
||||
], {});
|
||||
}).toThrowMinErr('$injector', 'modulerr', /Failed to instantiate module \{\} due to:\n.*\[ng:areq\] Argument 'module' is not a function, got Object/);
|
||||
}).toThrowMinErr('$injector', 'modulerr', /Failed to instantiate module \{\} due to:\n.*\[ng:areq] Argument 'module' is not a function, got Object/);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ beforeEach(function() {
|
||||
// This function escapes all special regex characters.
|
||||
// We use it to create matching regex from arbitrary strings.
|
||||
// http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
|
||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
||||
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
|
||||
}
|
||||
|
||||
function test(exception) {
|
||||
|
||||
@@ -184,7 +184,7 @@ function sortedHtml(element, showNgClass) {
|
||||
}
|
||||
|
||||
var attr = attributes[i];
|
||||
if (attr.name.match(/^ng[:\-]/) ||
|
||||
if (attr.name.match(/^ng[:-]/) ||
|
||||
(attr.value || attr.value === '') &&
|
||||
attr.value !== 'null' &&
|
||||
attr.value !== 'auto' &&
|
||||
@@ -241,7 +241,7 @@ function sortedHtml(element, showNgClass) {
|
||||
var tmp = style;
|
||||
style = [];
|
||||
forEach(tmp, function(value) {
|
||||
if (!value.match(/^max[^\-]/)) {
|
||||
if (!value.match(/^max[^-]/)) {
|
||||
style.push(value);
|
||||
}
|
||||
});
|
||||
|
||||
+6
-6
@@ -34,7 +34,7 @@ describe('minErr', function() {
|
||||
|
||||
it('should interpolate string arguments without quotes', function() {
|
||||
var myError = testError('1', 'This {0} is "{1}"', 'foo', 'bar');
|
||||
expect(myError.message).toMatch(/^\[test:1\] This foo is "bar"/);
|
||||
expect(myError.message).toMatch(/^\[test:1] This foo is "bar"/);
|
||||
});
|
||||
|
||||
it('should interpolate non-string arguments', function() {
|
||||
@@ -57,7 +57,7 @@ describe('minErr', function() {
|
||||
var myError = testError('26', 'false: {0}; zero: {1}; null: {2}; undefined: {3}; emptyStr: {4}',
|
||||
false, 0, null, undefined, '');
|
||||
expect(myError.message).
|
||||
toMatch(/^\[test:26\] false: false; zero: 0; null: null; undefined: undefined; emptyStr: /);
|
||||
toMatch(/^\[test:26] false: false; zero: 0; null: null; undefined: undefined; emptyStr: /);
|
||||
});
|
||||
|
||||
it('should handle arguments that are objects with cyclic references', function() {
|
||||
@@ -74,20 +74,20 @@ describe('minErr', function() {
|
||||
var foo = 'Fooooo',
|
||||
myError = testError('26', 'This {0} is {1} on {2}', foo);
|
||||
|
||||
expect(myError.message).toMatch(/^\[test:26\] This Fooooo is \{1\} on \{2\}/);
|
||||
expect(myError.message).toMatch(/^\[test:26] This Fooooo is \{1\} on \{2\}/);
|
||||
});
|
||||
|
||||
|
||||
it('should pass through the message if no interpolation is needed', function() {
|
||||
var myError = testError('26', 'Something horrible happened!');
|
||||
expect(myError.message).toMatch(/^\[test:26\] Something horrible happened!/);
|
||||
expect(myError.message).toMatch(/^\[test:26] Something horrible happened!/);
|
||||
});
|
||||
|
||||
it('should include a namespace in the message only if it is namespaced', function() {
|
||||
var myError = emptyTestError('26', 'This is a {0}', 'Foo');
|
||||
var myNamespacedError = testError('26', 'That is a {0}', 'Bar');
|
||||
expect(myError.message).toMatch(/^\[26\] This is a Foo/);
|
||||
expect(myNamespacedError.message).toMatch(/^\[test:26\] That is a Bar/);
|
||||
expect(myError.message).toMatch(/^\[26] This is a Foo/);
|
||||
expect(myNamespacedError.message).toMatch(/^\[test:26] That is a Bar/);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -8305,7 +8305,7 @@ describe('$compile', function() {
|
||||
inject(function($compile) {
|
||||
expect(function() {
|
||||
$compile('<div first="" second=""></div>');
|
||||
}).toThrowMinErr('$compile', 'multidir', /Multiple directives \[first, second\] asking for transclusion on: <div .+/);
|
||||
}).toThrowMinErr('$compile', 'multidir', /Multiple directives \[first, second] asking for transclusion on: <div .+/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9721,7 +9721,7 @@ describe('$compile', function() {
|
||||
inject(function($compile) {
|
||||
expect(function() {
|
||||
$compile('<div first second></div>');
|
||||
}).toThrowMinErr('$compile', 'multidir', /Multiple directives \[first, second\] asking for transclusion on: <div .+/);
|
||||
}).toThrowMinErr('$compile', 'multidir', /Multiple directives \[first, second] asking for transclusion on: <div .+/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9768,7 +9768,7 @@ describe('$compile', function() {
|
||||
inject(function($compile) {
|
||||
expect(function() {
|
||||
$compile('<div template first></div>');
|
||||
}).toThrowMinErr('$compile', 'multidir', /Multiple directives \[first, second\] asking for transclusion on: <p .+/);
|
||||
}).toThrowMinErr('$compile', 'multidir', /Multiple directives \[first, second] asking for transclusion on: <p .+/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11171,7 +11171,7 @@ describe('$compile', function() {
|
||||
$rootScope.html = '<div onclick="">hello</div>';
|
||||
expect(function() { $rootScope.$digest(); }).toThrowMinErr('$interpolate', 'interr', new RegExp(
|
||||
/Can't interpolate: {{html}}\n/.source +
|
||||
/[^[]*\[\$sce:unsafe\] Attempting to use an unsafe value in a safe context./.source));
|
||||
/[^[]*\[\$sce:unsafe] Attempting to use an unsafe value in a safe context./.source));
|
||||
}));
|
||||
|
||||
it('should NOT set html for wrongly typed values', inject(function($rootScope, $compile, $sce) {
|
||||
@@ -11179,7 +11179,7 @@ describe('$compile', function() {
|
||||
$rootScope.html = $sce.trustAsCss('<div onclick="">hello</div>');
|
||||
expect(function() { $rootScope.$digest(); }).toThrowMinErr('$interpolate', 'interr', new RegExp(
|
||||
/Can't interpolate: \{\{html}}\n/.source +
|
||||
/[^[]*\[\$sce:unsafe\] Attempting to use an unsafe value in a safe context./.source));
|
||||
/[^[]*\[\$sce:unsafe] Attempting to use an unsafe value in a safe context./.source));
|
||||
}));
|
||||
|
||||
it('should set html for trusted values', inject(function($rootScope, $compile, $sce) {
|
||||
|
||||
@@ -285,7 +285,7 @@ describe('ngHref', function() {
|
||||
}));
|
||||
|
||||
// Support: IE 9-11 only, Edge 12-14+
|
||||
if (msie || /\bEdge\/[\d\.]+\b/.test(window.navigator.userAgent)) {
|
||||
if (msie || /\bEdge\/[\d.]+\b/.test(window.navigator.userAgent)) {
|
||||
// IE/Edge fail when setting a href to a URL containing a % that isn't a valid escape sequence
|
||||
// See https://github.com/angular/angular.js/issues/13388
|
||||
it('should throw error if ng-href contains a non-escaped percent symbol', inject(function($rootScope, $compile) {
|
||||
|
||||
@@ -1341,7 +1341,7 @@ describe('ngModel', function() {
|
||||
|
||||
|
||||
describe('CSS classes', function() {
|
||||
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
|
||||
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
|
||||
|
||||
it('should set ng-empty or ng-not-empty when the view value changes',
|
||||
inject(function($compile, $rootScope, $sniffer) {
|
||||
|
||||
@@ -332,7 +332,7 @@ describe('$httpBackend', function() {
|
||||
|
||||
describe('JSONP', function() {
|
||||
|
||||
var SCRIPT_URL = /([^\?]*)\?cb=(.*)/;
|
||||
var SCRIPT_URL = /([^?]*)\?cb=(.*)/;
|
||||
|
||||
|
||||
it('should add script tag for JSONP request', function() {
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('$location', function() {
|
||||
// Support: non-Windows browsers
|
||||
// These tests expect a Windows environment which we can only guarantee
|
||||
// on IE & Edge.
|
||||
if (msie || /\bEdge\/[\d\.]+\b/.test(window.navigator.userAgent)) return;
|
||||
if (msie || /\bEdge\/[\d.]+\b/.test(window.navigator.userAgent)) return;
|
||||
|
||||
urlParsingNodePlaceholder = urlParsingNode;
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('$location', function() {
|
||||
|
||||
afterEach(function() {
|
||||
// Support: non-Windows browsers
|
||||
if (msie || /\bEdge\/[\d\.]+\b/.test(window.navigator.userAgent)) return;
|
||||
if (msie || /\bEdge\/[\d.]+\b/.test(window.navigator.userAgent)) return;
|
||||
//reset urlParsingNode
|
||||
urlParsingNode = urlParsingNodePlaceholder;
|
||||
});
|
||||
|
||||
@@ -3405,7 +3405,7 @@ describe('parser', function() {
|
||||
forEach([true, false], function(cspEnabled) {
|
||||
describe('custom identifiers (csp: ' + cspEnabled + ')', function() {
|
||||
var isIdentifierStartRe = /[#a-z]/;
|
||||
var isIdentifierContinueRe = /[\-a-z]/;
|
||||
var isIdentifierContinueRe = /[-a-z]/;
|
||||
var isIdentifierStartFn;
|
||||
var isIdentifierContinueFn;
|
||||
var scope;
|
||||
|
||||
+2
-2
@@ -322,7 +322,7 @@ describe('SCE', function() {
|
||||
runTest({whiteList: [{}]}, null)();
|
||||
}).toThrowMinErr('$injector', 'modulerr', new RegExp(
|
||||
/Failed to instantiate module function ?\(\$sceDelegateProvider\) due to:\n/.source +
|
||||
/[^[]*\[\$sce:imatcher\] Matchers may only be "self", string patterns or RegExp objects/.source));
|
||||
/[^[]*\[\$sce:imatcher] Matchers may only be "self", string patterns or RegExp objects/.source));
|
||||
});
|
||||
|
||||
describe('adjustMatcher', function() {
|
||||
@@ -441,7 +441,7 @@ describe('SCE', function() {
|
||||
runTest({whiteList: ['http://***']}, null)();
|
||||
}).toThrowMinErr('$injector', 'modulerr', new RegExp(
|
||||
/Failed to instantiate module function ?\(\$sceDelegateProvider\) due to:\n/.source +
|
||||
/[^[]*\[\$sce:iwcard\] Illegal sequence \*\*\* in string matcher\. {2}String: http:\/\/\*\*\*/.source));
|
||||
/[^[]*\[\$sce:iwcard] Illegal sequence \*\*\* in string matcher\. {2}String: http:\/\/\*\*\*/.source));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user