chore(eslint): enable quotes: ["error", "single"]
The quotes rule had to be disabled for e2e tests generated from ngdoc because dgeni templates use double quotes as string delimiters. Since we can't have guarantees that dgeni template wrappers will follow the same JS code style the Angular 1 repo uses, we should find a way to enforce our ESLint setup only for the parts in this repo, perhaps via prepending a generated `/* eslint-enable OUR_RULES */` pragma. Closes #15011
This commit is contained in:
@@ -104,6 +104,7 @@
|
||||
"no-spaced-func": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"quotes": ["error", "single"],
|
||||
"semi-spacing": "error",
|
||||
"semi": "error",
|
||||
"space-before-blocks": ["error", "always"],
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@
|
||||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
|
||||
"object-curly-spacing": ["error", "never"],
|
||||
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
|
||||
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}],
|
||||
"quotes": ["error", "single"]
|
||||
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" }}]
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ module.exports = function(grunt) {
|
||||
dest: 'build/angular-parse-ext.js',
|
||||
src: util.wrap(files['angularModules']['ngParseExt'], 'module')
|
||||
},
|
||||
"promises-aplus-adapter": {
|
||||
'promises-aplus-adapter': {
|
||||
dest:'tmp/promises-aplus-adapter++.js',
|
||||
src:['src/ng/q.js', 'lib/promises-aplus/promises-aplus-test-adapter.js']
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -209,7 +209,7 @@ var angularFiles = {
|
||||
'build/docs/docs-scenario.js'
|
||||
],
|
||||
|
||||
"karmaModules": [
|
||||
'karmaModules': [
|
||||
'build/angular.js',
|
||||
'@angularSrcModules',
|
||||
'test/modules/no_bootstrap.js',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/* globals angular, benchmarkSteps */
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ module.exports = function(config) {
|
||||
config.set({
|
||||
scripts: [
|
||||
{
|
||||
"id": "jquery",
|
||||
"src": "jquery-noop.js"
|
||||
'id': 'jquery',
|
||||
'src': 'jquery-noop.js'
|
||||
}, {
|
||||
id: 'angular',
|
||||
src: '/build/angular.js'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
/* globals angular, benchmarkSteps */
|
||||
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ var writeChangelog = function(stream, commits, version) {
|
||||
if (commit.breaking) {
|
||||
sections.breaks[component] = sections.breaks[component] || [];
|
||||
sections.breaks[component].push({
|
||||
subject: util.format("due to %s,\n %s", linkToCommit(commit.hash), commit.breaking),
|
||||
subject: util.format('due to %s,\n %s', linkToCommit(commit.hash), commit.breaking),
|
||||
hash: commit.hash,
|
||||
closes: []
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
describe("doc.angularjs.org", function() {
|
||||
describe('doc.angularjs.org', function() {
|
||||
|
||||
describe("API pages", function() {
|
||||
describe('API pages', function() {
|
||||
|
||||
it("should display links to code on GitHub", function() {
|
||||
it('should display links to code on GitHub', function() {
|
||||
browser.get('build/docs/index.html#!/api/ng/service/$http');
|
||||
expect(element(by.css('.improve-docs')).getAttribute('href')).toMatch(/https?:\/\/github\.com\/angular\/angular\.js\/edit\/.+\/src\/ng\/http\.js/);
|
||||
|
||||
@@ -38,7 +38,7 @@ describe("doc.angularjs.org", function() {
|
||||
expect(code.getText()).toContain('guest!!!');
|
||||
});
|
||||
|
||||
it("should trim indentation from code blocks", function() {
|
||||
it('should trim indentation from code blocks', function() {
|
||||
browser.get('build/docs/index.html#!/api/ng/type/$rootScope.Scope');
|
||||
|
||||
var codeBlocks = element.all(by.css('pre > code.lang-js'));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
describe("provider pages", function() {
|
||||
describe('provider pages', function() {
|
||||
|
||||
it("should show the related service", function() {
|
||||
it('should show the related service', function() {
|
||||
browser.get('build/docs/index.html#!/api/ng/provider/$compileProvider');
|
||||
var serviceLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
|
||||
expect(serviceLink.getText()).toEqual('- $compile');
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
describe("service pages", function() {
|
||||
describe('service pages', function() {
|
||||
|
||||
it("should show the related provider if there is one", function() {
|
||||
it('should show the related provider if there is one', function() {
|
||||
browser.get('build/docs/index.html#!/api/ng/service/$compile');
|
||||
var providerLink = element.all(by.css('ol.api-profile-header-structure li a')).first();
|
||||
expect(providerLink.getText()).toEqual('- $compileProvider');
|
||||
@@ -14,7 +14,7 @@ describe("service pages", function() {
|
||||
expect(providerLink.getAttribute('href')).not.toMatch(/api\/ng\/provider\/\$compileProvider/);
|
||||
});
|
||||
|
||||
it("should show parameter defaults", function() {
|
||||
it('should show parameter defaults', function() {
|
||||
browser.get('build/docs/index.html#!/api/ng/service/$timeout');
|
||||
expect(element.all(by.css('.input-arguments p em')).first().getText()).toContain('(default: 0)');
|
||||
});
|
||||
|
||||
@@ -73,10 +73,10 @@ describe('docs.angularjs.org', function() {
|
||||
|
||||
it('should display formatted error messages on error doc pages', function() {
|
||||
browser.get('build/docs/index-production.html#!error/ng/areq?p0=Missing&p1=not%20a%20function,%20got%20undefined');
|
||||
expect(element(by.css('.minerr-errmsg')).getText()).toEqual("Argument 'Missing' is not a function, got undefined");
|
||||
expect(element(by.css('.minerr-errmsg')).getText()).toEqual('Argument \'Missing\' is not a function, got undefined');
|
||||
});
|
||||
|
||||
it("should display an error if the page does not exist", function() {
|
||||
it('should display an error if the page does not exist', function() {
|
||||
browser.get('build/docs/index-production.html#!/api/does/not/exist');
|
||||
expect(element(by.css('h1')).getText()).toBe('Oops!');
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ angular.module('DocsController', [])
|
||||
***********************************/
|
||||
|
||||
$scope.versionNumber = angular.version.full;
|
||||
$scope.version = angular.version.full + " " + angular.version.codeName;
|
||||
$scope.version = angular.version.full + ' ' + angular.version.codeName;
|
||||
$scope.loading = 0;
|
||||
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ angular.module('examples', [])
|
||||
var newWindow = clickEvent.ctrlKey || clickEvent.metaKey;
|
||||
|
||||
var postData = {
|
||||
'tags[0]': "angularjs",
|
||||
'tags[1]': "example",
|
||||
'tags[0]': 'angularjs',
|
||||
'tags[1]': 'example',
|
||||
'private': true
|
||||
};
|
||||
|
||||
@@ -183,8 +183,8 @@ angular.module('examples', [])
|
||||
|
||||
// The manifests provide the production index file but Plunkr wants
|
||||
// a straight index.html
|
||||
if (filename === "index-production.html") {
|
||||
filename = "index.html";
|
||||
if (filename === 'index-production.html') {
|
||||
filename = 'index.html';
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe("code", function() {
|
||||
describe('code', function() {
|
||||
var prettyPrintOne, oldPP;
|
||||
var compile, scope;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe("DocsController", function() {
|
||||
describe('DocsController', function() {
|
||||
var $scope;
|
||||
|
||||
angular.module('fake', [])
|
||||
@@ -17,7 +17,7 @@ describe("DocsController", function() {
|
||||
|
||||
|
||||
describe('afterPartialLoaded', function() {
|
||||
it("should update the Google Analytics with currentPage path if currentPage exists", inject(function($window) {
|
||||
it('should update the Google Analytics with currentPage path if currentPage exists', inject(function($window) {
|
||||
$window._gaq = [];
|
||||
$scope.currentPage = { path: 'a/b/c' };
|
||||
$scope.$broadcast('$includeContentLoaded');
|
||||
@@ -25,7 +25,7 @@ describe("DocsController", function() {
|
||||
}));
|
||||
|
||||
|
||||
it("should update the Google Analytics with $location.path if currentPage is missing", inject(function($window, $location) {
|
||||
it('should update the Google Analytics with $location.path if currentPage is missing', inject(function($window, $location) {
|
||||
$window._gaq = [];
|
||||
spyOn($location, 'path').and.returnValue('x/y/z');
|
||||
$scope.$broadcast('$includeContentLoaded');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var path = require('canonical-path');
|
||||
var packagePath = __dirname;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
var fs = require('fs');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
module.exports = function debugDeployment(getVersion) {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
module.exports = function defaultDeployment(getVersion) {
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
module.exports = function jqueryDeployment(getVersion) {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var versionInfo = require('../../../../lib/versions/version-info');
|
||||
var cdnUrl = "//ajax.googleapis.com/ajax/libs/angularjs/" + versionInfo.cdnVersion;
|
||||
var cdnUrl = '//ajax.googleapis.com/ajax/libs/angularjs/' + versionInfo.cdnVersion;
|
||||
|
||||
module.exports = function productionDeployment(getVersion) {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
var StringMap = require('stringmap');
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var path = require('canonical-path');
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use strict";
|
||||
'use strict';
|
||||
var path = require('canonical-path');
|
||||
|
||||
/**
|
||||
|
||||
@@ -409,9 +409,9 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
|
||||
.constant('baseHref', '/base/index.html')
|
||||
.value('$sniffer', { history: true })
|
||||
|
||||
.controller("LocationController", function($scope, $location) {
|
||||
.controller('LocationController', function($scope, $location) {
|
||||
$scope.$location = {};
|
||||
angular.forEach("protocol host port path search hash".split(" "), function(method) {
|
||||
angular.forEach('protocol host port path search hash'.split(' '), function(method) {
|
||||
$scope.$location[method] = function() {
|
||||
var result = $location[method]();
|
||||
return angular.isObject(result) ? angular.toJson(result) : result;
|
||||
@@ -461,7 +461,7 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
|
||||
return {
|
||||
template: 'Address: <input id="addressBar" type="text" style="width: 400px" >',
|
||||
link: function(scope, element, attrs) {
|
||||
var input = element.children("input"), delay;
|
||||
var input = element.children('input'), delay;
|
||||
|
||||
input.on('keypress keyup keydown', function(event) {
|
||||
delay = (!delay ? $timeout(fireUrlChange, 250) : null);
|
||||
@@ -563,9 +563,9 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
|
||||
$locationProvider.html5Mode(true).hashPrefix('!');
|
||||
})
|
||||
|
||||
.controller("LocationController", function($scope, $location) {
|
||||
.controller('LocationController', function($scope, $location) {
|
||||
$scope.$location = {};
|
||||
angular.forEach("protocol host port path search hash".split(" "), function(method) {
|
||||
angular.forEach('protocol host port path search hash'.split(' '), function(method) {
|
||||
$scope.$location[method] = function() {
|
||||
var result = $location[method]();
|
||||
return angular.isObject(result) ? angular.toJson(result) : result;
|
||||
@@ -615,7 +615,7 @@ In these examples we use `<base href="/base/index.html" />`. The inputs represen
|
||||
return {
|
||||
template: 'Address: <input id="addressBar" type="text" style="width: 400px" >',
|
||||
link: function(scope, element, attrs) {
|
||||
var input = element.children("input"), delay;
|
||||
var input = element.children('input'), delay;
|
||||
|
||||
input.on('keypress keyup keydown', function(event) {
|
||||
delay = (!delay ? $timeout(fireUrlChange, 250) : null);
|
||||
|
||||
@@ -121,7 +121,7 @@ different currencies and also pay the invoice.
|
||||
return amount * this.usdToForeignRates[outCurr] / this.usdToForeignRates[inCurr];
|
||||
};
|
||||
this.pay = function pay() {
|
||||
window.alert("Thanks!");
|
||||
window.alert('Thanks!');
|
||||
};
|
||||
});
|
||||
</file>
|
||||
@@ -221,7 +221,7 @@ Let's refactor our example and move the currency conversion into a service in an
|
||||
return currencyConverter.convert(this.qty * this.cost, this.inCurr, outCurr);
|
||||
};
|
||||
this.pay = function pay() {
|
||||
window.alert("Thanks!");
|
||||
window.alert('Thanks!');
|
||||
};
|
||||
}]);
|
||||
</file>
|
||||
@@ -313,7 +313,7 @@ The following example shows how this is done with Angular:
|
||||
return currencyConverter.convert(this.qty * this.cost, this.inCurr, outCurr);
|
||||
};
|
||||
this.pay = function pay() {
|
||||
window.alert("Thanks!");
|
||||
window.alert('Thanks!');
|
||||
};
|
||||
}]);
|
||||
</file>
|
||||
|
||||
@@ -186,7 +186,7 @@ previous example.
|
||||
var myApp = angular.module('spicyApp2', []);
|
||||
|
||||
myApp.controller('SpicyController', ['$scope', function($scope) {
|
||||
$scope.customSpice = "wasabi";
|
||||
$scope.customSpice = 'wasabi';
|
||||
$scope.spice = 'very';
|
||||
|
||||
$scope.spicy = function(spice) {
|
||||
|
||||
@@ -139,7 +139,7 @@ text upper-case.
|
||||
.filter('reverse', function() {
|
||||
return function(input, uppercase) {
|
||||
input = input || '';
|
||||
var out = "";
|
||||
var out = '';
|
||||
for (var i = 0; i < input.length; i++) {
|
||||
out = input.charAt(i) + out;
|
||||
}
|
||||
|
||||
@@ -226,11 +226,11 @@ You may find it helpful to play with the following example as you read the expla
|
||||
|
||||
angular.module('messageFormatExample', ['ngMessageFormat'])
|
||||
.controller('ckCtrl', function($scope, $injector, $parse) {
|
||||
var people = [new Person("Alice", "female"),
|
||||
new Person("Bob", "male"),
|
||||
new Person("Charlie", "male")];
|
||||
var people = [new Person('Alice', 'female'),
|
||||
new Person('Bob', 'male'),
|
||||
new Person('Charlie', 'male')];
|
||||
|
||||
$scope.sender = new Person("Harry Potter", "male");
|
||||
$scope.sender = new Person('Harry Potter', 'male');
|
||||
$scope.recipients = people.slice();
|
||||
|
||||
$scope.setNumRecipients = function(n) {
|
||||
|
||||
@@ -53,7 +53,7 @@ subsystem takes care of the rest.
|
||||
return function(msg) {
|
||||
msgs.push(msg);
|
||||
if (msgs.length === 3) {
|
||||
win.alert(msgs.join("\n"));
|
||||
win.alert(msgs.join('\n'));
|
||||
msgs = [];
|
||||
}
|
||||
};
|
||||
|
||||
+9
-1
@@ -39,8 +39,16 @@ var getMergedEslintConfig = function(filepath) {
|
||||
// While alerts would be bad to have in the library or test code,
|
||||
// they're perfectly fine in examples.
|
||||
'no-alert': 'off',
|
||||
|
||||
// The following rules have to be disabled or tweaked because dgeni template wrappers
|
||||
// don't follow them and we have no way to validate only the parts taken
|
||||
// from ngdoc.
|
||||
|
||||
// some dgeni-packages templates generate whitespace-only lines
|
||||
'no-trailing-spaces': ['error', { 'skipBlankLines': true }]
|
||||
'no-trailing-spaces': ['error', { 'skipBlankLines': true }],
|
||||
|
||||
// dgeni templates use double quotes as string delimiters
|
||||
quotes: 'off'
|
||||
},
|
||||
ignore: false,
|
||||
useEslintrc: false
|
||||
|
||||
@@ -89,7 +89,7 @@ function download(collection, name, url) {
|
||||
|
||||
// fix smart-quotes
|
||||
data = data.replace(/[“”]/g, '"');
|
||||
data = data.replace(/[‘’]/g, "'");
|
||||
data = data.replace(/[‘’]/g, '\'');
|
||||
|
||||
|
||||
data = data + '\n';
|
||||
@@ -135,7 +135,7 @@ function login(username, password) {
|
||||
});
|
||||
if (token) {
|
||||
fs.writeFileSync('tmp/gdocs.auth', token);
|
||||
console.log("logged in, token saved in 'tmp/gdocs.auth'");
|
||||
console.log('logged in, token saved in \'tmp/gdocs.auth\'');
|
||||
} else {
|
||||
console.log('failed to log in');
|
||||
}
|
||||
@@ -209,23 +209,23 @@ function encodeData(obj) {
|
||||
|
||||
function askPassword(callback) {
|
||||
var stdin = process.openStdin(),
|
||||
stdio = process.binding("stdio");
|
||||
stdio = process.binding('stdio');
|
||||
|
||||
stdio.setRawMode();
|
||||
|
||||
console.log('Enter your password:');
|
||||
var password = "";
|
||||
stdin.on("data", function(c) {
|
||||
c = c + "";
|
||||
var password = '';
|
||||
stdin.on('data', function(c) {
|
||||
c = c + '';
|
||||
switch (c) {
|
||||
case "\n":
|
||||
case "\r":
|
||||
case "\u0004":
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\u0004':
|
||||
stdio.setRawMode(false);
|
||||
stdin.pause();
|
||||
callback(password);
|
||||
break;
|
||||
case "\u0003":
|
||||
case '\u0003':
|
||||
process.exit();
|
||||
break;
|
||||
default:
|
||||
|
||||
+19
-19
@@ -1,53 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
describe("localized filters", function() {
|
||||
describe("es locale", function() {
|
||||
describe('localized filters', function() {
|
||||
describe('es locale', function() {
|
||||
beforeEach(function() {
|
||||
browser().navigateTo("localeTest_es.html");
|
||||
browser().navigateTo('localeTest_es.html');
|
||||
});
|
||||
|
||||
it('should check filters for es locale', function() {
|
||||
expect(binding('input | date:"medium"')).toBe('03/06/1977 18:07:23');
|
||||
expect(binding('input | date:"longDate"')).toBe("3 de junio de 1977");
|
||||
expect(binding('input | date:"longDate"')).toBe('3 de junio de 1977');
|
||||
expect(binding('input | number')).toBe('234.234.443.432');
|
||||
expect(binding('input | currency')).toBe('€\u00a0234.234.443.432,00');
|
||||
});
|
||||
});
|
||||
|
||||
describe("cs locale", function() {
|
||||
describe('cs locale', function() {
|
||||
beforeEach(function() {
|
||||
browser().navigateTo("localeTest_cs.html");
|
||||
browser().navigateTo('localeTest_cs.html');
|
||||
});
|
||||
|
||||
it('should check filters for cs locale', function() {
|
||||
expect(binding('input | date:"medium"')).toBe('3.6.1977 18:07:23');
|
||||
expect(binding('input | date:"longDate"')).toBe("3. června 1977");
|
||||
expect(binding('input | date:"longDate"')).toBe('3. června 1977');
|
||||
expect(binding('input | number')).toBe('234\u00a0234\u00a0443\u00a0432');
|
||||
expect(binding('input | currency')).toBe('234\u00a0234\u00a0443\u00a0432,00\u00a0K\u010d');
|
||||
});
|
||||
});
|
||||
|
||||
describe("de locale", function() {
|
||||
describe('de locale', function() {
|
||||
beforeEach(function() {
|
||||
browser().navigateTo("localeTest_de.html");
|
||||
browser().navigateTo('localeTest_de.html');
|
||||
});
|
||||
|
||||
it('should check filters for de locale', function() {
|
||||
expect(binding('input | date:"medium"')).toBe('03.06.1977 18:07:23');
|
||||
expect(binding('input | date:"longDate"')).toBe("3. Juni 1977");
|
||||
expect(binding('input | date:"longDate"')).toBe('3. Juni 1977');
|
||||
expect(binding('input | number')).toBe('234.234.443.432');
|
||||
expect(binding('input | currency')).toBe('234.234.443.432,00\u00a0€');
|
||||
});
|
||||
});
|
||||
|
||||
describe("en locale", function() {
|
||||
describe('en locale', function() {
|
||||
beforeEach(function() {
|
||||
browser().navigateTo("localeTest_en.html");
|
||||
browser().navigateTo('localeTest_en.html');
|
||||
});
|
||||
|
||||
it('should check filters for en locale', function() {
|
||||
expect(binding('input | date:"medium"')).toBe('Jun 3, 1977 6:07:23 PM');
|
||||
expect(binding('input | date:"longDate"')).toBe("June 3, 1977");
|
||||
expect(binding('input | date:"longDate"')).toBe('June 3, 1977');
|
||||
expect(binding('input | number')).toBe('234,234,443,432');
|
||||
expect(binding('input | currency')).toBe('$234,234,443,432.00');
|
||||
});
|
||||
@@ -95,14 +95,14 @@ describe("localized filters", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("sk locale", function() {
|
||||
describe('sk locale', function() {
|
||||
beforeEach(function() {
|
||||
browser().navigateTo("localeTest_sk.html");
|
||||
browser().navigateTo('localeTest_sk.html');
|
||||
});
|
||||
|
||||
it('should check filters for sk locale', function() {
|
||||
expect(binding('input | date:"medium"')).toBe('3.6.1977 18:07:23');
|
||||
expect(binding('input | date:"longDate"')).toBe("3. júna 1977");
|
||||
expect(binding('input | date:"longDate"')).toBe('3. júna 1977');
|
||||
expect(binding('input | number')).toBe('234\u00a0234\u00a0443\u00a0432');
|
||||
expect(binding('input | currency')).toBe('234\u00a0234\u00a0443\u00a0432,00\u00a0Sk');
|
||||
});
|
||||
@@ -134,14 +134,14 @@ describe("localized filters", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("zh locale", function() {
|
||||
describe('zh locale', function() {
|
||||
beforeEach(function() {
|
||||
browser().navigateTo("localeTest_zh.html");
|
||||
browser().navigateTo('localeTest_zh.html');
|
||||
});
|
||||
|
||||
it('should check filters for zh locale', function() {
|
||||
expect(binding('input | date:"medium"')).toBe('1977-6-3 下午6:07:23');
|
||||
expect(binding('input | date:"longDate"')).toBe("1977年6月3日");
|
||||
expect(binding('input | date:"longDate"')).toBe('1977年6月3日');
|
||||
expect(binding('input | number')).toBe('234,234,443,432');
|
||||
expect(binding('input | currency')).toBe('¥234,234,443,432.00');
|
||||
});
|
||||
|
||||
@@ -31,32 +31,32 @@ function newTestLocaleInfo() {
|
||||
shortTime: 'HH:mm'
|
||||
},
|
||||
NUMBER_FORMATS: {
|
||||
"DECIMAL_SEP": ".",
|
||||
"GROUP_SEP": ",",
|
||||
"PATTERNS": [{
|
||||
"minInt": 1,
|
||||
"minFrac": 0,
|
||||
"macFrac": 0,
|
||||
"posPre": "",
|
||||
"posSuf": "",
|
||||
"negPre": "-",
|
||||
"negSuf": "",
|
||||
"gSize": 3,
|
||||
"lgSize": 3,
|
||||
"maxFrac": 3
|
||||
'DECIMAL_SEP': '.',
|
||||
'GROUP_SEP': ',',
|
||||
'PATTERNS': [{
|
||||
'minInt': 1,
|
||||
'minFrac': 0,
|
||||
'macFrac': 0,
|
||||
'posPre': '',
|
||||
'posSuf': '',
|
||||
'negPre': '-',
|
||||
'negSuf': '',
|
||||
'gSize': 3,
|
||||
'lgSize': 3,
|
||||
'maxFrac': 3
|
||||
}, {
|
||||
"minInt": 1,
|
||||
"minFrac": 2,
|
||||
"macFrac": 0,
|
||||
"posPre": "¤",
|
||||
"posSuf": "",
|
||||
"negPre": "¤-",
|
||||
"negSuf": "",
|
||||
"gSize": 3,
|
||||
"lgSize": 3,
|
||||
"maxFrac": 2
|
||||
'minInt': 1,
|
||||
'minFrac': 2,
|
||||
'macFrac': 0,
|
||||
'posPre': '¤',
|
||||
'posSuf': '',
|
||||
'negPre': '¤-',
|
||||
'negSuf': '',
|
||||
'gSize': 3,
|
||||
'lgSize': 3,
|
||||
'maxFrac': 2
|
||||
}],
|
||||
"CURRENCY_SYM": "£"
|
||||
'CURRENCY_SYM': '£'
|
||||
}}};
|
||||
}
|
||||
|
||||
@@ -87,26 +87,26 @@ describe('findLocaleId', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("extractNumberSymbols", function() {
|
||||
it("should extract number data", function() {
|
||||
describe('extractNumberSymbols', function() {
|
||||
it('should extract number data', function() {
|
||||
var CONTENT = [
|
||||
"goog.provide('goog.i18n.NumberFormatSymbols_en_GB');",
|
||||
"goog.i18n.NumberFormatSymbols_en_GB = {",
|
||||
"DECIMAL_SEP: '.',",
|
||||
"GROUP_SEP: ',',",
|
||||
"PERCENT: '%',",
|
||||
"ZERO_DIGIT: '0',",
|
||||
"PLUS_SIGN: '+',",
|
||||
"MINUS_SIGN: '-',",
|
||||
"EXP_SYMBOL: 'E',",
|
||||
"PERMILL: '\u2030',",
|
||||
"INFINITY: '\u221E',",
|
||||
"NAN: 'NaN',",
|
||||
"DECIMAL_PATTERN: '#,##0.###',",
|
||||
"SCIENTIFIC_PATTERN: '#E0',",
|
||||
"PERCENT_PATTERN: '#,##0%',",
|
||||
"CURRENCY_PATTERN: '\u00A4#,##0.00',",
|
||||
"DEF_CURRENCY_CODE: 'GBP' };"
|
||||
'goog.provide(\'goog.i18n.NumberFormatSymbols_en_GB\');',
|
||||
'goog.i18n.NumberFormatSymbols_en_GB = {',
|
||||
'DECIMAL_SEP: \'.\',',
|
||||
'GROUP_SEP: \',\',',
|
||||
'PERCENT: \'%\',',
|
||||
'ZERO_DIGIT: \'0\',',
|
||||
'PLUS_SIGN: \'+\',',
|
||||
'MINUS_SIGN: \'-\',',
|
||||
'EXP_SYMBOL: \'E\',',
|
||||
'PERMILL: \'\u2030\',',
|
||||
'INFINITY: \'\u221E\',',
|
||||
'NAN: \'NaN\',',
|
||||
'DECIMAL_PATTERN: \'#,##0.###\',',
|
||||
'SCIENTIFIC_PATTERN: \'#E0\',',
|
||||
'PERCENT_PATTERN: \'#,##0%\',',
|
||||
'CURRENCY_PATTERN: \'\u00A4#,##0.00\',',
|
||||
'DEF_CURRENCY_CODE: \'GBP\' };'
|
||||
].join('\n');
|
||||
|
||||
var currencySymbols = {'GBP':[2, '£', 'GB£']};
|
||||
@@ -130,15 +130,15 @@ describe("extractNumberSymbols", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("extractCurrencySymbols", function() {
|
||||
it("should extract currency data", function() {
|
||||
describe('extractCurrencySymbols', function() {
|
||||
it('should extract currency data', function() {
|
||||
var CONTENT = [
|
||||
"goog.i18n.currency.CurrencyInfo = {",
|
||||
" 'GBP':[2, '£', 'GB£'],",
|
||||
"};",
|
||||
"goog.i18n.currency.CurrencyInfoTier2 = {",
|
||||
" 'AOA':[2, 'Kz', 'Kz'],",
|
||||
"};"
|
||||
'goog.i18n.currency.CurrencyInfo = {',
|
||||
' \'GBP\':[2, \'£\', \'GB£\'],',
|
||||
'};',
|
||||
'goog.i18n.currency.CurrencyInfoTier2 = {',
|
||||
' \'AOA\':[2, \'Kz\', \'Kz\'],',
|
||||
'};'
|
||||
].join('\n');
|
||||
|
||||
var currencySymbols = extractCurrencySymbols(CONTENT);
|
||||
@@ -152,42 +152,42 @@ describe("extractCurrencySymbols", function() {
|
||||
});
|
||||
|
||||
|
||||
describe("extractDateTimeSymbols", function() {
|
||||
it("should extract date time data", function() {
|
||||
describe('extractDateTimeSymbols', function() {
|
||||
it('should extract date time data', function() {
|
||||
var CONTENT = [
|
||||
"goog.i18n.DateTimeSymbols_fr_CA = {",
|
||||
" ERAS: ['av. J.-C.', 'ap. J.-C.'],",
|
||||
" ERANAMES: ['avant Jésus-Christ', 'après Jésus-Christ'],",
|
||||
" NARROWMONTHS: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],",
|
||||
" STANDALONENARROWMONTHS: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O',",
|
||||
" 'N', 'D'],",
|
||||
" MONTHS: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',",
|
||||
" 'août', 'septembre', 'octobre', 'novembre', 'décembre'],",
|
||||
" STANDALONEMONTHS: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin',",
|
||||
" 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],",
|
||||
" SHORTMONTHS: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.',",
|
||||
" 'août', 'sept.', 'oct.', 'nov.', 'déc.'],",
|
||||
" STANDALONESHORTMONTHS: ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin',",
|
||||
" 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],",
|
||||
" WEEKDAYS: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi',",
|
||||
" 'samedi'],",
|
||||
" STANDALONEWEEKDAYS: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi',",
|
||||
" 'vendredi', 'samedi'],",
|
||||
" SHORTWEEKDAYS: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],",
|
||||
" STANDALONESHORTWEEKDAYS: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.',",
|
||||
" 'sam.'],",
|
||||
" NARROWWEEKDAYS: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],",
|
||||
" STANDALONENARROWWEEKDAYS: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],",
|
||||
" SHORTQUARTERS: ['T1', 'T2', 'T3', 'T4'],",
|
||||
" QUARTERS: ['1er trimestre', '2e trimestre', '3e trimestre', '4e trimestre'],",
|
||||
" AMPMS: ['AM', 'PM'],",
|
||||
" DATEFORMATS: ['EEEE d MMMM y', 'd MMMM y', 'yyyy-MM-dd', 'yy-MM-dd'],",
|
||||
" TIMEFORMATS: ['HH \\'h\\' mm \\'min\\' ss \\'s\\' zzzz', 'HH:mm:ss z',",
|
||||
" 'HH:mm:ss', 'HH:mm'],",
|
||||
" FIRSTDAYOFWEEK: 6,",
|
||||
" WEEKENDRANGE: [5, 6],",
|
||||
" FIRSTWEEKCUTOFFDAY: 2",
|
||||
"};"
|
||||
'goog.i18n.DateTimeSymbols_fr_CA = {',
|
||||
' ERAS: [\'av. J.-C.\', \'ap. J.-C.\'],',
|
||||
' ERANAMES: [\'avant Jésus-Christ\', \'après Jésus-Christ\'],',
|
||||
' NARROWMONTHS: [\'J\', \'F\', \'M\', \'A\', \'M\', \'J\', \'J\', \'A\', \'S\', \'O\', \'N\', \'D\'],',
|
||||
' STANDALONENARROWMONTHS: [\'J\', \'F\', \'M\', \'A\', \'M\', \'J\', \'J\', \'A\', \'S\', \'O\',',
|
||||
' \'N\', \'D\'],',
|
||||
' MONTHS: [\'janvier\', \'février\', \'mars\', \'avril\', \'mai\', \'juin\', \'juillet\',',
|
||||
' \'août\', \'septembre\', \'octobre\', \'novembre\', \'décembre\'],',
|
||||
' STANDALONEMONTHS: [\'janvier\', \'février\', \'mars\', \'avril\', \'mai\', \'juin\',',
|
||||
' \'juillet\', \'août\', \'septembre\', \'octobre\', \'novembre\', \'décembre\'],',
|
||||
' SHORTMONTHS: [\'janv.\', \'févr.\', \'mars\', \'avr.\', \'mai\', \'juin\', \'juil.\',',
|
||||
' \'août\', \'sept.\', \'oct.\', \'nov.\', \'déc.\'],',
|
||||
' STANDALONESHORTMONTHS: [\'janv.\', \'févr.\', \'mars\', \'avr.\', \'mai\', \'juin\',',
|
||||
' \'juil.\', \'août\', \'sept.\', \'oct.\', \'nov.\', \'déc.\'],',
|
||||
' WEEKDAYS: [\'dimanche\', \'lundi\', \'mardi\', \'mercredi\', \'jeudi\', \'vendredi\',',
|
||||
' \'samedi\'],',
|
||||
' STANDALONEWEEKDAYS: [\'dimanche\', \'lundi\', \'mardi\', \'mercredi\', \'jeudi\',',
|
||||
' \'vendredi\', \'samedi\'],',
|
||||
' SHORTWEEKDAYS: [\'dim.\', \'lun.\', \'mar.\', \'mer.\', \'jeu.\', \'ven.\', \'sam.\'],',
|
||||
' STANDALONESHORTWEEKDAYS: [\'dim.\', \'lun.\', \'mar.\', \'mer.\', \'jeu.\', \'ven.\',',
|
||||
' \'sam.\'],',
|
||||
' NARROWWEEKDAYS: [\'D\', \'L\', \'M\', \'M\', \'J\', \'V\', \'S\'],',
|
||||
' STANDALONENARROWWEEKDAYS: [\'D\', \'L\', \'M\', \'M\', \'J\', \'V\', \'S\'],',
|
||||
' SHORTQUARTERS: [\'T1\', \'T2\', \'T3\', \'T4\'],',
|
||||
' QUARTERS: [\'1er trimestre\', \'2e trimestre\', \'3e trimestre\', \'4e trimestre\'],',
|
||||
' AMPMS: [\'AM\', \'PM\'],',
|
||||
' DATEFORMATS: [\'EEEE d MMMM y\', \'d MMMM y\', \'yyyy-MM-dd\', \'yy-MM-dd\'],',
|
||||
' TIMEFORMATS: [\'HH \\\'h\\\' mm \\\'min\\\' ss \\\'s\\\' zzzz\', \'HH:mm:ss z\',',
|
||||
' \'HH:mm:ss\', \'HH:mm\'],',
|
||||
' FIRSTDAYOFWEEK: 6,',
|
||||
' WEEKENDRANGE: [5, 6],',
|
||||
' FIRSTWEEKCUTOFFDAY: 2',
|
||||
'};'
|
||||
].join('\n');
|
||||
var localeInfo = {};
|
||||
var expectedLocaleInfo = {
|
||||
@@ -222,34 +222,34 @@ describe("extractDateTimeSymbols", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("pluralExtractor", function() {
|
||||
it("should output PLURAL_CAT in the output string code", function() {
|
||||
describe('pluralExtractor', function() {
|
||||
it('should output PLURAL_CAT in the output string code', function() {
|
||||
var content = (
|
||||
"goog.provide('goog.i18n.pluralRules');\n" +
|
||||
"\n" +
|
||||
"goog.i18n.pluralRules.Keyword = {\n" +
|
||||
" ZERO: 'zero',\n" +
|
||||
" ONE: 'one',\n" +
|
||||
" TWO: 'two',\n" +
|
||||
" FEW: 'few',\n" +
|
||||
" MANY: 'many',\n" +
|
||||
" OTHER: 'other'\n" +
|
||||
"};\n" +
|
||||
"\n" +
|
||||
"goog.i18n.pluralRules.frSelect_ = function(n) {\n" +
|
||||
" if (n >= 0 && n < 2) {\n" +
|
||||
" return goog.i18n.pluralRules.Keyword.ONE;\n" +
|
||||
" }\n" +
|
||||
" return goog.i18n.pluralRules.Keyword.OTHER;\n" +
|
||||
"};\n" +
|
||||
"\n" +
|
||||
"if (goog.LOCALE == 'fr') {\n" +
|
||||
" goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_;\n" +
|
||||
"}"
|
||||
'goog.provide(\'goog.i18n.pluralRules\');\n' +
|
||||
'\n' +
|
||||
'goog.i18n.pluralRules.Keyword = {\n' +
|
||||
' ZERO: \'zero\',\n' +
|
||||
' ONE: \'one\',\n' +
|
||||
' TWO: \'two\',\n' +
|
||||
' FEW: \'few\',\n' +
|
||||
' MANY: \'many\',\n' +
|
||||
' OTHER: \'other\'\n' +
|
||||
'};\n' +
|
||||
'\n' +
|
||||
'goog.i18n.pluralRules.frSelect_ = function(n) {\n' +
|
||||
' if (n >= 0 && n < 2) {\n' +
|
||||
' return goog.i18n.pluralRules.Keyword.ONE;\n' +
|
||||
' }\n' +
|
||||
' return goog.i18n.pluralRules.Keyword.OTHER;\n' +
|
||||
'};\n' +
|
||||
'\n' +
|
||||
'if (goog.LOCALE == \'fr\') {\n' +
|
||||
' goog.i18n.pluralRules.select = goog.i18n.pluralRules.frSelect_;\n' +
|
||||
'}'
|
||||
);
|
||||
var localeInfo = newTestLocaleInfo();
|
||||
closureI18nExtractor.pluralExtractor(content, localeInfo);
|
||||
var pluralCat = localeInfo["fr_CA"].pluralCat;
|
||||
var pluralCat = localeInfo['fr_CA'].pluralCat;
|
||||
expect(pluralCat).toBeDefined();
|
||||
// pluralCat is the source text for the pluralCat and contains @@
|
||||
// placeholders that need to be stripped before evaluation.
|
||||
@@ -258,38 +258,38 @@ describe("pluralExtractor", function() {
|
||||
// pluralCat requires these constants to exist.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var PLURAL_CATEGORY = {
|
||||
ZERO: "zero", ONE: "one", TWO: "two",
|
||||
FEW: "few", MANY: "many", OTHER: "other"
|
||||
ZERO: 'zero', ONE: 'one', TWO: 'two',
|
||||
FEW: 'few', MANY: 'many', OTHER: 'other'
|
||||
};
|
||||
// Obtain the function by evaluating the source text.
|
||||
// eslint-disable-next-line no-eval
|
||||
pluralCat = eval("(" + pluralCat + ")");
|
||||
pluralCat = eval('(' + pluralCat + ')');
|
||||
// Confirm some expectations for pluralCat in fr_CA.
|
||||
expect(pluralCat(0)).toEqual("one");
|
||||
expect(pluralCat(3)).toEqual("other");
|
||||
expect(pluralCat(0)).toEqual('one');
|
||||
expect(pluralCat(3)).toEqual('other');
|
||||
});
|
||||
});
|
||||
|
||||
describe("serializeContent", function() {
|
||||
it("should not make any modifications to the content of the locale", function() {
|
||||
describe('serializeContent', function() {
|
||||
it('should not make any modifications to the content of the locale', function() {
|
||||
var serializedContent = closureI18nExtractor.serializeContent(newTestLocaleInfo());
|
||||
// eslint-disable-next-line no-eval
|
||||
expect(eval("(" + serializedContent + ")")).toEqual(newTestLocaleInfo());
|
||||
expect(eval('(' + serializedContent + ')')).toEqual(newTestLocaleInfo());
|
||||
});
|
||||
it("should only have ascii characters", function() {
|
||||
it('should only have ascii characters', function() {
|
||||
var serializedContent = closureI18nExtractor.serializeContent(newTestLocaleInfo());
|
||||
expect((/[^\u0001-\u007f]/).test(serializedContent)).toBe(false);
|
||||
});
|
||||
it("should not transform arrays into objects", function() {
|
||||
it('should not transform arrays into objects', function() {
|
||||
var serializedContent = closureI18nExtractor.serializeContent(newTestLocaleInfo().fr_CA);
|
||||
// eslint-disable-next-line no-eval
|
||||
var deserializedLocale = eval("(" + serializedContent + ")");
|
||||
var deserializedLocale = eval('(' + serializedContent + ')');
|
||||
expect(deserializedLocale.DATETIME_FORMATS.MONTH.length).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("outputLocale", function() {
|
||||
it("should render the correct locale ids", function() {
|
||||
describe('outputLocale', function() {
|
||||
it('should render the correct locale ids', function() {
|
||||
var output = outputLocale(newTestLocaleInfo(), 'fr_CA');
|
||||
expect(output).toContain('"id": "fr-ca"');
|
||||
expect(output).toContain('"localeID": "fr_CA"');
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
var converter = require('../src/converter.js');
|
||||
|
||||
describe("convertNumberData", function() {
|
||||
describe('convertNumberData', function() {
|
||||
var convert = converter.convertNumberData,
|
||||
dataObj = { DECIMAL_SEP: ',',
|
||||
GROUP_SEP: '.',
|
||||
@@ -26,7 +26,7 @@ describe("convertNumberData", function() {
|
||||
});
|
||||
|
||||
|
||||
describe("convertDatetimeData", function() {
|
||||
describe('convertDatetimeData', function() {
|
||||
var convert = converter.convertDatetimeData,
|
||||
dataObj = { MONTHS: ['Enero', 'Pebrero'],
|
||||
STANDALONEMONTHS: ['Enero', 'Pebrero'],
|
||||
|
||||
@@ -24,7 +24,7 @@ describe('parsePattern', function() {
|
||||
parseAndExpect('#,##0.###', '', '-', '', '', 1, 0, 3, 3, 3);
|
||||
parseAndExpect('#,##0.###;#,##0.###-', '', '', '', '-', 1, 0, 3, 3, 3);
|
||||
parseAndExpect('#,##,##0.###', '', '-', '', '', 1, 0, 3, 2, 3);
|
||||
parseAndExpect("#,##0.###;'\u202A'-#,##0.###'\u202C'",
|
||||
parseAndExpect('#,##0.###;\'\u202A\'-#,##0.###\'\u202C\'',
|
||||
'', '\u202A-', '', '\u202C', 1, 0, 3, 3, 3);
|
||||
parseAndExpect('#0.###;#0.###-', '', '', '', '-', 1, 0, 3, 0, 0);
|
||||
|
||||
@@ -33,7 +33,7 @@ describe('parsePattern', function() {
|
||||
it('should parse CURRENCY patterns', function() {
|
||||
// all CURRENCY patterns from closure
|
||||
parseAndExpect('#,##0.00 \u00A4', '', '-', ' \u00A4', ' \u00A4', 1, 2, 2, 3, 3);
|
||||
parseAndExpect("#,##0.00\u00A0\u00A4;'\u202A'-#,##0.00'\u202C'\u00A0\u00A4",
|
||||
parseAndExpect('#,##0.00\u00A0\u00A4;\'\u202A\'-#,##0.00\'\u202C\'\u00A0\u00A4',
|
||||
'', '\u202A-', '\u00A0\u00A4', '\u202C\u00A0\u00A4', 1, 2, 2, 3, 3);
|
||||
parseAndExpect('#,##0.00 \u00A4;(#,##0.00 \u00A4)',
|
||||
'', '(', ' \u00A4', ' \u00A4)', 1, 2, 2, 3, 3);
|
||||
|
||||
@@ -84,7 +84,7 @@ function pluralExtractor(content, localeInfo) {
|
||||
// eslint-disable-next-line no-eval
|
||||
eval(contentText);
|
||||
} catch (e) {
|
||||
console.log("Error in eval(contentText): " + e.stack);
|
||||
console.log('Error in eval(contentText): ' + e.stack);
|
||||
}
|
||||
if (!goog.i18n.pluralRules.select) {
|
||||
console.log('No select for lang [' + goog.LOCALE + ']');
|
||||
@@ -99,7 +99,7 @@ function pluralExtractor(content, localeInfo) {
|
||||
replace(/\n/g, '');
|
||||
|
||||
///@@ is a crazy place holder to be replaced before writing to file
|
||||
localeInfo[localeIds[i]].pluralCat = "@@" + temp + "@@";
|
||||
localeInfo[localeIds[i]].pluralCat = '@@' + temp + '@@';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ function canonicalizeForJsonStringify(unused_key, object) {
|
||||
// 2. https://code.google.com/p/v8/issues/detail?id=164
|
||||
// ECMA-262 does not specify enumeration order. The de facto standard
|
||||
// is to match insertion order, which V8 also does ...
|
||||
if (typeof object !== "object" || Object.prototype.toString.apply(object) === '[object Array]') {
|
||||
if (typeof object !== 'object' || Object.prototype.toString.apply(object) === '[object Array]') {
|
||||
return object;
|
||||
}
|
||||
var result = {};
|
||||
@@ -158,7 +158,7 @@ function outputLocale(localeInfo, localeID) {
|
||||
// don't want to write locale files that only have dateformat (i.e. missing
|
||||
// number formats.) So we skip them.
|
||||
if (!localeObj.NUMBER_FORMATS) {
|
||||
console.log("Skipping locale %j: Don't have any number formats", localeID);
|
||||
console.log('Skipping locale %j: Don\'t have any number formats', localeID);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ function outputLocale(localeInfo, localeID) {
|
||||
}
|
||||
|
||||
var prefix =
|
||||
"'use strict';\n" +
|
||||
'\'use strict\';\n' +
|
||||
'angular.module("ngLocale", [], ["$provide", function($provide) {\n' +
|
||||
'var PLURAL_CATEGORY = {' +
|
||||
'ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"' +
|
||||
|
||||
@@ -11,7 +11,7 @@ var NG_LOCALE_DIR = '../src/ngLocale/';
|
||||
|
||||
|
||||
function readSymbols() {
|
||||
console.log("Processing currency and number symbols ...");
|
||||
console.log('Processing currency and number symbols ...');
|
||||
var numericStagePromise = qfs.read(__dirname + '/../closure/currencySymbols.js', 'b')
|
||||
.then(function(content) {
|
||||
var currencySymbols = closureI18nExtractor.extractCurrencySymbols(content);
|
||||
@@ -25,7 +25,7 @@ function readSymbols() {
|
||||
});
|
||||
});
|
||||
|
||||
console.log("Processing datetime symbols ...");
|
||||
console.log('Processing datetime symbols ...');
|
||||
var datetimeStagePromise = qfs.read(__dirname + '/../closure/datetimeSymbols.js', 'b')
|
||||
.then(function(content) {
|
||||
closureI18nExtractor.extractDateTimeSymbols(content, localeInfo);
|
||||
@@ -98,4 +98,4 @@ createFolder(NG_LOCALE_DIR)
|
||||
.then(readSymbols)
|
||||
.then(extractPlurals)
|
||||
.then(writeLocaleFiles)
|
||||
.done(function(num_files) { console.log("Wrote %j files.\nAll Done!", num_files); });
|
||||
.done(function(num_files) { console.log('Wrote %j files.\nAll Done!', num_files); });
|
||||
|
||||
@@ -75,10 +75,10 @@ module.exports = function(config, specificOptions) {
|
||||
version: '11'
|
||||
},
|
||||
'SL_iOS': {
|
||||
base: "SauceLabs",
|
||||
browserName: "iphone",
|
||||
platform: "OS X 10.10",
|
||||
version: "8.1"
|
||||
base: 'SauceLabs',
|
||||
browserName: 'iphone',
|
||||
platform: 'OS X 10.10',
|
||||
version: '8.1'
|
||||
},
|
||||
|
||||
'BS_Chrome': {
|
||||
|
||||
+9
-9
@@ -25,7 +25,7 @@ module.exports = {
|
||||
p.stdout.pipe(process.stdout);
|
||||
p.stderr.pipe(process.stderr);
|
||||
p.on('exit', function(code) {
|
||||
if (code !== 0) grunt.fail.warn("Karma test(s) failed. Exit code: " + code);
|
||||
if (code !== 0) grunt.fail.warn('Karma test(s) failed. Exit code: ' + code);
|
||||
done();
|
||||
});
|
||||
},
|
||||
@@ -110,9 +110,9 @@ module.exports = {
|
||||
//escape for js
|
||||
css = css
|
||||
.replace(/\\/g, '\\\\')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/'/g, '\\\'')
|
||||
.replace(/\r?\n/g, '\\n');
|
||||
js = "!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type=\"text/css\">" + css + "</style>');";
|
||||
js = '!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(\'<style type="text/css">' + css + '</style>\');';
|
||||
state.js.push(js);
|
||||
|
||||
return state;
|
||||
@@ -164,7 +164,7 @@ module.exports = {
|
||||
singleStrict: function(src, insert) {
|
||||
return src
|
||||
.replace(/\s*("|')use strict("|');\s*/g, insert) // remove all file-specific strict mode flags
|
||||
.replace(/(\(function\([^)]*\)\s*\{)/, "$1'use strict';"); // add single strict mode flag
|
||||
.replace(/(\(function\([^)]*\)\s*\{)/, '$1\'use strict\';'); // add single strict mode flag
|
||||
},
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ module.exports = {
|
||||
|
||||
|
||||
min: function(file, done) {
|
||||
var classPathSep = (process.platform === "win32") ? ';' : ':';
|
||||
var classPathSep = (process.platform === 'win32') ? ';' : ':';
|
||||
var minFile = file.replace(/\.js$/, '.min.js');
|
||||
var mapFile = minFile + '.map';
|
||||
var mapFileName = mapFile.match(/[^\/]+$/)[0];
|
||||
@@ -220,7 +220,7 @@ module.exports = {
|
||||
|
||||
//returns the 32-bit mode force flags for java compiler if supported, this makes the build much faster
|
||||
java32flags: function() {
|
||||
if (process.platform === "win32") return '';
|
||||
if (process.platform === 'win32') return '';
|
||||
if (shell.exec('java -version -d32 2>&1', {silent: true}).code !== 0) return '';
|
||||
return ' -d32 -client';
|
||||
},
|
||||
@@ -270,9 +270,9 @@ module.exports = {
|
||||
var CSP = /\.csp\W/;
|
||||
|
||||
if (CSP.test(req.url)) {
|
||||
res.setHeader("X-WebKit-CSP", "default-src 'self';");
|
||||
res.setHeader("X-Content-Security-Policy", "default-src 'self'");
|
||||
res.setHeader("Content-Security-Policy", "default-src 'self'");
|
||||
res.setHeader('X-WebKit-CSP', 'default-src \'self\';');
|
||||
res.setHeader('X-Content-Security-Policy', 'default-src \'self\'');
|
||||
res.setHeader('Content-Security-Policy', 'default-src \'self\'');
|
||||
}
|
||||
next();
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var glob = require("glob");
|
||||
var glob = require('glob');
|
||||
var _ = require('lodash');
|
||||
var files = require('../../angularFiles').files;
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ var getCodeName = function(tagName) {
|
||||
var tagMessage = gitCatOutput.match(/^.*codename.*$/mg)[0];
|
||||
var codeName = tagMessage && tagMessage.match(/codename\((.*)\)/)[1];
|
||||
if (!codeName) {
|
||||
throw new Error("Could not extract release code name. The message of tag " + tagName +
|
||||
" must match '*codename(some release name)*'");
|
||||
throw new Error('Could not extract release code name. The message of tag ' + tagName +
|
||||
' must match \'*codename(some release name)*\'');
|
||||
}
|
||||
return codeName;
|
||||
};
|
||||
|
||||
@@ -37,4 +37,4 @@ cleanModule(shrinkwrap, shrinkwrap.name);
|
||||
|
||||
var cleanShrinkwrapPath = path.join(__dirname, '..', '..', 'npm-shrinkwrap.clean.json');
|
||||
console.log('Writing cleaned to', cleanShrinkwrapPath);
|
||||
fs.writeFileSync(cleanShrinkwrapPath, JSON.stringify(sorted(shrinkwrap), null, 2) + "\n");
|
||||
fs.writeFileSync(cleanShrinkwrapPath, JSON.stringify(sorted(shrinkwrap), null, 2) + '\n');
|
||||
|
||||
+11
-11
@@ -194,7 +194,7 @@ function isArrayLike(obj) {
|
||||
|
||||
// Support: iOS 8.2 (not reproducible in simulator)
|
||||
// "length" in obj used to prevent JIT error (gh-11508)
|
||||
var length = "length" in Object(obj) && obj.length;
|
||||
var length = 'length' in Object(obj) && obj.length;
|
||||
|
||||
// NodeList objects (with `item` method) and
|
||||
// other objects with suitable length characteristics are array-like
|
||||
@@ -814,10 +814,10 @@ function copy(source, destination) {
|
||||
|
||||
if (destination) {
|
||||
if (isTypedArray(destination) || isArrayBuffer(destination)) {
|
||||
throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
|
||||
throw ngMinErr('cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
if (source === destination) {
|
||||
throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
|
||||
throw ngMinErr('cpi', 'Can\'t copy! Source and destination are identical.');
|
||||
}
|
||||
|
||||
// Empty the destination object
|
||||
@@ -883,7 +883,7 @@ function copy(source, destination) {
|
||||
|
||||
if (isWindow(source) || isScope(source)) {
|
||||
throw ngMinErr('cpws',
|
||||
"Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
}
|
||||
|
||||
var needsRecurse = false;
|
||||
@@ -1343,7 +1343,7 @@ function tryDecodeURIComponent(value) {
|
||||
*/
|
||||
function parseKeyValue(/**string*/keyValue) {
|
||||
var obj = {};
|
||||
forEach((keyValue || "").split('&'), function(keyValue) {
|
||||
forEach((keyValue || '').split('&'), function(keyValue) {
|
||||
var splitPoint, key, val;
|
||||
if (keyValue) {
|
||||
key = keyValue = keyValue.replace(/\+/g,'%20');
|
||||
@@ -1546,7 +1546,7 @@ function getNgAttribute(element, ngAttr) {
|
||||
}])
|
||||
.controller('GoodController2', GoodController2);
|
||||
function GoodController2($scope) {
|
||||
$scope.name = "World";
|
||||
$scope.name = 'World';
|
||||
}
|
||||
GoodController2.$inject = ['$scope'];
|
||||
</file>
|
||||
@@ -1596,7 +1596,7 @@ function angularInit(element, bootstrap) {
|
||||
}
|
||||
});
|
||||
if (appElement) {
|
||||
config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
|
||||
config.strictDi = getNgAttribute(appElement, 'strict-di') !== null;
|
||||
bootstrap(appElement, module ? [module] : [], config);
|
||||
}
|
||||
}
|
||||
@@ -1674,7 +1674,7 @@ function bootstrap(element, modules, config) {
|
||||
// Encode angle brackets to prevent input from being sanitized to empty string #8683.
|
||||
throw ngMinErr(
|
||||
'btstrpd',
|
||||
"App already bootstrapped with this element '{0}'",
|
||||
'App already bootstrapped with this element \'{0}\'',
|
||||
tag.replace(/</,'<').replace(/>/,'>'));
|
||||
}
|
||||
|
||||
@@ -1803,7 +1803,7 @@ function bindJQuery() {
|
||||
jQuery.cleanData = function(elems) {
|
||||
var events;
|
||||
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
|
||||
events = jQuery._data(elem, "events");
|
||||
events = jQuery._data(elem, 'events');
|
||||
if (events && events.$destroy) {
|
||||
jQuery(elem).triggerHandler('$destroy');
|
||||
}
|
||||
@@ -1825,7 +1825,7 @@ function bindJQuery() {
|
||||
*/
|
||||
function assertArg(arg, name, reason) {
|
||||
if (!arg) {
|
||||
throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
|
||||
throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
@@ -1847,7 +1847,7 @@ function assertArgFn(arg, name, acceptArrayAnnotation) {
|
||||
*/
|
||||
function assertNotHasOwnProperty(name, context) {
|
||||
if (name === 'hasOwnProperty') {
|
||||
throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
|
||||
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,9 +115,9 @@
|
||||
*/
|
||||
var version = {
|
||||
full: '"NG_VERSION_FULL"', // all of these placeholder strings will be replaced by grunt's
|
||||
major: "NG_VERSION_MAJOR", // package task
|
||||
minor: "NG_VERSION_MINOR",
|
||||
dot: "NG_VERSION_DOT",
|
||||
major: 'NG_VERSION_MAJOR', // package task
|
||||
minor: 'NG_VERSION_MINOR',
|
||||
dot: 'NG_VERSION_DOT',
|
||||
codeName: '"NG_VERSION_CODENAME"'
|
||||
};
|
||||
|
||||
|
||||
@@ -665,7 +665,7 @@ function createInjector(modulesToLoad, strictDi) {
|
||||
if (angular.isString(caller)) {
|
||||
path.push(caller);
|
||||
}
|
||||
throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
|
||||
throw $injectorMinErr('unpr', 'Unknown provider: {0}', path.join(' <- '));
|
||||
})),
|
||||
instanceCache = {},
|
||||
protoInstanceInjector =
|
||||
@@ -704,7 +704,7 @@ function createInjector(modulesToLoad, strictDi) {
|
||||
provider_ = providerInjector.instantiate(provider_);
|
||||
}
|
||||
if (!provider_.$get) {
|
||||
throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
|
||||
throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', name);
|
||||
}
|
||||
return (providerCache[name + providerSuffix] = provider_);
|
||||
}
|
||||
@@ -713,7 +713,7 @@ function createInjector(modulesToLoad, strictDi) {
|
||||
return /** @this */ function enforcedReturnValue() {
|
||||
var result = instanceInjector.invoke(factory, this);
|
||||
if (isUndefined(result)) {
|
||||
throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name);
|
||||
throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -794,7 +794,7 @@ function createInjector(modulesToLoad, strictDi) {
|
||||
// eslint-disable-next-line no-ex-assign
|
||||
e = e.message + '\n' + e.stack;
|
||||
}
|
||||
throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
|
||||
throw $injectorMinErr('modulerr', 'Failed to instantiate module {0} due to:\n{1}',
|
||||
module, e.stack || e.message || e);
|
||||
}
|
||||
});
|
||||
|
||||
+13
-13
@@ -166,7 +166,7 @@ var wrapMap = {
|
||||
'col': [2, '<table><colgroup>', '</colgroup></table>'],
|
||||
'tr': [2, '<table><tbody>', '</tbody></table>'],
|
||||
'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
|
||||
'_default': [0, "", ""]
|
||||
'_default': [0, '', '']
|
||||
};
|
||||
|
||||
wrapMap.optgroup = wrapMap.option;
|
||||
@@ -208,10 +208,10 @@ function jqLiteBuildFragment(html, context) {
|
||||
nodes.push(context.createTextNode(html));
|
||||
} else {
|
||||
// Convert html into DOM nodes
|
||||
tmp = fragment.appendChild(context.createElement("div"));
|
||||
tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
|
||||
tmp = fragment.appendChild(context.createElement('div'));
|
||||
tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
|
||||
wrap = wrapMap[tag] || wrapMap._default;
|
||||
tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
|
||||
tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
|
||||
|
||||
// Descend through wrappers to the right content
|
||||
i = wrap[0];
|
||||
@@ -222,12 +222,12 @@ function jqLiteBuildFragment(html, context) {
|
||||
nodes = concat(nodes, tmp.childNodes);
|
||||
|
||||
tmp = fragment.firstChild;
|
||||
tmp.textContent = "";
|
||||
tmp.textContent = '';
|
||||
}
|
||||
|
||||
// Remove wrapper from fragment
|
||||
fragment.textContent = "";
|
||||
fragment.innerHTML = ""; // Clear inner HTML
|
||||
fragment.textContent = '';
|
||||
fragment.innerHTML = ''; // Clear inner HTML
|
||||
forEach(nodes, function(node) {
|
||||
fragment.appendChild(node);
|
||||
});
|
||||
@@ -409,17 +409,17 @@ function jqLiteData(element, key, value) {
|
||||
|
||||
function jqLiteHasClass(element, selector) {
|
||||
if (!element.getAttribute) return false;
|
||||
return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
|
||||
indexOf(" " + selector + " ") > -1);
|
||||
return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' ').
|
||||
indexOf(' ' + selector + ' ') > -1);
|
||||
}
|
||||
|
||||
function jqLiteRemoveClass(element, cssClasses) {
|
||||
if (cssClasses && element.setAttribute) {
|
||||
forEach(cssClasses.split(' '), function(cssClass) {
|
||||
element.setAttribute('class', trim(
|
||||
(" " + (element.getAttribute('class') || '') + " ")
|
||||
.replace(/[\n\t]/g, " ")
|
||||
.replace(" " + trim(cssClass) + " ", " "))
|
||||
(' ' + (element.getAttribute('class') || '') + ' ')
|
||||
.replace(/[\n\t]/g, ' ')
|
||||
.replace(' ' + trim(cssClass) + ' ', ' '))
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -428,7 +428,7 @@ function jqLiteRemoveClass(element, cssClasses) {
|
||||
function jqLiteAddClass(element, cssClasses) {
|
||||
if (cssClasses && element.setAttribute) {
|
||||
var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
|
||||
.replace(/[\n\t]/g, " ");
|
||||
.replace(/[\n\t]/g, ' ');
|
||||
|
||||
forEach(cssClasses.split(' '), function(cssClass) {
|
||||
cssClass = trim(cssClass);
|
||||
|
||||
+3
-3
@@ -91,9 +91,9 @@ function setupModuleLoader(window) {
|
||||
}
|
||||
return ensure(modules, name, function() {
|
||||
if (!requires) {
|
||||
throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
|
||||
"the module name or forgot to load it. If registering a module ensure that you " +
|
||||
"specify the dependencies as the second argument.", name);
|
||||
throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
|
||||
'the module name or forgot to load it. If registering a module ensure that you ' +
|
||||
'specify the dependencies as the second argument.', name);
|
||||
}
|
||||
|
||||
/** @type {!Array.<Array.<*>>} */
|
||||
|
||||
+2
-2
@@ -223,7 +223,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
|
||||
*/
|
||||
this.register = function(name, factory) {
|
||||
if (name && name.charAt(0) !== '.') {
|
||||
throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name);
|
||||
throw $animateMinErr('notcsel', 'Expecting class selector starting with \'.\' got \'{0}\'.', name);
|
||||
}
|
||||
|
||||
var key = name + '-animation';
|
||||
@@ -249,7 +249,7 @@ var $AnimateProvider = ['$provide', /** @this */ function($provide) {
|
||||
if (arguments.length === 1) {
|
||||
this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
|
||||
if (this.$$classNameFilter) {
|
||||
var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
|
||||
var reservedRegex = new RegExp('(\\s+|\\/)' + NG_ANIMATE_CLASSNAME + '(\\s+|\\/)');
|
||||
if (reservedRegex.test(this.$$classNameFilter.toString())) {
|
||||
throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
|
||||
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ function Browser(window, document, $log, $sniffer) {
|
||||
// the new location.href if a reload happened or if there is a bug like in iOS 9 (see
|
||||
// https://openradar.appspot.com/22186109).
|
||||
// - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
|
||||
return pendingLocation || location.href.replace(/%27/g,"'");
|
||||
return pendingLocation || location.href.replace(/%27/g,'\'');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ function $CacheFactoryProvider() {
|
||||
|
||||
function cacheFactory(cacheId, options) {
|
||||
if (cacheId in caches) {
|
||||
throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
|
||||
throw minErr('$cacheFactory')('iid', 'CacheId \'{0}\' is already taken!', cacheId);
|
||||
}
|
||||
|
||||
var size = 0,
|
||||
|
||||
+29
-29
@@ -987,11 +987,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
|
||||
if (!match) {
|
||||
throw $compileMinErr('iscp',
|
||||
"Invalid {3} for directive '{0}'." +
|
||||
" Definition: {... {1}: '{2}' ...}",
|
||||
'Invalid {3} for directive \'{0}\'.' +
|
||||
' Definition: {... {1}: \'{2}\' ...}',
|
||||
directiveName, scopeName, definition,
|
||||
(isController ? "controller bindings definition" :
|
||||
"isolate scope definition"));
|
||||
(isController ? 'controller bindings definition' :
|
||||
'isolate scope definition'));
|
||||
}
|
||||
|
||||
bindings[scopeName] = {
|
||||
@@ -1033,12 +1033,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
if (!controller) {
|
||||
// There is no controller, there may or may not be a controllerAs property
|
||||
throw $compileMinErr('noctrl',
|
||||
"Cannot bind to controller without directive '{0}'s controller.",
|
||||
'Cannot bind to controller without directive \'{0}\'s controller.',
|
||||
directiveName);
|
||||
} else if (!identifierForController(controller, controllerAs)) {
|
||||
// There is a controller, but no identifier or controllerAs property
|
||||
throw $compileMinErr('noident',
|
||||
"Cannot bind to controller without identifier for directive '{0}'.",
|
||||
'Cannot bind to controller without identifier for directive \'{0}\'.',
|
||||
directiveName);
|
||||
}
|
||||
}
|
||||
@@ -1048,11 +1048,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
function assertValidDirectiveName(name) {
|
||||
var letter = name.charAt(0);
|
||||
if (!letter || letter !== lowercase(letter)) {
|
||||
throw $compileMinErr('baddir', "Directive/Component name '{0}' is invalid. The first character must be a lowercase letter", name);
|
||||
throw $compileMinErr('baddir', 'Directive/Component name \'{0}\' is invalid. The first character must be a lowercase letter', name);
|
||||
}
|
||||
if (name !== name.trim()) {
|
||||
throw $compileMinErr('baddir',
|
||||
"Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
|
||||
'Directive/Component name \'{0}\' is invalid. The name should not contain leading or trailing whitespaces',
|
||||
name);
|
||||
}
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
this[key] = value = $$sanitizeUri(value, key === 'src');
|
||||
} else if (nodeName === 'img' && key === 'srcset' && isDefined(value)) {
|
||||
// sanitize img[srcset] values
|
||||
var result = "";
|
||||
var result = '';
|
||||
|
||||
// first check if there are spaces because it's not the same pattern
|
||||
var trimmedSrcset = trim(value);
|
||||
@@ -1652,7 +1652,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
// sanitize the uri
|
||||
result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
|
||||
// add the descriptor
|
||||
result += (" " + trim(rawUris[innerIdx + 1]));
|
||||
result += (' ' + trim(rawUris[innerIdx + 1]));
|
||||
}
|
||||
|
||||
// split the last item into uri and descriptor
|
||||
@@ -1663,7 +1663,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
|
||||
// and add the last descriptor if any
|
||||
if (lastTuple.length === 2) {
|
||||
result += (" " + trim(lastTuple[1]));
|
||||
result += (' ' + trim(lastTuple[1]));
|
||||
}
|
||||
this[key] = value = result;
|
||||
}
|
||||
@@ -1736,7 +1736,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
// Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
|
||||
// so we have to jump through some hoops to get such an attribute
|
||||
// https://github.com/angular/angular.js/pull/13318
|
||||
specialAttrHolder.innerHTML = "<span " + attrName + ">";
|
||||
specialAttrHolder.innerHTML = '<span ' + attrName + '>';
|
||||
var attributes = specialAttrHolder.firstChild.attributes;
|
||||
var attribute = attributes[0];
|
||||
// We have to remove the attribute from its container element before we can add it to the destination element
|
||||
@@ -2159,7 +2159,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
do {
|
||||
if (!node) {
|
||||
throw $compileMinErr('uterdir',
|
||||
"Unterminated attribute, found '{0}' but no matching '{1}' found.",
|
||||
'Unterminated attribute, found \'{0}\' but no matching \'{1}\' found.',
|
||||
attrStart, attrEnd);
|
||||
}
|
||||
if (node.nodeType === NODE_TYPE_ELEMENT) {
|
||||
@@ -2334,7 +2334,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
if (!directive.templateUrl && directive.controller) {
|
||||
directiveValue = directive.controller;
|
||||
controllerDirectives = controllerDirectives || createMap();
|
||||
assertNoDuplicate("'" + directiveName + "' controller",
|
||||
assertNoDuplicate('\'' + directiveName + '\' controller',
|
||||
controllerDirectives[directiveName], directive, $compileNode);
|
||||
controllerDirectives[directiveName] = directive;
|
||||
}
|
||||
@@ -2472,7 +2472,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
|
||||
if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
|
||||
throw $compileMinErr('tplrt',
|
||||
"Template for directive '{0}' must have exactly one root element. {1}",
|
||||
'Template for directive \'{0}\' must have exactly one root element. {1}',
|
||||
directiveName, '');
|
||||
}
|
||||
|
||||
@@ -2796,7 +2796,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
|
||||
if (!value && !optional) {
|
||||
throw $compileMinErr('ctreq',
|
||||
"Controller '{0}', required by directive '{1}', can't be found!",
|
||||
'Controller \'{0}\', required by directive \'{1}\', can\'t be found!',
|
||||
name, directiveName);
|
||||
}
|
||||
} else if (isArray(require)) {
|
||||
@@ -2996,7 +2996,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
|
||||
if ($template.length !== 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
|
||||
throw $compileMinErr('tplrt',
|
||||
"Template for directive '{0}' must have exactly one root element. {1}",
|
||||
'Template for directive \'{0}\' must have exactly one root element. {1}',
|
||||
origAsyncDirective.name, templateUrl);
|
||||
}
|
||||
|
||||
@@ -3147,17 +3147,17 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
|
||||
|
||||
function getTrustedContext(node, attrNormalizedName) {
|
||||
if (attrNormalizedName === "srcdoc") {
|
||||
if (attrNormalizedName === 'srcdoc') {
|
||||
return $sce.HTML;
|
||||
}
|
||||
var tag = nodeName_(node);
|
||||
// maction[xlink:href] can source SVG. It's not limited to <maction>.
|
||||
if (attrNormalizedName === "xlinkHref" ||
|
||||
(tag === "form" && attrNormalizedName === "action") ||
|
||||
if (attrNormalizedName === 'xlinkHref' ||
|
||||
(tag === 'form' && attrNormalizedName === 'action') ||
|
||||
// links can be stylesheets or imports, which can run script in the current origin
|
||||
(tag === "link" && attrNormalizedName === "href") ||
|
||||
(tag !== "img" && (attrNormalizedName === "src" ||
|
||||
attrNormalizedName === "ngSrc"))) {
|
||||
(tag === 'link' && attrNormalizedName === 'href') ||
|
||||
(tag !== 'img' && (attrNormalizedName === 'src' ||
|
||||
attrNormalizedName === 'ngSrc'))) {
|
||||
return $sce.RESOURCE_URL;
|
||||
}
|
||||
}
|
||||
@@ -3173,16 +3173,16 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
if (!interpolateFn) return;
|
||||
|
||||
|
||||
if (name === "multiple" && nodeName_(node) === "select") {
|
||||
throw $compileMinErr("selmulti",
|
||||
"Binding to the 'multiple' attribute is not supported. Element: {0}",
|
||||
if (name === 'multiple' && nodeName_(node) === 'select') {
|
||||
throw $compileMinErr('selmulti',
|
||||
'Binding to the \'multiple\' attribute is not supported. Element: {0}',
|
||||
startingTag(node));
|
||||
}
|
||||
|
||||
if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
|
||||
throw $compileMinErr('nodomevents',
|
||||
"Interpolations for HTML DOM event attributes are disallowed. Please use the " +
|
||||
"ng- versions (such as ng-click instead of onclick) instead.");
|
||||
'Interpolations for HTML DOM event attributes are disallowed. Please use the ' +
|
||||
'ng- versions (such as ng-click instead of onclick) instead.');
|
||||
}
|
||||
|
||||
directives.push({
|
||||
@@ -3383,7 +3383,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
// reset the change, or we will throw this exception on every $digest
|
||||
lastValue = destination[scopeName] = parentGet(scope);
|
||||
throw $compileMinErr('nonassign',
|
||||
"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
|
||||
'Expression \'{0}\' in attribute \'{1}\' used with directive \'{2}\' is non-assignable!',
|
||||
attrs[attrName], attrName, directive.name);
|
||||
};
|
||||
lastValue = destination[scopeName] = parentGet(scope);
|
||||
|
||||
@@ -112,8 +112,8 @@ function $ControllerProvider() {
|
||||
match = expression.match(CNTRL_REG);
|
||||
if (!match) {
|
||||
throw $controllerMinErr('ctrlfmt',
|
||||
"Badly formed controller string '{0}'. " +
|
||||
"Must match `__name__ as __id__` or `__name__`.", expression);
|
||||
'Badly formed controller string \'{0}\'. ' +
|
||||
'Must match `__name__ as __id__` or `__name__`.', expression);
|
||||
}
|
||||
constructor = match[1];
|
||||
identifier = identifier || match[3];
|
||||
@@ -172,7 +172,7 @@ function $ControllerProvider() {
|
||||
function addIdentifier(locals, identifier, instance, name) {
|
||||
if (!(locals && isObject(locals.$scope))) {
|
||||
throw minErr('$controller')('noscp',
|
||||
"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
|
||||
'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.',
|
||||
name, identifier);
|
||||
}
|
||||
|
||||
|
||||
@@ -346,7 +346,7 @@ var ngAttributeAliasDirectives = {};
|
||||
// boolean attrs are evaluated
|
||||
forEach(BOOLEAN_ATTR, function(propName, attrName) {
|
||||
// binding to multiple is not supported
|
||||
if (propName === "multiple") return;
|
||||
if (propName === 'multiple') return;
|
||||
|
||||
function defaultLinkFn(scope, element, attr) {
|
||||
scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
|
||||
@@ -383,10 +383,10 @@ forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
|
||||
link: function(scope, element, attr) {
|
||||
//special case ngPattern when a literal regular expression value
|
||||
//is used as the expression (this way we don't have to watch anything).
|
||||
if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) === "/") {
|
||||
if (ngAttr === 'ngPattern' && attr.ngPattern.charAt(0) === '/') {
|
||||
var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
|
||||
if (match) {
|
||||
attr.$set("ngPattern", new RegExp(match[1], match[2]));
|
||||
attr.$set('ngPattern', new RegExp(match[1], match[2]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
* .controller('SettingsController1', SettingsController1);
|
||||
*
|
||||
* function SettingsController1() {
|
||||
* this.name = "John Smith";
|
||||
* this.name = 'John Smith';
|
||||
* this.contacts = [
|
||||
* {type: 'phone', value: '408 555 1212'},
|
||||
* {type: 'email', value: 'john.smith@example.org'}
|
||||
@@ -170,7 +170,7 @@
|
||||
* .controller('SettingsController2', ['$scope', SettingsController2]);
|
||||
*
|
||||
* function SettingsController2($scope) {
|
||||
* $scope.name = "John Smith";
|
||||
* $scope.name = 'John Smith';
|
||||
* $scope.contacts = [
|
||||
* {type:'phone', value:'408 555 1212'},
|
||||
* {type:'email', value:'john.smith@example.org'}
|
||||
|
||||
@@ -271,7 +271,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
||||
}
|
||||
};
|
||||
} else if (!parsedNgModel.assign) {
|
||||
throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
|
||||
throw ngModelMinErr('nonassign', 'Expression \'{0}\' is non-assignable. Element: {1}',
|
||||
$attr.ngModel, startingTag($element));
|
||||
}
|
||||
};
|
||||
@@ -640,7 +640,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
||||
var promise = validator(modelValue, viewValue);
|
||||
if (!isPromiseLike(promise)) {
|
||||
throw ngModelMinErr('nopromise',
|
||||
"Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
|
||||
'Expected asynchronous validator to return a promise but got \'{0}\' instead.', promise);
|
||||
}
|
||||
setValidity(name, undefined);
|
||||
validatorPromises.push(promise.then(function() {
|
||||
|
||||
@@ -253,9 +253,9 @@ var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile,
|
||||
var match = optionsExp.match(NG_OPTIONS_REGEXP);
|
||||
if (!(match)) {
|
||||
throw ngOptionsMinErr('iexp',
|
||||
"Expected expression in form of " +
|
||||
"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
|
||||
" but got '{0}'. Element: {1}",
|
||||
'Expected expression in form of ' +
|
||||
'\'_select_ (as _label_)? for (_key_,)?_value_ in _collection_\'' +
|
||||
' but got \'{0}\'. Element: {1}',
|
||||
optionsExp, startingTag(selectElement));
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale,
|
||||
var whenExpFn = whensExpFns[count];
|
||||
if (isUndefined(whenExpFn)) {
|
||||
if (newVal != null) {
|
||||
$log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp);
|
||||
$log.debug('ngPluralize: no rule defined for \'' + count + '\' in ' + whenExp);
|
||||
}
|
||||
watchRemover = noop;
|
||||
updateElementText();
|
||||
|
||||
@@ -363,7 +363,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
|
||||
var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
|
||||
|
||||
if (!match) {
|
||||
throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
|
||||
throw ngRepeatMinErr('iexp', 'Expected expression in form of \'_item_ in _collection_[ track by _id_]\' but got \'{0}\'.',
|
||||
expression);
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
|
||||
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}'.",
|
||||
throw ngRepeatMinErr('iidexp', '\'_item_\' in \'_item_ in _collection_\' should be an identifier or \'(_key_, _value_)\' expression, but got \'{0}\'.',
|
||||
lhs);
|
||||
}
|
||||
var valueIdentifier = match[3] || match[1];
|
||||
@@ -383,7 +383,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
|
||||
|
||||
if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
|
||||
/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
|
||||
throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",
|
||||
throw ngRepeatMinErr('badident', 'alias \'{0}\' is invalid --- must be a valid JS identifier which is not a reserved name.',
|
||||
aliasAs);
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $ani
|
||||
if (block && block.scope) lastBlockMap[block.id] = block;
|
||||
});
|
||||
throw ngRepeatMinErr('dupes',
|
||||
"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
|
||||
'Duplicates in a repeater are not allowed. Use \'track by\' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}',
|
||||
expression, trackById, value);
|
||||
} else {
|
||||
// new never before seen block
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
* })
|
||||
* .controller('ExampleController', ['$scope', function($scope) {
|
||||
* $scope.title = 'Lorem Ipsum';
|
||||
* $scope.link = "https://google.com";
|
||||
* $scope.link = 'https://google.com';
|
||||
* $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
|
||||
* }]);
|
||||
* </file>
|
||||
|
||||
@@ -395,7 +395,7 @@ function dateStrGetter(name, shortForm, standAlone) {
|
||||
|
||||
function timeZoneGetter(date, formats, offset) {
|
||||
var zone = -1 * offset;
|
||||
var paddedZone = (zone >= 0) ? "+" : "";
|
||||
var paddedZone = (zone >= 0) ? '+' : '';
|
||||
|
||||
paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
|
||||
padNumber(Math.abs(zone % 60), 2);
|
||||
@@ -641,7 +641,7 @@ function dateFilter($locale) {
|
||||
forEach(parts, function(value) {
|
||||
fn = DATE_FORMATS[value];
|
||||
text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
|
||||
: value === "''" ? "'" : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
|
||||
: value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
|
||||
});
|
||||
|
||||
return text;
|
||||
|
||||
+1
-1
@@ -895,7 +895,7 @@ function $HttpProvider() {
|
||||
$scope.status = response.status;
|
||||
$scope.data = response.data;
|
||||
}, function(response) {
|
||||
$scope.data = response.data || "Request failed";
|
||||
$scope.data = response.data || 'Request failed';
|
||||
$scope.status = response.status;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
|
||||
var jsonpDone = jsonpReq(url, callbackPath, function(status, text) {
|
||||
// jsonpReq only ever sets status to 200 (OK), 404 (ERROR) or -1 (WAITING)
|
||||
var response = (status === 200) && callbacks.getResponse(callbackPath);
|
||||
completeRequest(callback, status, response, "", text);
|
||||
completeRequest(callback, status, response, '', text);
|
||||
callbacks.removeCallback(callbackPath);
|
||||
});
|
||||
} else {
|
||||
@@ -177,7 +177,7 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
|
||||
// - fetches local scripts via XHR and evals them
|
||||
// - adds and immediately removes script elements from the document
|
||||
var script = rawDocument.createElement('script'), callback = null;
|
||||
script.type = "text/javascript";
|
||||
script.type = 'text/javascript';
|
||||
script.src = url;
|
||||
script.async = true;
|
||||
|
||||
@@ -187,14 +187,14 @@ function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDoc
|
||||
rawDocument.body.removeChild(script);
|
||||
script = null;
|
||||
var status = -1;
|
||||
var text = "unknown";
|
||||
var text = 'unknown';
|
||||
|
||||
if (event) {
|
||||
if (event.type === "load" && !callbacks.wasCalled(callbackPath)) {
|
||||
event = { type: "error" };
|
||||
if (event.type === 'load' && !callbacks.wasCalled(callbackPath)) {
|
||||
event = { type: 'error' };
|
||||
}
|
||||
text = event.type;
|
||||
status = event.type === "error" ? 404 : 200;
|
||||
status = event.type === 'error' ? 404 : 200;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
|
||||
$interpolateMinErr.throwNoconcat = function(text) {
|
||||
throw $interpolateMinErr('noconcat',
|
||||
"Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
|
||||
"interpolations that concatenate multiple expressions when a trusted value is " +
|
||||
"required. See http://docs.angularjs.org/api/ng.$sce", text);
|
||||
'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' +
|
||||
'interpolations that concatenate multiple expressions when a trusted value is ' +
|
||||
'required. See http://docs.angularjs.org/api/ng.$sce', text);
|
||||
};
|
||||
|
||||
$interpolateMinErr.interr = function(text, err) {
|
||||
return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
|
||||
return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString());
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -829,7 +829,7 @@ function $LocationProvider() {
|
||||
if (html5Mode.enabled) {
|
||||
if (!baseHref && html5Mode.requireBase) {
|
||||
throw $locationMinErr('nobase',
|
||||
"$location in HTML5 mode requires a <base> tag to be present!");
|
||||
'$location in HTML5 mode requires a <base> tag to be present!');
|
||||
}
|
||||
appBase = serverBase(initialUrl) + (baseHref || '/');
|
||||
LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
|
||||
|
||||
+8
-8
@@ -57,9 +57,9 @@ var objectValueOf = OBJECT_CTOR_PROTO.valueOf;
|
||||
|
||||
|
||||
function ensureSafeMemberName(name, fullExpression) {
|
||||
if (name === "__defineGetter__" || name === "__defineSetter__"
|
||||
|| name === "__lookupGetter__" || name === "__lookupSetter__"
|
||||
|| name === "__proto__") {
|
||||
if (name === '__defineGetter__' || name === '__defineSetter__'
|
||||
|| name === '__lookupGetter__' || name === '__lookupSetter__'
|
||||
|| name === '__proto__') {
|
||||
throw $parseMinErr('isecfld',
|
||||
'Attempting to access a disallowed field in Angular expressions! '
|
||||
+ 'Expression: {0}', fullExpression);
|
||||
@@ -149,7 +149,7 @@ function ensureSafeAssignContext(obj, fullExpression) {
|
||||
|
||||
var OPERATORS = createMap();
|
||||
forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
|
||||
var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
|
||||
var ESCAPE = {'n':'\n', 'f':'\f', 'r':'\r', 't':'\t', 'v':'\v', '\'':'\'', '"':'"'};
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
@@ -172,7 +172,7 @@ Lexer.prototype = {
|
||||
|
||||
while (this.index < this.text.length) {
|
||||
var ch = this.text.charAt(this.index);
|
||||
if (ch === '"' || ch === "'") {
|
||||
if (ch === '"' || ch === '\'') {
|
||||
this.readString(ch);
|
||||
} else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
|
||||
this.readNumber();
|
||||
@@ -211,7 +211,7 @@ Lexer.prototype = {
|
||||
},
|
||||
|
||||
isNumber: function(ch) {
|
||||
return ('0' <= ch && ch <= '9') && typeof ch === "string";
|
||||
return ('0' <= ch && ch <= '9') && typeof ch === 'string';
|
||||
},
|
||||
|
||||
isWhitespace: function(ch) {
|
||||
@@ -635,7 +635,7 @@ AST.prototype = {
|
||||
this.consume(':');
|
||||
property.value = this.expression();
|
||||
} else {
|
||||
this.throwError("invalid key", this.peek());
|
||||
this.throwError('invalid key', this.peek());
|
||||
}
|
||||
properties.push(property);
|
||||
} while (this.expect(','));
|
||||
@@ -1360,7 +1360,7 @@ ASTCompiler.prototype = {
|
||||
},
|
||||
|
||||
escape: function(value) {
|
||||
if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
|
||||
if (isString(value)) return '\'' + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + '\'';
|
||||
if (isNumber(value)) return value.toString();
|
||||
if (value === true) return 'true';
|
||||
if (value === false) return 'false';
|
||||
|
||||
+4
-4
@@ -325,11 +325,11 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
|
||||
return result.promise;
|
||||
},
|
||||
|
||||
"catch": function(callback) {
|
||||
'catch': function(callback) {
|
||||
return this.then(null, callback);
|
||||
},
|
||||
|
||||
"finally": function(callback, progressBack) {
|
||||
'finally': function(callback, progressBack) {
|
||||
return this.then(function(value) {
|
||||
return handleCallback(value, true, callback);
|
||||
}, function(error) {
|
||||
@@ -420,7 +420,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
|
||||
if (val === this.promise) {
|
||||
this.$$reject($qMinErr(
|
||||
'qcycle',
|
||||
"Expected promise to be resolved with value other than itself '{0}'",
|
||||
'Expected promise to be resolved with value other than itself \'{0}\'',
|
||||
val));
|
||||
} else {
|
||||
this.$$resolve(val);
|
||||
@@ -666,7 +666,7 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
|
||||
|
||||
var $Q = function Q(resolver) {
|
||||
if (!isFunction(resolver)) {
|
||||
throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver);
|
||||
throw $qMinErr('norslvr', 'Expected resolverFn, got \'{0}\'', resolver);
|
||||
}
|
||||
|
||||
var deferred = new Deferred();
|
||||
|
||||
+4
-4
@@ -612,7 +612,7 @@ function $SceDelegateProvider() {
|
||||
* .controller('AppController', ['$http', '$templateCache', '$sce',
|
||||
* function AppController($http, $templateCache, $sce) {
|
||||
* var self = this;
|
||||
* $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
|
||||
* $http.get('test_data.json', {cache: $templateCache}).success(function(userComments) {
|
||||
* self.userComments = userComments;
|
||||
* });
|
||||
* self.explicitlyTrustedHtml = $sce.trustAsHtml(
|
||||
@@ -1054,13 +1054,13 @@ function $SceProvider() {
|
||||
|
||||
forEach(SCE_CONTEXTS, function(enumValue, name) {
|
||||
var lName = lowercase(name);
|
||||
sce[camelCase("parse_as_" + lName)] = function(expr) {
|
||||
sce[camelCase('parse_as_' + lName)] = function(expr) {
|
||||
return parse(enumValue, expr);
|
||||
};
|
||||
sce[camelCase("get_trusted_" + lName)] = function(value) {
|
||||
sce[camelCase('get_trusted_' + lName)] = function(value) {
|
||||
return getTrusted(enumValue, value);
|
||||
};
|
||||
sce[camelCase("trust_as_" + lName)] = function(value) {
|
||||
sce[camelCase('trust_as_' + lName)] = function(value) {
|
||||
return trustAs(enumValue, value);
|
||||
};
|
||||
});
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
// doesn't know about mocked locations and resolves URLs to the real document - which is
|
||||
// exactly the behavior needed here. There is little value is mocking these out for this
|
||||
// service.
|
||||
var urlParsingNode = window.document.createElement("a");
|
||||
var urlParsingNode = window.document.createElement('a');
|
||||
var originUrl = urlResolve(window.location.href);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ function urlResolve(url) {
|
||||
if (msie) {
|
||||
// Normalize before parse. Refer Implementation Notes on why this is
|
||||
// done in two steps on IE.
|
||||
urlParsingNode.setAttribute("href", href);
|
||||
urlParsingNode.setAttribute('href', href);
|
||||
href = urlParsingNode.href;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro
|
||||
|
||||
var parentCounter = 0;
|
||||
function gcsHashFn(node, extraClasses) {
|
||||
var KEY = "$$ngAnimateParentKey";
|
||||
var KEY = '$$ngAnimateParentKey';
|
||||
var parentNode = node.parentNode;
|
||||
var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);
|
||||
return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;
|
||||
@@ -632,7 +632,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro
|
||||
|
||||
if (options.delay != null) {
|
||||
var delayStyle;
|
||||
if (typeof options.delay !== "boolean") {
|
||||
if (typeof options.delay !== 'boolean') {
|
||||
delayStyle = parseFloat(options.delay);
|
||||
// number in options.delay means we have to recalculate the delay for the closing timeout
|
||||
maxDelay = Math.max(delayStyle, 0);
|
||||
@@ -915,7 +915,7 @@ var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animatePro
|
||||
}
|
||||
|
||||
if (flags.applyAnimationDelay) {
|
||||
relativeDelay = typeof options.delay !== "boolean" && truthyTimingValue(options.delay)
|
||||
relativeDelay = typeof options.delay !== 'boolean' && truthyTimingValue(options.delay)
|
||||
? parseFloat(options.delay)
|
||||
: relativeDelay;
|
||||
|
||||
|
||||
+10
-10
@@ -552,16 +552,16 @@
|
||||
}])
|
||||
.run(['$rootScope', function($rootScope) {
|
||||
$rootScope.records = [
|
||||
{ id:1, title: "Miss Beulah Roob" },
|
||||
{ id:2, title: "Trent Morissette" },
|
||||
{ id:3, title: "Miss Ava Pouros" },
|
||||
{ id:4, title: "Rod Pouros" },
|
||||
{ id:5, title: "Abdul Rice" },
|
||||
{ id:6, title: "Laurie Rutherford Sr." },
|
||||
{ id:7, title: "Nakia McLaughlin" },
|
||||
{ id:8, title: "Jordon Blanda DVM" },
|
||||
{ id:9, title: "Rhoda Hand" },
|
||||
{ id:10, title: "Alexandrea Sauer" }
|
||||
{ id: 1, title: 'Miss Beulah Roob' },
|
||||
{ id: 2, title: 'Trent Morissette' },
|
||||
{ id: 3, title: 'Miss Ava Pouros' },
|
||||
{ id: 4, title: 'Rod Pouros' },
|
||||
{ id: 5, title: 'Abdul Rice' },
|
||||
{ id: 6, title: 'Laurie Rutherford Sr.' },
|
||||
{ id: 7, title: 'Nakia McLaughlin' },
|
||||
{ id: 8, title: 'Jordon Blanda DVM' },
|
||||
{ id: 9, title: 'Rhoda Hand' },
|
||||
{ id: 10, title: 'Alexandrea Sauer' }
|
||||
];
|
||||
}])
|
||||
.controller('HomeController', [function() {
|
||||
|
||||
@@ -58,7 +58,7 @@ var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
|
||||
var ngMinErr = angular.$$minErr('ng');
|
||||
function assertArg(arg, name, reason) {
|
||||
if (!arg) {
|
||||
throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
|
||||
throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ function $$CookieWriter($document, $log, $browser) {
|
||||
// - 4096 bytes per cookie
|
||||
var cookieLength = str.length + 1;
|
||||
if (cookieLength > 4096) {
|
||||
$log.warn("Cookie '" + name +
|
||||
"' possibly not set or overflowed because it was too large (" +
|
||||
cookieLength + " > 4096 bytes)!");
|
||||
$log.warn('Cookie \'' + name +
|
||||
'\' possibly not set or overflowed because it was too large (' +
|
||||
cookieLength + ' > 4096 bytes)!');
|
||||
}
|
||||
|
||||
return str;
|
||||
|
||||
@@ -146,7 +146,7 @@ MessageFormatParser.prototype.errorExpecting = function errorExpecting() {
|
||||
position.line, position.column, this.text);
|
||||
}
|
||||
var word = match[1];
|
||||
if (word === "select" || word === "plural") {
|
||||
if (word === 'select' || word === 'plural') {
|
||||
position = indexToLineAndColumn(this.text, this.index);
|
||||
throw $interpolateMinErr('reqcomma',
|
||||
'Expected a comma after the keyword “{0}” at line {1}, column {2} of text “{3}”',
|
||||
@@ -174,7 +174,7 @@ MessageFormatParser.prototype.ruleString = function ruleString() {
|
||||
MessageFormatParser.prototype.startStringAtMatch = function startStringAtMatch(match) {
|
||||
this.stringStartIndex = match.index;
|
||||
this.stringQuote = match[0];
|
||||
this.stringInterestsRe = this.stringQuote === "'" ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE;
|
||||
this.stringInterestsRe = this.stringQuote === '\'' ? SQUOTED_STRING_INTEREST_RE : DQUOTED_STRING_INTEREST_RE;
|
||||
this.rule = this.ruleInsideString;
|
||||
};
|
||||
|
||||
@@ -201,8 +201,8 @@ MessageFormatParser.prototype.rulePluralOrSelect = function rulePluralOrSelect()
|
||||
}
|
||||
var argType = match[1];
|
||||
switch (argType) {
|
||||
case "plural": this.rule = this.rulePluralStyle; break;
|
||||
case "select": this.rule = this.ruleSelectStyle; break;
|
||||
case 'plural': this.rule = this.rulePluralStyle; break;
|
||||
case 'select': this.rule = this.ruleSelectStyle; break;
|
||||
default: this.errorInParseLogic();
|
||||
}
|
||||
};
|
||||
@@ -220,7 +220,7 @@ MessageFormatParser.prototype.ruleSelectStyle = function ruleSelectStyle() {
|
||||
};
|
||||
|
||||
var NUMBER_RE = /[0]|(?:[1-9][0-9]*)/g;
|
||||
var PLURAL_OFFSET_RE = new RegExp("\\s*offset\\s*:\\s*(" + NUMBER_RE.source + ")", "g");
|
||||
var PLURAL_OFFSET_RE = new RegExp('\\s*offset\\s*:\\s*(' + NUMBER_RE.source + ')', 'g');
|
||||
|
||||
MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
|
||||
var match = this.matchRe(PLURAL_OFFSET_RE);
|
||||
@@ -251,7 +251,7 @@ MessageFormatParser.prototype.ruleSelectKeyword = function ruleSelectKeyword() {
|
||||
this.rule = this.ruleMessageText;
|
||||
};
|
||||
|
||||
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp("\\s*(?:(?:=(" + NUMBER_RE.source + "))|(\\w+))", "g");
|
||||
var EXPLICIT_VALUE_OR_KEYWORD_RE = new RegExp('\\s*(?:(?:=(' + NUMBER_RE.source + '))|(\\w+))', 'g');
|
||||
MessageFormatParser.prototype.rulePluralValueOrKeyword = function rulePluralValueOrKeyword() {
|
||||
var match = this.matchRe(EXPLICIT_VALUE_OR_KEYWORD_RE);
|
||||
if (match == null) {
|
||||
@@ -322,20 +322,20 @@ MessageFormatParser.prototype.ruleInInterpolationOrMessageText = function ruleIn
|
||||
this.rule = null;
|
||||
return;
|
||||
}
|
||||
if (token[0] === "\\") {
|
||||
if (token[0] === '\\') {
|
||||
// unescape next character and continue
|
||||
this.interpolationParts.addText(this.textPart + token[1]);
|
||||
return;
|
||||
}
|
||||
this.interpolationParts.addText(this.textPart);
|
||||
if (token === "{{") {
|
||||
if (token === '{{') {
|
||||
this.pushState();
|
||||
this.ruleStack.push(this.ruleEndMustacheInInterpolationOrMessage);
|
||||
this.rule = this.ruleEnteredMustache;
|
||||
} else if (token === "}") {
|
||||
} else if (token === '}') {
|
||||
this.choices[this.choiceKey] = this.interpolationParts.toParsedFn(/*mustHaveExpression=*/false, this.text);
|
||||
this.rule = this.ruleChoiceKeyword;
|
||||
} else if (token === "#") {
|
||||
} else if (token === '#') {
|
||||
this.interpolationParts.addExpressionFn(this.expressionMinusOffsetFn);
|
||||
} else {
|
||||
this.errorInParseLogic();
|
||||
@@ -359,7 +359,7 @@ MessageFormatParser.prototype.ruleInInterpolation = function ruleInInterpolation
|
||||
return;
|
||||
}
|
||||
var token = match[0];
|
||||
if (token[0] === "\\") {
|
||||
if (token[0] === '\\') {
|
||||
// unescape next character and continue
|
||||
this.interpolationParts.addText(this.text.substring(currentIndex, match.index) + token[1]);
|
||||
return;
|
||||
@@ -425,18 +425,18 @@ MessageFormatParser.prototype.ruleAngularExpression = function ruleAngularExpres
|
||||
|
||||
function getEndOperator(opBegin) {
|
||||
switch (opBegin) {
|
||||
case "{": return "}";
|
||||
case "[": return "]";
|
||||
case "(": return ")";
|
||||
case '{': return '}';
|
||||
case '[': return ']';
|
||||
case '(': return ')';
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
function getBeginOperator(opEnd) {
|
||||
switch (opEnd) {
|
||||
case "}": return "{";
|
||||
case "]": return "[";
|
||||
case ")": return "(";
|
||||
case '}': return '{';
|
||||
case ']': return '[';
|
||||
case ')': return '(';
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -470,12 +470,12 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
|
||||
this.getEndOperator(innermostOperator), this.text);
|
||||
}
|
||||
var operator = match[0];
|
||||
if (operator === "'" || operator === '"') {
|
||||
if (operator === '\'' || operator === '"') {
|
||||
this.ruleStack.push(this.ruleInAngularExpression);
|
||||
this.startStringAtMatch(match);
|
||||
return;
|
||||
}
|
||||
if (operator === ",") {
|
||||
if (operator === ',') {
|
||||
if (this.trustedContext) {
|
||||
position = indexToLineAndColumn(this.text, this.index);
|
||||
throw $interpolateMinErr('unsafe',
|
||||
|
||||
@@ -17,7 +17,7 @@ function MessageSelectorBase(expressionFn, choices) {
|
||||
var self = this;
|
||||
this.expressionFn = expressionFn;
|
||||
this.choices = choices;
|
||||
if (choices["other"] === undefined) {
|
||||
if (choices['other'] === undefined) {
|
||||
throw $interpolateMinErr('reqother', '“other” is a required option.');
|
||||
}
|
||||
this.parsedFn = function(context) { return self.getResult(context); };
|
||||
@@ -91,7 +91,7 @@ SelectMessageProto.prototype = MessageSelectorBase.prototype;
|
||||
|
||||
SelectMessage.prototype = new SelectMessageProto();
|
||||
SelectMessage.prototype.categorizeValue = function categorizeSelectValue(value) {
|
||||
return (this.choices[value] !== undefined) ? value : "other";
|
||||
return (this.choices[value] !== undefined) ? value : 'other';
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -111,11 +111,11 @@ PluralMessageProto.prototype = MessageSelectorBase.prototype;
|
||||
PluralMessage.prototype = new PluralMessageProto();
|
||||
PluralMessage.prototype.categorizeValue = function categorizePluralValue(value) {
|
||||
if (isNaN(value)) {
|
||||
return "other";
|
||||
return 'other';
|
||||
} else if (this.choices[value] !== undefined) {
|
||||
return value;
|
||||
} else {
|
||||
var category = this.pluralCat(value - this.offset);
|
||||
return (this.choices[category] !== undefined) ? category : "other";
|
||||
return (this.choices[category] !== undefined) ? category : 'other';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
* this.gender = gender;
|
||||
* }
|
||||
*
|
||||
* var alice = new Person("Alice", "female"),
|
||||
* bob = new Person("Bob", "male"),
|
||||
* ashley = new Person("Ashley", "");
|
||||
* var alice = new Person('Alice', 'female'),
|
||||
* bob = new Person('Bob', 'male'),
|
||||
* ashley = new Person('Ashley', '');
|
||||
*
|
||||
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
||||
* .controller('AppController', ['$scope', function($scope) {
|
||||
@@ -97,11 +97,11 @@
|
||||
* this.gender = gender;
|
||||
* }
|
||||
*
|
||||
* var alice = new Person("Alice", "female"),
|
||||
* bob = new Person("Bob", "male"),
|
||||
* sarah = new Person("Sarah", "female"),
|
||||
* harry = new Person("Harry Potter", "male"),
|
||||
* ashley = new Person("Ashley", "");
|
||||
* var alice = new Person('Alice', 'female'),
|
||||
* bob = new Person('Bob', 'male'),
|
||||
* sarah = new Person('Sarah', 'female'),
|
||||
* harry = new Person('Harry Potter', 'male'),
|
||||
* ashley = new Person('Ashley', '');
|
||||
*
|
||||
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
||||
* .controller('AppController', ['$scope', function($scope) {
|
||||
@@ -157,10 +157,10 @@
|
||||
* this.gender = gender;
|
||||
* }
|
||||
*
|
||||
* var alice = new Person("Alice", "female"),
|
||||
* bob = new Person("Bob", "male"),
|
||||
* harry = new Person("Harry Potter", "male"),
|
||||
* ashley = new Person("Ashley", "");
|
||||
* var alice = new Person('Alice', 'female'),
|
||||
* bob = new Person('Bob', 'male'),
|
||||
* harry = new Person('Harry Potter', 'male'),
|
||||
* ashley = new Person('Ashley', '');
|
||||
*
|
||||
* angular.module('msgFmtExample', ['ngMessageFormat'])
|
||||
* .controller('AppController', ['$scope', function($scope) {
|
||||
@@ -200,7 +200,7 @@ var $$MessageFormatFactory = ['$parse', '$locale', '$sce', '$exceptionHandler',
|
||||
}];
|
||||
|
||||
var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) {
|
||||
if ($interpolate['startSymbol']() !== "{{" || $interpolate['endSymbol']() !== "}}") {
|
||||
if ($interpolate['startSymbol']() !== '{{' || $interpolate['endSymbol']() !== '}}') {
|
||||
throw $interpolateMinErr('nochgmustache', 'angular-message-format.js currently does not allow you to use custom start and end symbols for interpolation.');
|
||||
}
|
||||
var interpolate = $$messageFormat['interpolate'];
|
||||
|
||||
Vendored
+14
-14
@@ -33,7 +33,7 @@ angular.mock.$Browser = function() {
|
||||
var self = this;
|
||||
|
||||
this.isMock = true;
|
||||
self.$$url = "http://server/";
|
||||
self.$$url = 'http://server/';
|
||||
self.$$lastUrl = self.$$url; // used by url polling fn
|
||||
self.pollFns = [];
|
||||
|
||||
@@ -250,14 +250,14 @@ angular.mock.$ExceptionHandlerProvider = function() {
|
||||
} else {
|
||||
errors.push([].slice.call(arguments, 0));
|
||||
}
|
||||
if (mode === "rethrow") {
|
||||
if (mode === 'rethrow') {
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
handler.errors = errors;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unknown mode '" + mode + "', only 'log'/'rethrow' modes are allowed!");
|
||||
throw new Error('Unknown mode \'' + mode + '\', only \'log\'/\'rethrow\' modes are allowed!');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -407,8 +407,8 @@ angular.mock.$LogProvider = function() {
|
||||
});
|
||||
});
|
||||
if (errors.length) {
|
||||
errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or " +
|
||||
"an expected log message was not checked and removed:");
|
||||
errors.unshift('Expected $log to be empty! Either a message was logged unexpectedly, or ' +
|
||||
'an expected log message was not checked and removed:');
|
||||
errors.push('');
|
||||
throw new Error(errors.join('\n---------\n'));
|
||||
}
|
||||
@@ -643,8 +643,8 @@ angular.mock.TzDate = function(offset, timestamp) {
|
||||
if (isNaN(timestamp)) {
|
||||
// eslint-disable-next-line no-throw-literal
|
||||
throw {
|
||||
name: "Illegal Argument",
|
||||
message: "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string"
|
||||
name: 'Illegal Argument',
|
||||
message: 'Arg \'' + tsStr + '\' passed into TzDate constructor is not a valid date string'
|
||||
};
|
||||
}
|
||||
} else {
|
||||
@@ -750,7 +750,7 @@ angular.mock.TzDate = function(offset, timestamp) {
|
||||
|
||||
angular.forEach(unimplementedMethods, function(methodName) {
|
||||
self[methodName] = function() {
|
||||
throw new Error("Method '" + methodName + "' is not implemented in the TzDate mock");
|
||||
throw new Error('Method \'' + methodName + '\' is not implemented in the TzDate mock');
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1909,7 +1909,7 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
||||
|
||||
function assertArgDefined(args, index, name) {
|
||||
if (args.length > index && angular.isUndefined(args[index])) {
|
||||
throw new Error("Undefined argument `" + name + "`; the argument is provided but not defined");
|
||||
throw new Error('Undefined argument `' + name + '`; the argument is provided but not defined');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1989,7 +1989,7 @@ function MockHttpExpectation(method, url, data, headers, keys) {
|
||||
var obj = {}, key_value, key,
|
||||
queryStr = u.indexOf('?') > -1
|
||||
? u.substring(u.indexOf('?') + 1)
|
||||
: "";
|
||||
: '';
|
||||
|
||||
angular.forEach(queryStr.split('&'), function(keyValue) {
|
||||
if (keyValue) {
|
||||
@@ -2879,14 +2879,14 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
|
||||
*/
|
||||
module.sharedInjector = function() {
|
||||
if (!(module.$$beforeAllHook && module.$$afterAllHook)) {
|
||||
throw Error("sharedInjector() cannot be used unless your test runner defines beforeAll/afterAll");
|
||||
throw Error('sharedInjector() cannot be used unless your test runner defines beforeAll/afterAll');
|
||||
}
|
||||
|
||||
var initialized = false;
|
||||
|
||||
module.$$beforeAllHook(/** @this */ function() {
|
||||
if (injectorState.shared) {
|
||||
injectorState.sharedError = Error("sharedInjector() cannot be called inside a context that has already called sharedInjector()");
|
||||
injectorState.sharedError = Error('sharedInjector() cannot be called inside a context that has already called sharedInjector()');
|
||||
throw injectorState.sharedError;
|
||||
}
|
||||
initialized = true;
|
||||
@@ -2908,7 +2908,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
|
||||
if (injectorState.shared && currentSpec && currentSpec !== this) {
|
||||
var state = currentSpec;
|
||||
currentSpec = this;
|
||||
angular.forEach(["$injector","$modules","$providerInjector", "$injectorStrict"], function(k) {
|
||||
angular.forEach(['$injector','$modules','$providerInjector', '$injectorStrict'], function(k) {
|
||||
currentSpec[k] = state[k];
|
||||
state[k] = null;
|
||||
});
|
||||
@@ -3098,7 +3098,7 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
|
||||
if (strictDi) {
|
||||
// If strictDi is enabled, annotate the providerInjector blocks
|
||||
angular.forEach(modules, function(moduleFn) {
|
||||
if (typeof moduleFn === "function") {
|
||||
if (typeof moduleFn === 'function') {
|
||||
angular.injector.$$annotate(moduleFn);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
|
||||
function patchEventTargetForBubbling(event, target) {
|
||||
event._target = target;
|
||||
Object.defineProperty(event, "target", {get: function() { return this._target;}});
|
||||
Object.defineProperty(event, 'target', {get: function() { return this._target;}});
|
||||
}
|
||||
|
||||
function isAttachedToDocument(element) {
|
||||
|
||||
@@ -542,12 +542,12 @@ angular.module('ngResource', ['ng']).
|
||||
var urlParams = self.urlParams = Object.create(null);
|
||||
forEach(url.split(/\W/), function(param) {
|
||||
if (param === 'hasOwnProperty') {
|
||||
throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
|
||||
throw $resourceMinErr('badname', 'hasOwnProperty is not a valid parameter name.');
|
||||
}
|
||||
if (!(new RegExp("^\\d+$").test(param)) && param &&
|
||||
(new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
|
||||
if (!(new RegExp('^\\d+$').test(param)) && param &&
|
||||
(new RegExp('(^|[^\\\\]):' + param + '(\\W|$)').test(url))) {
|
||||
urlParams[param] = {
|
||||
isQueryParamValue: (new RegExp("\\?.*=:" + param + "(?:\\W|$)")).test(url)
|
||||
isQueryParamValue: (new RegExp('\\?.*=:' + param + '(?:\\W|$)')).test(url)
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -566,11 +566,11 @@ angular.module('ngResource', ['ng']).
|
||||
} else {
|
||||
encodedVal = encodeUriSegment(val);
|
||||
}
|
||||
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
|
||||
url = url.replace(new RegExp(':' + urlParam + '(\\W|$)', 'g'), function(match, p1) {
|
||||
return encodedVal + p1;
|
||||
});
|
||||
} else {
|
||||
url = url.replace(new RegExp("(/?):" + urlParam + "(\\W|$)", "g"), function(match,
|
||||
url = url.replace(new RegExp('(/?):' + urlParam + '(\\W|$)', 'g'), function(match,
|
||||
leadingSlashes, tail) {
|
||||
if (tail.charAt(0) === '/') {
|
||||
return tail;
|
||||
@@ -687,7 +687,7 @@ angular.module('ngResource', ['ng']).
|
||||
case 0: break;
|
||||
default:
|
||||
throw $resourceMinErr('badargs',
|
||||
"Expected up to 4 arguments [params, data, success, error], got {0} arguments",
|
||||
'Expected up to 4 arguments [params, data, success, error], got {0} arguments',
|
||||
arguments.length);
|
||||
}
|
||||
|
||||
@@ -744,7 +744,7 @@ angular.module('ngResource', ['ng']).
|
||||
if (action.isArray) {
|
||||
value.length = 0;
|
||||
forEach(data, function(item) {
|
||||
if (typeof item === "object") {
|
||||
if (typeof item === 'object') {
|
||||
value.push(new Resource(item));
|
||||
} else {
|
||||
// Valid JSON values may be string literals, and these should not be converted
|
||||
|
||||
@@ -149,11 +149,11 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
|
||||
this.$routeParams = $routeParams;
|
||||
}])
|
||||
.controller('BookCtrl', ['$routeParams', function BookCtrl($routeParams) {
|
||||
this.name = "BookCtrl";
|
||||
this.name = 'BookCtrl';
|
||||
this.params = $routeParams;
|
||||
}])
|
||||
.controller('ChapterCtrl', ['$routeParams', function ChapterCtrl($routeParams) {
|
||||
this.name = "ChapterCtrl";
|
||||
this.name = 'ChapterCtrl';
|
||||
this.params = $routeParams;
|
||||
}]);
|
||||
|
||||
|
||||
@@ -431,12 +431,12 @@ function $RouteProvider() {
|
||||
* })
|
||||
*
|
||||
* .controller('BookController', function($scope, $routeParams) {
|
||||
* $scope.name = "BookController";
|
||||
* $scope.name = 'BookController';
|
||||
* $scope.params = $routeParams;
|
||||
* })
|
||||
*
|
||||
* .controller('ChapterController', function($scope, $routeParams) {
|
||||
* $scope.name = "ChapterController";
|
||||
* $scope.name = 'ChapterController';
|
||||
* $scope.params = $routeParams;
|
||||
* })
|
||||
*
|
||||
|
||||
+17
-17
@@ -230,36 +230,36 @@ function $SanitizeProvider() {
|
||||
|
||||
// Safe Void Elements - HTML5
|
||||
// http://dev.w3.org/html5/spec/Overview.html#void-elements
|
||||
var voidElements = toMap("area,br,col,hr,img,wbr");
|
||||
var voidElements = toMap('area,br,col,hr,img,wbr');
|
||||
|
||||
// Elements that you can, intentionally, leave open (and which close themselves)
|
||||
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
|
||||
var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
|
||||
optionalEndTagInlineElements = toMap("rp,rt"),
|
||||
var optionalEndTagBlockElements = toMap('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'),
|
||||
optionalEndTagInlineElements = toMap('rp,rt'),
|
||||
optionalEndTagElements = extend({},
|
||||
optionalEndTagInlineElements,
|
||||
optionalEndTagBlockElements);
|
||||
|
||||
// Safe Block Elements - HTML5
|
||||
var blockElements = extend({}, optionalEndTagBlockElements, toMap("address,article," +
|
||||
"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
|
||||
"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul"));
|
||||
var blockElements = extend({}, optionalEndTagBlockElements, toMap('address,article,' +
|
||||
'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
|
||||
'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul'));
|
||||
|
||||
// Inline Elements - HTML5
|
||||
var inlineElements = extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," +
|
||||
"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
|
||||
"samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
|
||||
var inlineElements = extend({}, optionalEndTagInlineElements, toMap('a,abbr,acronym,b,' +
|
||||
'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' +
|
||||
'samp,small,span,strike,strong,sub,sup,time,tt,u,var'));
|
||||
|
||||
// SVG Elements
|
||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
|
||||
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
|
||||
// They can potentially allow for arbitrary javascript to be executed. See #11290
|
||||
var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," +
|
||||
"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
|
||||
"radialGradient,rect,stop,svg,switch,text,title,tspan");
|
||||
var svgElements = toMap('circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,' +
|
||||
'hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,' +
|
||||
'radialGradient,rect,stop,svg,switch,text,title,tspan');
|
||||
|
||||
// Blocked Elements (will be stripped)
|
||||
var blockedElements = toMap("script,style");
|
||||
var blockedElements = toMap('script,style');
|
||||
|
||||
var validElements = extend({},
|
||||
voidElements,
|
||||
@@ -268,7 +268,7 @@ function $SanitizeProvider() {
|
||||
optionalEndTagElements);
|
||||
|
||||
//Attributes that have href and hence need to be sanitized
|
||||
var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href");
|
||||
var uriAttrs = toMap('background,cite,href,longdesc,src,xlink:href');
|
||||
|
||||
var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
|
||||
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
|
||||
@@ -311,9 +311,9 @@ function $SanitizeProvider() {
|
||||
(function(window) {
|
||||
var doc;
|
||||
if (window.document && window.document.implementation) {
|
||||
doc = window.document.implementation.createHTMLDocument("inert");
|
||||
doc = window.document.implementation.createHTMLDocument('inert');
|
||||
} else {
|
||||
throw $sanitizeMinErr('noinert', "Can't create an inert html document");
|
||||
throw $sanitizeMinErr('noinert', 'Can\'t create an inert html document');
|
||||
}
|
||||
var docElement = doc.documentElement || doc.getDocumentElement();
|
||||
var bodyElements = docElement.getElementsByTagName('body');
|
||||
@@ -353,7 +353,7 @@ function $SanitizeProvider() {
|
||||
var mXSSAttempts = 5;
|
||||
do {
|
||||
if (mXSSAttempts === 0) {
|
||||
throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable");
|
||||
throw $sanitizeMinErr('uinput', 'Failed to sanitize html because the input is unstable');
|
||||
}
|
||||
mXSSAttempts--;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorF
|
||||
}).attr('src', url);
|
||||
|
||||
// for IE compatibility set the name *after* setting the frame url
|
||||
frame[0].contentWindow.name = "NG_DEFER_BOOTSTRAP!";
|
||||
frame[0].contentWindow.name = 'NG_DEFER_BOOTSTRAP!';
|
||||
}
|
||||
self.context.find('> h2 a').attr('href', url).text(url);
|
||||
};
|
||||
|
||||
Vendored
+17
-17
@@ -3,7 +3,7 @@
|
||||
(function(previousOnLoad) {
|
||||
var prefix = (function() {
|
||||
var filename = /(.*\/)angular-bootstrap.js(#(.*))?/;
|
||||
var scripts = window.document.getElementsByTagName("script");
|
||||
var scripts = window.document.getElementsByTagName('script');
|
||||
for (var j = 0; j < scripts.length; j++) {
|
||||
var src = scripts[j].src;
|
||||
if (src && src.match(filename)) {
|
||||
@@ -28,28 +28,28 @@
|
||||
angular.scenario.setUpAndRun({});
|
||||
};
|
||||
|
||||
addCSS("../../css/angular-scenario.css");
|
||||
addScript("../../lib/jquery/jquery.js");
|
||||
addCSS('../../css/angular-scenario.css');
|
||||
addScript('../../lib/jquery/jquery.js');
|
||||
window.document.write(
|
||||
'<script type="text/javascript">' +
|
||||
'var _jQuery = jQuery.noConflict(true);' +
|
||||
'</script>'
|
||||
);
|
||||
addScript("../angular-bootstrap.js");
|
||||
addScript('../angular-bootstrap.js');
|
||||
|
||||
addScript("Scenario.js");
|
||||
addScript("Application.js");
|
||||
addScript("Describe.js");
|
||||
addScript("Future.js");
|
||||
addScript("Runner.js");
|
||||
addScript("SpecRunner.js");
|
||||
addScript("dsl.js");
|
||||
addScript("matchers.js");
|
||||
addScript("ObjectModel.js");
|
||||
addScript("output/Html.js");
|
||||
addScript("output/Json.js");
|
||||
addScript("output/Object.js");
|
||||
addScript("output/Xml.js");
|
||||
addScript('Scenario.js');
|
||||
addScript('Application.js');
|
||||
addScript('Describe.js');
|
||||
addScript('Future.js');
|
||||
addScript('Runner.js');
|
||||
addScript('SpecRunner.js');
|
||||
addScript('dsl.js');
|
||||
addScript('matchers.js');
|
||||
addScript('ObjectModel.js');
|
||||
addScript('output/Html.js');
|
||||
addScript('output/Json.js');
|
||||
addScript('output/Object.js');
|
||||
addScript('output/Xml.js');
|
||||
|
||||
// Create the runner (which also sets up the global API)
|
||||
window.document.write(
|
||||
|
||||
+24
-24
@@ -50,7 +50,7 @@ angular.scenario.dsl('browser', function() {
|
||||
|
||||
chain.navigateTo = function(url, delegate) {
|
||||
var application = this.application;
|
||||
return this.addFuture("browser navigate to '" + url + "'", function(done) {
|
||||
return this.addFuture('browser navigate to \'' + url + '\'', function(done) {
|
||||
if (delegate) {
|
||||
url = delegate.call(this, url);
|
||||
}
|
||||
@@ -181,11 +181,11 @@ angular.scenario.dsl('using', function() {
|
||||
*/
|
||||
angular.scenario.dsl('binding', function() {
|
||||
return function(name) {
|
||||
return this.addFutureAction("select binding '" + name + "'",
|
||||
return this.addFutureAction('select binding \'' + name + '\'',
|
||||
function($window, $document, done) {
|
||||
var values = $document.elements().bindings($window.angular.element, name);
|
||||
if (!values.length) {
|
||||
return done("Binding selector '" + name + "' did not match.");
|
||||
return done('Binding selector \'' + name + '\' did not match.');
|
||||
}
|
||||
done(null, values[0]);
|
||||
});
|
||||
@@ -204,7 +204,7 @@ angular.scenario.dsl('input', function() {
|
||||
var supportInputEvent = 'oninput' in window.document.createElement('div') && !msie;
|
||||
|
||||
chain.enter = function(value, event) {
|
||||
return this.addFutureAction("input '" + this.name + "' enter '" + value + "'",
|
||||
return this.addFutureAction('input \'' + this.name + '\' enter \'' + value + '\'',
|
||||
function($window, $document, done) {
|
||||
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
|
||||
input.val(value);
|
||||
@@ -214,7 +214,7 @@ angular.scenario.dsl('input', function() {
|
||||
};
|
||||
|
||||
chain.check = function() {
|
||||
return this.addFutureAction("checkbox '" + this.name + "' toggle",
|
||||
return this.addFutureAction('checkbox \'' + this.name + '\' toggle',
|
||||
function($window, $document, done) {
|
||||
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':checkbox');
|
||||
input.trigger('click');
|
||||
@@ -223,7 +223,7 @@ angular.scenario.dsl('input', function() {
|
||||
};
|
||||
|
||||
chain.select = function(value) {
|
||||
return this.addFutureAction("radio button '" + this.name + "' toggle '" + value + "'",
|
||||
return this.addFutureAction('radio button \'' + this.name + '\' toggle \'' + value + '\'',
|
||||
function($window, $document, done) {
|
||||
var input = $document.
|
||||
elements('[ng\\:model="$1"][value="$2"]', this.name, value).filter(':radio');
|
||||
@@ -233,7 +233,7 @@ angular.scenario.dsl('input', function() {
|
||||
};
|
||||
|
||||
chain.val = function() {
|
||||
return this.addFutureAction("return input val", function($window, $document, done) {
|
||||
return this.addFutureAction('return input val', function($window, $document, done) {
|
||||
var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input');
|
||||
done(null,input.val());
|
||||
});
|
||||
@@ -257,7 +257,7 @@ angular.scenario.dsl('repeater', function() {
|
||||
var chain = {};
|
||||
|
||||
chain.count = function() {
|
||||
return this.addFutureAction("repeater '" + this.label + "' count",
|
||||
return this.addFutureAction('repeater \'' + this.label + '\' count',
|
||||
function($window, $document, done) {
|
||||
try {
|
||||
done(null, $document.elements().length);
|
||||
@@ -268,14 +268,14 @@ angular.scenario.dsl('repeater', function() {
|
||||
};
|
||||
|
||||
chain.column = function(binding) {
|
||||
return this.addFutureAction("repeater '" + this.label + "' column '" + binding + "'",
|
||||
return this.addFutureAction('repeater \'' + this.label + '\' column \'' + binding + '\'',
|
||||
function($window, $document, done) {
|
||||
done(null, $document.elements().bindings($window.angular.element, binding));
|
||||
});
|
||||
};
|
||||
|
||||
chain.row = function(index) {
|
||||
return this.addFutureAction("repeater '" + this.label + "' row '" + index + "'",
|
||||
return this.addFutureAction('repeater \'' + this.label + '\' row \'' + index + '\'',
|
||||
function($window, $document, done) {
|
||||
var matches = $document.elements().slice(index, index + 1);
|
||||
if (!matches.length) {
|
||||
@@ -300,7 +300,7 @@ angular.scenario.dsl('select', function() {
|
||||
var chain = {};
|
||||
|
||||
chain.option = function(value) {
|
||||
return this.addFutureAction("select '" + this.name + "' option '" + value + "'",
|
||||
return this.addFutureAction('select \'' + this.name + '\' option \'' + value + '\'',
|
||||
function($window, $document, done) {
|
||||
var select = $document.elements('select[ng\\:model="$1"]', this.name);
|
||||
var option = select.find('option[value="' + value + '"]');
|
||||
@@ -316,7 +316,7 @@ angular.scenario.dsl('select', function() {
|
||||
if (option.length) {
|
||||
select.val(option.val());
|
||||
} else {
|
||||
return done("option '" + value + "' not found");
|
||||
return done('option \'' + value + '\' not found');
|
||||
}
|
||||
}
|
||||
select.trigger('change');
|
||||
@@ -326,7 +326,7 @@ angular.scenario.dsl('select', function() {
|
||||
|
||||
chain.options = function() {
|
||||
var values = arguments;
|
||||
return this.addFutureAction("select '" + this.name + "' options '" + values + "'",
|
||||
return this.addFutureAction('select \'' + this.name + '\' options \'' + values + '\'',
|
||||
function($window, $document, done) {
|
||||
var select = $document.elements('select[multiple][ng\\:model="$1"]', this.name);
|
||||
select.val(values);
|
||||
@@ -363,7 +363,7 @@ angular.scenario.dsl('element', function() {
|
||||
var chain = {};
|
||||
|
||||
chain.count = function() {
|
||||
return this.addFutureAction("element '" + this.label + "' count",
|
||||
return this.addFutureAction('element \'' + this.label + '\' count',
|
||||
function($window, $document, done) {
|
||||
try {
|
||||
done(null, $document.elements().length);
|
||||
@@ -374,7 +374,7 @@ angular.scenario.dsl('element', function() {
|
||||
};
|
||||
|
||||
chain.click = function() {
|
||||
return this.addFutureAction("element '" + this.label + "' click",
|
||||
return this.addFutureAction('element \'' + this.label + '\' click',
|
||||
function($window, $document, done) {
|
||||
var elements = $document.elements();
|
||||
var href = elements.attr('href');
|
||||
@@ -391,7 +391,7 @@ angular.scenario.dsl('element', function() {
|
||||
};
|
||||
|
||||
chain.dblclick = function() {
|
||||
return this.addFutureAction("element '" + this.label + "' dblclick",
|
||||
return this.addFutureAction('element \'' + this.label + '\' dblclick',
|
||||
function($window, $document, done) {
|
||||
var elements = $document.elements();
|
||||
var href = elements.attr('href');
|
||||
@@ -408,7 +408,7 @@ angular.scenario.dsl('element', function() {
|
||||
};
|
||||
|
||||
chain.mouseover = function() {
|
||||
return this.addFutureAction("element '" + this.label + "' mouseover",
|
||||
return this.addFutureAction('element \'' + this.label + '\' mouseover',
|
||||
function($window, $document, done) {
|
||||
var elements = $document.elements();
|
||||
elements.trigger('mouseover');
|
||||
@@ -417,7 +417,7 @@ angular.scenario.dsl('element', function() {
|
||||
};
|
||||
|
||||
chain.mousedown = function() {
|
||||
return this.addFutureAction("element '" + this.label + "' mousedown",
|
||||
return this.addFutureAction('element \'' + this.label + '\' mousedown',
|
||||
function($window, $document, done) {
|
||||
var elements = $document.elements();
|
||||
elements.trigger('mousedown');
|
||||
@@ -426,7 +426,7 @@ angular.scenario.dsl('element', function() {
|
||||
};
|
||||
|
||||
chain.mouseup = function() {
|
||||
return this.addFutureAction("element '" + this.label + "' mouseup",
|
||||
return this.addFutureAction('element \'' + this.label + '\' mouseup',
|
||||
function($window, $document, done) {
|
||||
var elements = $document.elements();
|
||||
elements.trigger('mouseup');
|
||||
@@ -445,9 +445,9 @@ angular.scenario.dsl('element', function() {
|
||||
chain[methodName] = function(name, value) {
|
||||
var args = arguments,
|
||||
futureName = (args.length === 1)
|
||||
? "element '" + this.label + "' get " + methodName + " '" + name + "'"
|
||||
: "element '" + this.label + "' set " + methodName + " '" + name + "' to '" +
|
||||
value + "'";
|
||||
? 'element \'' + this.label + '\' get ' + methodName + ' \'' + name + '\''
|
||||
: 'element \'' + this.label + '\' set ' + methodName + ' \'' + name + '\' to \'' +
|
||||
value + '\'';
|
||||
|
||||
return this.addFutureAction(futureName, function($window, $document, done) {
|
||||
var element = $document.elements();
|
||||
@@ -460,8 +460,8 @@ angular.scenario.dsl('element', function() {
|
||||
chain[methodName] = function(value) {
|
||||
var args = arguments,
|
||||
futureName = (args.length === 0)
|
||||
? "element '" + this.label + "' " + methodName
|
||||
: "element '" + this.label + "' set " + methodName + " to '" + value + "'";
|
||||
? 'element \'' + this.label + '\' ' + methodName
|
||||
: 'element \'' + this.label + '\' set ' + methodName + ' to \'' + value + '\'';
|
||||
|
||||
return this.addFutureAction(futureName, function($window, $document, done) {
|
||||
var element = $document.elements();
|
||||
|
||||
@@ -76,7 +76,7 @@ angular.scenario.output('html', function(context, runner, model) {
|
||||
spec = model.getSpec(spec.id);
|
||||
ui.removeClass('status-pending');
|
||||
ui.addClass('status-' + spec.status);
|
||||
ui.find("> .test-info .timer-result").text(spec.duration + "ms");
|
||||
ui.find('> .test-info .timer-result').text(spec.duration + 'ms');
|
||||
if (spec.status === 'success') {
|
||||
ui.find('> .test-info .test-name').addClass('closed');
|
||||
ui.find('> .scrollpane .test-actions').hide();
|
||||
|
||||
+98
-98
@@ -25,15 +25,15 @@ describe('angular', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("copy", function() {
|
||||
it("should return same object", function() {
|
||||
describe('copy', function() {
|
||||
it('should return same object', function() {
|
||||
var obj = {};
|
||||
var arr = [];
|
||||
expect(copy({}, obj)).toBe(obj);
|
||||
expect(copy([], arr)).toBe(arr);
|
||||
});
|
||||
|
||||
it("should preserve prototype chaining", function() {
|
||||
it('should preserve prototype chaining', function() {
|
||||
var GrandParentProto = {};
|
||||
var ParentProto = Object.create(GrandParentProto);
|
||||
var obj = Object.create(ParentProto);
|
||||
@@ -43,51 +43,51 @@ describe('angular', function() {
|
||||
expect(copy(new Foo()) instanceof Foo).toBe(true);
|
||||
});
|
||||
|
||||
it("should copy Date", function() {
|
||||
it('should copy Date', function() {
|
||||
var date = new Date(123);
|
||||
expect(copy(date) instanceof Date).toBeTruthy();
|
||||
expect(copy(date).getTime()).toEqual(123);
|
||||
expect(copy(date) === date).toBeFalsy();
|
||||
});
|
||||
|
||||
it("should copy RegExp", function() {
|
||||
var re = new RegExp(".*");
|
||||
it('should copy RegExp', function() {
|
||||
var re = new RegExp('.*');
|
||||
expect(copy(re) instanceof RegExp).toBeTruthy();
|
||||
expect(copy(re).source).toBe(".*");
|
||||
expect(copy(re).source).toBe('.*');
|
||||
expect(copy(re) === re).toBe(false);
|
||||
});
|
||||
|
||||
it("should copy literal RegExp", function() {
|
||||
it('should copy literal RegExp', function() {
|
||||
var re = /.*/;
|
||||
expect(copy(re) instanceof RegExp).toBeTruthy();
|
||||
expect(copy(re).source).toEqual(".*");
|
||||
expect(copy(re).source).toEqual('.*');
|
||||
expect(copy(re) === re).toBeFalsy();
|
||||
});
|
||||
|
||||
it("should copy RegExp with flags", function() {
|
||||
it('should copy RegExp with flags', function() {
|
||||
var re = new RegExp('.*', 'gim');
|
||||
expect(copy(re).global).toBe(true);
|
||||
expect(copy(re).ignoreCase).toBe(true);
|
||||
expect(copy(re).multiline).toBe(true);
|
||||
});
|
||||
|
||||
it("should copy RegExp with lastIndex", function() {
|
||||
it('should copy RegExp with lastIndex', function() {
|
||||
var re = /a+b+/g;
|
||||
var str = 'ab aabb';
|
||||
expect(re.exec(str)[0]).toEqual('ab');
|
||||
expect(copy(re).exec(str)[0]).toEqual('aabb');
|
||||
});
|
||||
|
||||
it("should deeply copy literal RegExp", function() {
|
||||
it('should deeply copy literal RegExp', function() {
|
||||
var objWithRegExp = {
|
||||
re: /.*/
|
||||
};
|
||||
expect(copy(objWithRegExp).re instanceof RegExp).toBeTruthy();
|
||||
expect(copy(objWithRegExp).re.source).toEqual(".*");
|
||||
expect(copy(objWithRegExp).re.source).toEqual('.*');
|
||||
expect(copy(objWithRegExp.re) === objWithRegExp.re).toBeFalsy();
|
||||
});
|
||||
|
||||
it("should copy a Uint8Array with no destination", function() {
|
||||
it('should copy a Uint8Array with no destination', function() {
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
var src = new Uint8Array(2);
|
||||
src[1] = 1;
|
||||
@@ -99,7 +99,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Uint8ClampedArray with no destination", function() {
|
||||
it('should copy a Uint8ClampedArray with no destination', function() {
|
||||
if (typeof Uint8ClampedArray !== 'undefined') {
|
||||
var src = new Uint8ClampedArray(2);
|
||||
src[1] = 1;
|
||||
@@ -111,7 +111,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Uint16Array with no destination", function() {
|
||||
it('should copy a Uint16Array with no destination', function() {
|
||||
if (typeof Uint16Array !== 'undefined') {
|
||||
var src = new Uint16Array(2);
|
||||
src[1] = 1;
|
||||
@@ -123,7 +123,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Uint32Array with no destination", function() {
|
||||
it('should copy a Uint32Array with no destination', function() {
|
||||
if (typeof Uint32Array !== 'undefined') {
|
||||
var src = new Uint32Array(2);
|
||||
src[1] = 1;
|
||||
@@ -135,7 +135,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Int8Array with no destination", function() {
|
||||
it('should copy a Int8Array with no destination', function() {
|
||||
if (typeof Int8Array !== 'undefined') {
|
||||
var src = new Int8Array(2);
|
||||
src[1] = 1;
|
||||
@@ -147,7 +147,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Int16Array with no destination", function() {
|
||||
it('should copy a Int16Array with no destination', function() {
|
||||
if (typeof Int16Array !== 'undefined') {
|
||||
var src = new Int16Array(2);
|
||||
src[1] = 1;
|
||||
@@ -159,7 +159,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Int32Array with no destination", function() {
|
||||
it('should copy a Int32Array with no destination', function() {
|
||||
if (typeof Int32Array !== 'undefined') {
|
||||
var src = new Int32Array(2);
|
||||
src[1] = 1;
|
||||
@@ -171,7 +171,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Float32Array with no destination", function() {
|
||||
it('should copy a Float32Array with no destination', function() {
|
||||
if (typeof Float32Array !== 'undefined') {
|
||||
var src = new Float32Array(2);
|
||||
src[1] = 1;
|
||||
@@ -183,7 +183,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should copy a Float64Array with no destination", function() {
|
||||
it('should copy a Float64Array with no destination', function() {
|
||||
if (typeof Float64Array !== 'undefined') {
|
||||
var src = new Float64Array(2);
|
||||
src[1] = 1;
|
||||
@@ -249,7 +249,7 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should handle Uint16Array subarray", function() {
|
||||
it('should handle Uint16Array subarray', function() {
|
||||
if (typeof Uint16Array !== 'undefined') {
|
||||
var arr = new Uint16Array(4);
|
||||
arr[1] = 1;
|
||||
@@ -263,109 +263,109 @@ describe('angular', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Uint8Array is the destination", function() {
|
||||
it('should throw an exception if a Uint8Array is the destination', function() {
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
var src = new Uint8Array();
|
||||
var dst = new Uint8Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Uint8ClampedArray is the destination", function() {
|
||||
it('should throw an exception if a Uint8ClampedArray is the destination', function() {
|
||||
if (typeof Uint8ClampedArray !== 'undefined') {
|
||||
var src = new Uint8ClampedArray();
|
||||
var dst = new Uint8ClampedArray(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Uint16Array is the destination", function() {
|
||||
it('should throw an exception if a Uint16Array is the destination', function() {
|
||||
if (typeof Uint16Array !== 'undefined') {
|
||||
var src = new Uint16Array();
|
||||
var dst = new Uint16Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Uint32Array is the destination", function() {
|
||||
it('should throw an exception if a Uint32Array is the destination', function() {
|
||||
if (typeof Uint32Array !== 'undefined') {
|
||||
var src = new Uint32Array();
|
||||
var dst = new Uint32Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Int8Array is the destination", function() {
|
||||
it('should throw an exception if a Int8Array is the destination', function() {
|
||||
if (typeof Int8Array !== 'undefined') {
|
||||
var src = new Int8Array();
|
||||
var dst = new Int8Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Int16Array is the destination", function() {
|
||||
it('should throw an exception if a Int16Array is the destination', function() {
|
||||
if (typeof Int16Array !== 'undefined') {
|
||||
var src = new Int16Array();
|
||||
var dst = new Int16Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Int32Array is the destination", function() {
|
||||
it('should throw an exception if a Int32Array is the destination', function() {
|
||||
if (typeof Int32Array !== 'undefined') {
|
||||
var src = new Int32Array();
|
||||
var dst = new Int32Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Float32Array is the destination", function() {
|
||||
it('should throw an exception if a Float32Array is the destination', function() {
|
||||
if (typeof Float32Array !== 'undefined') {
|
||||
var src = new Float32Array();
|
||||
var dst = new Float32Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if a Float64Array is the destination", function() {
|
||||
it('should throw an exception if a Float64Array is the destination', function() {
|
||||
if (typeof Float64Array !== 'undefined') {
|
||||
var src = new Float64Array();
|
||||
var dst = new Float64Array(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should throw an exception if an ArrayBuffer is the destination", function() {
|
||||
it('should throw an exception if an ArrayBuffer is the destination', function() {
|
||||
if (typeof ArrayBuffer !== 'undefined') {
|
||||
var src = new ArrayBuffer(5);
|
||||
var dst = new ArrayBuffer(5);
|
||||
expect(function() { copy(src, dst); })
|
||||
.toThrowMinErr("ng", "cpta", "Can't copy! TypedArray destination cannot be mutated.");
|
||||
.toThrowMinErr('ng', 'cpta', 'Can\'t copy! TypedArray destination cannot be mutated.');
|
||||
}
|
||||
});
|
||||
|
||||
it("should deeply copy an array into an existing array", function() {
|
||||
var src = [1, {name:"value"}];
|
||||
var dst = [{key:"v"}];
|
||||
it('should deeply copy an array into an existing array', function() {
|
||||
var src = [1, {name:'value'}];
|
||||
var dst = [{key:'v'}];
|
||||
expect(copy(src, dst)).toBe(dst);
|
||||
expect(dst).toEqual([1, {name:"value"}]);
|
||||
expect(dst[1]).toEqual({name:"value"});
|
||||
expect(dst).toEqual([1, {name:'value'}]);
|
||||
expect(dst[1]).toEqual({name:'value'});
|
||||
expect(dst[1]).not.toBe(src[1]);
|
||||
});
|
||||
|
||||
it("should deeply copy an array into a new array", function() {
|
||||
var src = [1, {name:"value"}];
|
||||
it('should deeply copy an array into a new array', function() {
|
||||
var src = [1, {name:'value'}];
|
||||
var dst = copy(src);
|
||||
expect(src).toEqual([1, {name:"value"}]);
|
||||
expect(src).toEqual([1, {name:'value'}]);
|
||||
expect(dst).toEqual(src);
|
||||
expect(dst).not.toBe(src);
|
||||
expect(dst[1]).not.toBe(src[1]);
|
||||
@@ -373,31 +373,31 @@ describe('angular', function() {
|
||||
|
||||
it('should copy empty array', function() {
|
||||
var src = [];
|
||||
var dst = [{key: "v"}];
|
||||
var dst = [{key: 'v'}];
|
||||
expect(copy(src, dst)).toEqual([]);
|
||||
expect(dst).toEqual([]);
|
||||
});
|
||||
|
||||
it("should deeply copy an object into an existing object", function() {
|
||||
var src = {a:{name:"value"}};
|
||||
var dst = {b:{key:"v"}};
|
||||
it('should deeply copy an object into an existing object', function() {
|
||||
var src = {a:{name:'value'}};
|
||||
var dst = {b:{key:'v'}};
|
||||
expect(copy(src, dst)).toBe(dst);
|
||||
expect(dst).toEqual({a:{name:"value"}});
|
||||
expect(dst).toEqual({a:{name:'value'}});
|
||||
expect(dst.a).toEqual(src.a);
|
||||
expect(dst.a).not.toBe(src.a);
|
||||
});
|
||||
|
||||
it("should deeply copy an object into a non-existing object", function() {
|
||||
var src = {a:{name:"value"}};
|
||||
it('should deeply copy an object into a non-existing object', function() {
|
||||
var src = {a:{name:'value'}};
|
||||
var dst = copy(src, undefined);
|
||||
expect(src).toEqual({a:{name:"value"}});
|
||||
expect(src).toEqual({a:{name:'value'}});
|
||||
expect(dst).toEqual(src);
|
||||
expect(dst).not.toBe(src);
|
||||
expect(dst.a).toEqual(src.a);
|
||||
expect(dst.a).not.toBe(src.a);
|
||||
});
|
||||
|
||||
it("should copy primitives", function() {
|
||||
it('should copy primitives', function() {
|
||||
expect(copy(null)).toEqual(null);
|
||||
expect(copy('')).toBe('');
|
||||
expect(copy('lala')).toBe('lala');
|
||||
@@ -407,28 +407,28 @@ describe('angular', function() {
|
||||
|
||||
it('should throw an exception if a Scope is being copied', inject(function($rootScope) {
|
||||
expect(function() { copy($rootScope.$new()); }).
|
||||
toThrowMinErr("ng", "cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
toThrowMinErr('ng', 'cpws', 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
expect(function() { copy({child: $rootScope.$new()}, {}); }).
|
||||
toThrowMinErr("ng", "cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
toThrowMinErr('ng', 'cpws', 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
expect(function() { copy([$rootScope.$new()]); }).
|
||||
toThrowMinErr("ng", "cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
toThrowMinErr('ng', 'cpws', 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
}));
|
||||
|
||||
it('should throw an exception if a Window is being copied', function() {
|
||||
expect(function() { copy(window); }).
|
||||
toThrowMinErr("ng", "cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
toThrowMinErr('ng', 'cpws', 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
expect(function() { copy({child: window}); }).
|
||||
toThrowMinErr("ng", "cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
toThrowMinErr('ng', 'cpws', 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
expect(function() { copy([window], []); }).
|
||||
toThrowMinErr("ng", "cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
|
||||
toThrowMinErr('ng', 'cpws', 'Can\'t copy! Making copies of Window or Scope instances is not supported.');
|
||||
});
|
||||
|
||||
it('should throw an exception when source and destination are equivalent', function() {
|
||||
var src, dst;
|
||||
src = dst = {key: 'value'};
|
||||
expect(function() { copy(src, dst); }).toThrowMinErr("ng", "cpi", "Can't copy! Source and destination are identical.");
|
||||
expect(function() { copy(src, dst); }).toThrowMinErr('ng', 'cpi', 'Can\'t copy! Source and destination are identical.');
|
||||
src = dst = [2, 4];
|
||||
expect(function() { copy(src, dst); }).toThrowMinErr("ng", "cpi", "Can't copy! Source and destination are identical.");
|
||||
expect(function() { copy(src, dst); }).toThrowMinErr('ng', 'cpi', 'Can\'t copy! Source and destination are identical.');
|
||||
});
|
||||
|
||||
it('should not copy the private $$hashKey', function() {
|
||||
@@ -604,7 +604,7 @@ describe('angular', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe("extend", function() {
|
||||
describe('extend', function() {
|
||||
|
||||
it('should not copy the private $$hashKey', function() {
|
||||
var src,dst;
|
||||
@@ -669,7 +669,7 @@ describe('angular', function() {
|
||||
|
||||
it('should copy elements by reference', function() {
|
||||
var src = { element: document.createElement('div'),
|
||||
jqObject: jqLite("<p><span>s1</span><span>s2</span></p>").find("span") };
|
||||
jqObject: jqLite('<p><span>s1</span><span>s2</span></p>').find('span') };
|
||||
var dst = {};
|
||||
|
||||
extend(dst, src);
|
||||
@@ -697,13 +697,13 @@ describe('angular', function() {
|
||||
|
||||
|
||||
it('should replace primitives with objects', function() {
|
||||
var dst = { foo: "bloop" };
|
||||
var src = { foo: { bar: { baz: "bloop" }}};
|
||||
var dst = { foo: 'bloop' };
|
||||
var src = { foo: { bar: { baz: 'bloop' }}};
|
||||
merge(dst, src);
|
||||
expect(dst).toEqual({
|
||||
foo: {
|
||||
bar: {
|
||||
baz: "bloop"
|
||||
baz: 'bloop'
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -712,12 +712,12 @@ describe('angular', function() {
|
||||
|
||||
it('should replace null values in destination with objects', function() {
|
||||
var dst = { foo: null };
|
||||
var src = { foo: { bar: { baz: "bloop" }}};
|
||||
var src = { foo: { bar: { baz: 'bloop' }}};
|
||||
merge(dst, src);
|
||||
expect(dst).toEqual({
|
||||
foo: {
|
||||
bar: {
|
||||
baz: "bloop"
|
||||
baz: 'bloop'
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1237,7 +1237,7 @@ describe('angular', function() {
|
||||
});
|
||||
|
||||
it('should return true if passed an object', function() {
|
||||
expect(isArrayLike({0:"test", 1:"bob", 2:"tree", length:3})).toBe(true);
|
||||
expect(isArrayLike({0:'test', 1:'bob', 2:'tree', length:3})).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true if passed arguments object', function() {
|
||||
@@ -1316,21 +1316,21 @@ describe('angular', function() {
|
||||
|
||||
|
||||
it('should handle JQLite and jQuery objects like arrays', function() {
|
||||
var jqObject = jqLite("<p><span>s1</span><span>s2</span></p>").find("span"),
|
||||
var jqObject = jqLite('<p><span>s1</span><span>s2</span></p>').find('span'),
|
||||
log = [];
|
||||
|
||||
forEach(jqObject, function(value, key) { log.push(key + ':' + value.innerHTML); });
|
||||
expect(log).toEqual(['0:s1', '1:s2']);
|
||||
|
||||
log = [];
|
||||
jqObject = jqLite("<pane></pane>");
|
||||
jqObject = jqLite('<pane></pane>');
|
||||
forEach(jqObject.children(), function(value, key) { log.push(key + ':' + value.innerHTML); });
|
||||
expect(log).toEqual([]);
|
||||
});
|
||||
|
||||
|
||||
it('should handle NodeList objects like arrays', function() {
|
||||
var nodeList = jqLite("<p><span>a</span><span>b</span><span>c</span></p>")[0].childNodes,
|
||||
var nodeList = jqLite('<p><span>a</span><span>b</span><span>c</span></p>')[0].childNodes,
|
||||
log = [];
|
||||
|
||||
|
||||
@@ -1340,11 +1340,11 @@ describe('angular', function() {
|
||||
|
||||
|
||||
it('should handle HTMLCollection objects like arrays', function() {
|
||||
document.body.innerHTML = "<p>" +
|
||||
"<a name='x'>a</a>" +
|
||||
"<a name='y'>b</a>" +
|
||||
"<a name='x'>c</a>" +
|
||||
"</p>";
|
||||
document.body.innerHTML = '<p>' +
|
||||
'<a name=\'x\'>a</a>' +
|
||||
'<a name=\'y\'>b</a>' +
|
||||
'<a name=\'x\'>c</a>' +
|
||||
'</p>';
|
||||
|
||||
var htmlCollection = document.getElementsByName('x'),
|
||||
log = [];
|
||||
@@ -1478,22 +1478,22 @@ describe('angular', function() {
|
||||
|
||||
|
||||
it('should follow the ES spec when called with jQuery/jqLite', function() {
|
||||
testForEachSpec(2, jqLite("<span>a</span><span>b</span>"));
|
||||
testForEachSpec(2, jqLite('<span>a</span><span>b</span>'));
|
||||
});
|
||||
|
||||
|
||||
it('should follow the ES spec when called with childNodes NodeList', function() {
|
||||
testForEachSpec(2, jqLite("<p><span>a</span><span>b</span></p>")[0].childNodes);
|
||||
testForEachSpec(2, jqLite('<p><span>a</span><span>b</span></p>')[0].childNodes);
|
||||
});
|
||||
|
||||
|
||||
it('should follow the ES spec when called with getElementsByTagName HTMLCollection', function() {
|
||||
testForEachSpec(2, jqLite("<p><span>a</span><span>b</span></p>")[0].getElementsByTagName("*"));
|
||||
testForEachSpec(2, jqLite('<p><span>a</span><span>b</span></p>')[0].getElementsByTagName('*'));
|
||||
});
|
||||
|
||||
|
||||
it('should follow the ES spec when called with querySelectorAll HTMLCollection', function() {
|
||||
testForEachSpec(2, jqLite("<p><span>a</span><span>b</span></p>")[0].querySelectorAll("*"));
|
||||
testForEachSpec(2, jqLite('<p><span>a</span><span>b</span></p>')[0].querySelectorAll('*'));
|
||||
});
|
||||
|
||||
|
||||
@@ -1520,8 +1520,8 @@ describe('angular', function() {
|
||||
toEqual('asdf1234asdf');
|
||||
|
||||
//don't encode unreserved'
|
||||
expect(encodeUriSegment("-_.!~*'(); -_.!~*'();")).
|
||||
toEqual("-_.!~*'();%20-_.!~*'();");
|
||||
expect(encodeUriSegment('-_.!~*\'(); -_.!~*\'();')).
|
||||
toEqual('-_.!~*\'();%20-_.!~*\'();');
|
||||
|
||||
//don't encode the rest of pchar'
|
||||
expect(encodeUriSegment(':@&=+$, :@&=+$,')).
|
||||
@@ -1542,8 +1542,8 @@ describe('angular', function() {
|
||||
toEqual('asdf1234asdf');
|
||||
|
||||
//don't encode unreserved
|
||||
expect(encodeUriQuery("-_.!~*'() -_.!~*'()")).
|
||||
toEqual("-_.!~*'()+-_.!~*'()");
|
||||
expect(encodeUriQuery('-_.!~*\'() -_.!~*\'()')).
|
||||
toEqual('-_.!~*\'()+-_.!~*\'()');
|
||||
|
||||
//don't encode the rest of pchar
|
||||
expect(encodeUriQuery(':@$, :@$,')).
|
||||
@@ -1842,9 +1842,9 @@ describe('angular', function() {
|
||||
it('version should have full/major/minor/dot/codeName properties', function() {
|
||||
expect(version).toBeDefined();
|
||||
expect(version.full).toBe('"NG_VERSION_FULL"');
|
||||
expect(version.major).toBe("NG_VERSION_MAJOR");
|
||||
expect(version.minor).toBe("NG_VERSION_MINOR");
|
||||
expect(version.dot).toBe("NG_VERSION_DOT");
|
||||
expect(version.major).toBe('NG_VERSION_MAJOR');
|
||||
expect(version.minor).toBe('NG_VERSION_MINOR');
|
||||
expect(version.dot).toBe('NG_VERSION_DOT');
|
||||
expect(version.codeName).toBe('"NG_VERSION_CODENAME"');
|
||||
});
|
||||
});
|
||||
@@ -1858,7 +1858,7 @@ describe('angular', function() {
|
||||
dealoc(element);
|
||||
});
|
||||
|
||||
it("should complain if app module can't be found", function() {
|
||||
it('should complain if app module can\'t be found', function() {
|
||||
var element = jqLite('<div>{{1+2}}</div>');
|
||||
|
||||
expect(function() {
|
||||
@@ -1903,7 +1903,7 @@ describe('angular', function() {
|
||||
window.name = 'NG_DEFER_BOOTSTRAP!';
|
||||
|
||||
angular.resumeDeferredBootstrap = noop;
|
||||
var spy = spyOn(angular, "resumeDeferredBootstrap");
|
||||
var spy = spyOn(angular, 'resumeDeferredBootstrap');
|
||||
injector = angular.bootstrap(element);
|
||||
expect(spy).toHaveBeenCalled();
|
||||
});
|
||||
@@ -2065,7 +2065,7 @@ describe('angular', function() {
|
||||
var element = $compile('<p>Hello, world!</p>')($rootScope),
|
||||
body = $document.find('body')[0],
|
||||
expected = [false, false, false, false, false, false, false, true, true],
|
||||
tests = [null, undefined, "string", 1001, {}, 0, false, body, element];
|
||||
tests = [null, undefined, 'string', 1001, {}, 0, false, body, element];
|
||||
angular.forEach(tests, function(value, idx) {
|
||||
var result = angular.isElement(value);
|
||||
expect(typeof result).toEqual('boolean');
|
||||
|
||||
+7
-7
@@ -62,7 +62,7 @@ describe('Binder', function() {
|
||||
}));
|
||||
|
||||
it('InputTypeButtonActionExecutesInScope2', inject(function($rootScope, $compile) {
|
||||
var log = "";
|
||||
var log = '';
|
||||
element = $compile('<input type="image" ng-click="action()">')($rootScope);
|
||||
$rootScope.action = function() {
|
||||
log += 'click;';
|
||||
@@ -359,11 +359,11 @@ describe('Binder', function() {
|
||||
|
||||
it('ShoulIgnoreVbNonBindable', inject(function($rootScope, $compile) {
|
||||
element = $compile(
|
||||
"<div>{{a}}" +
|
||||
"<div ng-non-bindable>{{a}}</div>" +
|
||||
"<div ng-non-bindable=''>{{b}}</div>" +
|
||||
"<div ng-non-bindable='true'>{{c}}</div>" +
|
||||
"</div>")($rootScope);
|
||||
'<div>{{a}}' +
|
||||
'<div ng-non-bindable>{{a}}</div>' +
|
||||
'<div ng-non-bindable=\'\'>{{b}}</div>' +
|
||||
'<div ng-non-bindable=\'true\'>{{c}}</div>' +
|
||||
'</div>')($rootScope);
|
||||
$rootScope.a = 123;
|
||||
$rootScope.$apply();
|
||||
expect(element.text()).toBe('123{{a}}{{b}}{{c}}');
|
||||
@@ -371,7 +371,7 @@ describe('Binder', function() {
|
||||
|
||||
it('ShouldTemplateBindPreElements', inject(function($rootScope, $compile) {
|
||||
element = $compile('<pre>Hello {{name}}!</pre>')($rootScope);
|
||||
$rootScope.name = "World";
|
||||
$rootScope.name = 'World';
|
||||
$rootScope.$apply();
|
||||
|
||||
expect(sortedHtml(element)).toBe('<pre>Hello World!</pre>');
|
||||
|
||||
+14
-14
@@ -20,7 +20,7 @@ describe('injector', function() {
|
||||
}));
|
||||
|
||||
|
||||
it("should return same instance from calling provider", function() {
|
||||
it('should return same instance from calling provider', function() {
|
||||
var instance = {},
|
||||
original = instance;
|
||||
providers('instance', function() { return instance; });
|
||||
@@ -80,14 +80,14 @@ describe('injector', function() {
|
||||
it('should provide useful message if no provider', function() {
|
||||
expect(function() {
|
||||
injector.get('idontexist');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: idontexistProvider <- idontexist');
|
||||
});
|
||||
|
||||
|
||||
it('should provide the caller name if given', function() {
|
||||
expect(function() {
|
||||
injector.get('idontexist', 'callerName');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist <- callerName");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: idontexistProvider <- idontexist <- callerName');
|
||||
});
|
||||
|
||||
|
||||
@@ -96,18 +96,18 @@ describe('injector', function() {
|
||||
var $controller = injector.get('$controller');
|
||||
expect(function() {
|
||||
$controller('myCtrl', {$scope: {}});
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist <- myCtrl");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: idontexistProvider <- idontexist <- myCtrl');
|
||||
});
|
||||
|
||||
|
||||
it('should not corrupt the cache when an object fails to get instantiated', function() {
|
||||
expect(function() {
|
||||
injector.get('idontexist');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: idontexistProvider <- idontexist');
|
||||
|
||||
expect(function() {
|
||||
injector.get('idontexist');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: idontexistProvider <- idontexist');
|
||||
});
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ describe('injector', function() {
|
||||
providers('b', function(a) {return 2;});
|
||||
expect(function() {
|
||||
injector.get('b');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist <- a <- b");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: idontexistProvider <- idontexist <- a <- b');
|
||||
});
|
||||
|
||||
|
||||
@@ -147,13 +147,13 @@ describe('injector', function() {
|
||||
|
||||
it('should call function', function() {
|
||||
Fn.$inject = ['a', 'b', 'c', 'd'];
|
||||
injector.invoke(Fn, {name:"this"}, {c:3, d:4});
|
||||
injector.invoke(Fn, {name:'this'}, {c:3, d:4});
|
||||
expect(args).toEqual([{name:'this'}, 1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
|
||||
it('should treat array as annotations', function() {
|
||||
injector.invoke(['a', 'b', 'c', 'd', Fn], {name:"this"}, {c:3, d:4});
|
||||
injector.invoke(['a', 'b', 'c', 'd', Fn], {name:'this'}, {c:3, d:4});
|
||||
expect(args).toEqual([{name:'this'}, 1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
@@ -168,10 +168,10 @@ describe('injector', function() {
|
||||
it('should fail with errors if not function or array', function() {
|
||||
expect(function() {
|
||||
injector.invoke({});
|
||||
}).toThrowMinErr("ng", "areq", "Argument 'fn' is not a function, got Object");
|
||||
}).toThrowMinErr('ng', 'areq', 'Argument \'fn\' is not a function, got Object');
|
||||
expect(function() {
|
||||
injector.invoke(['a', 123], {});
|
||||
}).toThrowMinErr("ng", "areq", "Argument 'fn' is not a function, got number");
|
||||
}).toThrowMinErr('ng', 'areq', 'Argument \'fn\' is not a function, got number');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -947,7 +947,7 @@ describe('injector', function() {
|
||||
it('should throw usefull error on wrong argument type]', function() {
|
||||
expect(function() {
|
||||
$injector.invoke({});
|
||||
}).toThrowMinErr("ng", "areq", "Argument 'fn' is not a function, got Object");
|
||||
}).toThrowMinErr('ng', 'areq', 'Argument \'fn\' is not a function, got Object');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1044,7 +1044,7 @@ describe('injector', function() {
|
||||
}]);
|
||||
expect(function() {
|
||||
$injector.get('nameProvider');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: nameProviderProvider <- nameProvider");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: nameProviderProvider <- nameProvider');
|
||||
});
|
||||
|
||||
|
||||
@@ -1052,7 +1052,7 @@ describe('injector', function() {
|
||||
var $injector = createInjector([]);
|
||||
expect(function() {
|
||||
$injector.get('$provide').value('a', 'b');
|
||||
}).toThrowMinErr("$injector", "unpr", "Unknown provider: $provideProvider <- $provide");
|
||||
}).toThrowMinErr('$injector', 'unpr', 'Unknown provider: $provideProvider <- $provide');
|
||||
});
|
||||
|
||||
|
||||
|
||||
+16
-16
@@ -19,9 +19,9 @@ beforeEach(function() {
|
||||
});
|
||||
|
||||
var message = function() {
|
||||
return "Expected to have " + presentClasses +
|
||||
(absentClasses ? (" and not have " + absentClasses + "") : "") +
|
||||
" but had " + element[0].className + ".";
|
||||
return 'Expected to have ' + presentClasses +
|
||||
(absentClasses ? (' and not have ' + absentClasses + '') : '') +
|
||||
' but had ' + element[0].className + '.';
|
||||
};
|
||||
return {
|
||||
pass: present && !absent,
|
||||
@@ -60,7 +60,7 @@ beforeEach(function() {
|
||||
function generateCompare(isNot) {
|
||||
return function(actual) {
|
||||
var message = valueFn(
|
||||
"Expected object " + (isNot ? "not " : "") + "to be a promise");
|
||||
'Expected object ' + (isNot ? 'not ' : '') + 'to be a promise');
|
||||
return { pass: isPromiseLike(actual), message: message };
|
||||
};
|
||||
}
|
||||
@@ -72,7 +72,7 @@ beforeEach(function() {
|
||||
};
|
||||
function generateCompare(isNot) {
|
||||
return function(actual) {
|
||||
var message = valueFn("Expected element " + (isNot ? "" : "not ") + "to have 'ng-hide' class");
|
||||
var message = valueFn('Expected element ' + (isNot ? '' : 'not ') + 'to have \'ng-hide\' class');
|
||||
var pass = !isNgElementHidden(actual);
|
||||
if (isNot) {
|
||||
pass = !pass;
|
||||
@@ -88,7 +88,7 @@ beforeEach(function() {
|
||||
};
|
||||
function generateCompare(isNot) {
|
||||
return function(actual) {
|
||||
var message = valueFn("Expected element " + (isNot ? "not " : "") + "to have 'ng-hide' class");
|
||||
var message = valueFn('Expected element ' + (isNot ? 'not ' : '') + 'to have \'ng-hide\' class');
|
||||
var pass = isNgElementHidden(actual);
|
||||
if (isNot) {
|
||||
pass = !pass;
|
||||
@@ -235,13 +235,13 @@ beforeEach(function() {
|
||||
};
|
||||
function hasClass(element, selector) {
|
||||
if (!element.getAttribute) return false;
|
||||
return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
|
||||
indexOf(" " + selector + " ") > -1);
|
||||
return ((' ' + (element.getAttribute('class') || '') + ' ').replace(/[\n\t]/g, ' ').
|
||||
indexOf(' ' + selector + ' ') > -1);
|
||||
}
|
||||
function generateCompare(isNot) {
|
||||
return function(actual, clazz) {
|
||||
var message = function() {
|
||||
return "Expected '" + angular.mock.dump(actual) + "'" + (isNot ? " not " : "") + " to have class '" + clazz + "'.";
|
||||
return 'Expected \'' + angular.mock.dump(actual) + '\'' + (isNot ? ' not ' : '') + ' to have class \'' + clazz + '\'.';
|
||||
};
|
||||
var classes = clazz.trim().split(/\s+/);
|
||||
for (var i = 0; i < classes.length; ++i) {
|
||||
@@ -268,11 +268,11 @@ 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, '\\$&');
|
||||
},
|
||||
codeRegex = new RegExp('^\\[' + escapeRegexp(namespace) + ':' + escapeRegexp(code) + '\\]'),
|
||||
not = isNot ? "not " : "",
|
||||
regex = jasmine.isA_("RegExp", content) ? content :
|
||||
not = isNot ? 'not ' : '',
|
||||
regex = jasmine.isA_('RegExp', content) ? content :
|
||||
angular.isDefined(content) ? new RegExp(escapeRegexp(content)) : undefined;
|
||||
|
||||
if (!angular.isFunction(actual)) {
|
||||
@@ -290,10 +290,10 @@ beforeEach(function() {
|
||||
}
|
||||
|
||||
var message = function() {
|
||||
return "Expected function " + not + "to throw " +
|
||||
namespace + "MinErr('" + code + "')" +
|
||||
(regex ? " matching " + regex.toString() : "") +
|
||||
(exception ? ", but it threw " + exceptionMessage : ".");
|
||||
return 'Expected function ' + not + 'to throw ' +
|
||||
namespace + 'MinErr(\'' + code + '\')' +
|
||||
(regex ? ' matching ' + regex.toString() : '') +
|
||||
(exception ? ', but it threw ' + exceptionMessage : '.');
|
||||
};
|
||||
|
||||
result = codeRegex.test(exceptionMessage);
|
||||
|
||||
@@ -156,15 +156,15 @@ function jqLiteCacheSize() {
|
||||
* @param {boolean=} showNgClass
|
||||
*/
|
||||
function sortedHtml(element, showNgClass) {
|
||||
var html = "";
|
||||
var html = '';
|
||||
forEach(jqLite(element), function toString(node) {
|
||||
|
||||
if (node.nodeName === "#text") {
|
||||
if (node.nodeName === '#text') {
|
||||
html += node.nodeValue.
|
||||
replace(/&(\w+[&;\W])?/g, function(match, entity) {return entity ? match : '&';}).
|
||||
replace(/</g, '<').
|
||||
replace(/>/g, '>');
|
||||
} else if (node.nodeName === "#comment") {
|
||||
} else if (node.nodeName === '#comment') {
|
||||
html += '<!--' + node.nodeValue + '-->';
|
||||
} else {
|
||||
html += '<' + (node.nodeName || '?NOT_A_NODE?').toLowerCase();
|
||||
|
||||
+19
-19
@@ -20,7 +20,7 @@ describe('jqLite', function() {
|
||||
toJqEqual: function() {
|
||||
return {
|
||||
compare: function(_actual_, expected) {
|
||||
var msg = "Unequal length";
|
||||
var msg = 'Unequal length';
|
||||
var message = function() {return msg;};
|
||||
|
||||
var value = _actual_ && expected && _actual_.length === expected.length;
|
||||
@@ -28,9 +28,9 @@ describe('jqLite', function() {
|
||||
var actual = jqLite(_actual_[i])[0];
|
||||
var expect = jqLite(expected[i])[0];
|
||||
value = value && equals(expect, actual);
|
||||
msg = "Not equal at index: " + i
|
||||
+ " - Expected: " + expect
|
||||
+ " - Actual: " + actual;
|
||||
msg = 'Not equal at index: ' + i
|
||||
+ ' - Expected: ' + expect
|
||||
+ ' - Actual: ' + actual;
|
||||
}
|
||||
return { pass: value, message: message };
|
||||
}
|
||||
@@ -230,9 +230,9 @@ describe('jqLite', function() {
|
||||
frag = document.createDocumentFragment(),
|
||||
$frag = jqLite(frag);
|
||||
frag.host = host[0];
|
||||
host.data("foo", 123);
|
||||
host.data('foo', 123);
|
||||
host.append($frag);
|
||||
expect($frag.inheritedData("foo")).toBe(123);
|
||||
expect($frag.inheritedData('foo')).toBe(123);
|
||||
|
||||
dealoc(host);
|
||||
dealoc($frag);
|
||||
@@ -438,24 +438,24 @@ describe('jqLite', function() {
|
||||
var node = document.createElement('div');
|
||||
|
||||
expect(jqLite.hasData(node)).toBe(false);
|
||||
expect(jqLite.data(node, "foo")).toBeUndefined();
|
||||
expect(jqLite.data(node, 'foo')).toBeUndefined();
|
||||
expect(jqLite.hasData(node)).toBe(false);
|
||||
|
||||
jqLite.data(node, "foo", "bar");
|
||||
jqLite.data(node, 'foo', 'bar');
|
||||
|
||||
expect(jqLite.hasData(node)).toBe(true);
|
||||
expect(jqLite.data(node, "foo")).toBe("bar");
|
||||
expect(jqLite(node).data("foo")).toBe("bar");
|
||||
expect(jqLite.data(node, 'foo')).toBe('bar');
|
||||
expect(jqLite(node).data('foo')).toBe('bar');
|
||||
|
||||
expect(jqLite.data(node)).toBe(jqLite(node).data());
|
||||
|
||||
jqLite.removeData(node, "foo");
|
||||
expect(jqLite.data(node, "foo")).toBeUndefined();
|
||||
jqLite.removeData(node, 'foo');
|
||||
expect(jqLite.data(node, 'foo')).toBeUndefined();
|
||||
|
||||
jqLite.data(node, "bar", "baz");
|
||||
jqLite.data(node, 'bar', 'baz');
|
||||
jqLite.removeData(node);
|
||||
jqLite.removeData(node);
|
||||
expect(jqLite.data(node, "bar")).toBeUndefined();
|
||||
expect(jqLite.data(node, 'bar')).toBeUndefined();
|
||||
|
||||
jqLite(node).remove();
|
||||
expect(jqLite.hasData(node)).toBe(false);
|
||||
@@ -1857,7 +1857,7 @@ describe('jqLite', function() {
|
||||
it('should wrap text node', function() {
|
||||
var root = jqLite('<div>A<a>B</a>C</div>');
|
||||
var text = root.contents();
|
||||
expect(text.wrap("<span>")[0]).toBe(text[0]);
|
||||
expect(text.wrap('<span>')[0]).toBe(text[0]);
|
||||
expect(root.find('span').text()).toEqual('A<a>B</a>C');
|
||||
});
|
||||
it('should wrap free text node', function() {
|
||||
@@ -1866,7 +1866,7 @@ describe('jqLite', function() {
|
||||
text.remove();
|
||||
expect(root.text()).toBe('');
|
||||
|
||||
text.wrap("<span>");
|
||||
text.wrap('<span>');
|
||||
expect(text.parent().text()).toEqual('A<a>B</a>C');
|
||||
});
|
||||
it('should clone elements to be wrapped around target', function() {
|
||||
@@ -2084,9 +2084,9 @@ describe('jqLite', function() {
|
||||
|
||||
element.on('click', pokeSpy);
|
||||
|
||||
element.triggerHandler('click', [{hello: "world"}]);
|
||||
element.triggerHandler('click', [{hello: 'world'}]);
|
||||
data = pokeSpy.calls.mostRecent().args[1];
|
||||
expect(data.hello).toBe("world");
|
||||
expect(data.hello).toBe('world');
|
||||
});
|
||||
|
||||
it('should mark event as prevented if preventDefault is called', function() {
|
||||
@@ -2122,7 +2122,7 @@ describe('jqLite', function() {
|
||||
expect(clickSpy).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("should accept a custom event instead of eventName", function() {
|
||||
it('should accept a custom event instead of eventName', function() {
|
||||
var element = jqLite('<a>poke</a>'),
|
||||
pokeSpy = jasmine.createSpy('poke'),
|
||||
customEvent = {
|
||||
|
||||
+7
-7
@@ -66,7 +66,7 @@ describe('module loader', function() {
|
||||
});
|
||||
|
||||
|
||||
it("should not throw error when `module.decorator` is declared before provider that it decorates", function() {
|
||||
it('should not throw error when `module.decorator` is declared before provider that it decorates', function() {
|
||||
angular.module('theModule', []).
|
||||
decorator('theProvider', function($delegate) { return $delegate; }).
|
||||
factory('theProvider', function() { return {}; });
|
||||
@@ -77,7 +77,7 @@ describe('module loader', function() {
|
||||
});
|
||||
|
||||
|
||||
it("should run decorators in order of declaration, even when mixed with provider.decorator", function() {
|
||||
it('should run decorators in order of declaration, even when mixed with provider.decorator', function() {
|
||||
var log = '';
|
||||
|
||||
angular.module('theModule', [])
|
||||
@@ -107,7 +107,7 @@ describe('module loader', function() {
|
||||
});
|
||||
|
||||
|
||||
it("should decorate the last declared provider if multiple have been declared", function() {
|
||||
it('should decorate the last declared provider if multiple have been declared', function() {
|
||||
var log = '';
|
||||
|
||||
angular.module('theModule', []).
|
||||
@@ -142,15 +142,15 @@ describe('module loader', function() {
|
||||
it('should complain of no module', function() {
|
||||
expect(function() {
|
||||
window.angular.module('dontExist');
|
||||
}).toThrowMinErr("$injector", "nomod", "Module 'dontExist' is not available! You either misspelled the module name " +
|
||||
"or forgot to load it. If registering a module ensure that you specify the dependencies as the second " +
|
||||
"argument.");
|
||||
}).toThrowMinErr('$injector', 'nomod', 'Module \'dontExist\' is not available! You either misspelled the module name ' +
|
||||
'or forgot to load it. If registering a module ensure that you specify the dependencies as the second ' +
|
||||
'argument.');
|
||||
});
|
||||
|
||||
it('should complain if a module is called "hasOwnProperty', function() {
|
||||
expect(function() {
|
||||
window.angular.module('hasOwnProperty', []);
|
||||
}).toThrowMinErr('ng','badname', "hasOwnProperty is not a valid module name");
|
||||
}).toThrowMinErr('ng','badname', 'hasOwnProperty is not a valid module name');
|
||||
});
|
||||
|
||||
it('should expose `$$minErr` on the `angular` object', function() {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ describe('minErr', function() {
|
||||
|
||||
function someFn() {
|
||||
function nestedFn() {
|
||||
myError = testError('fail', "I fail!");
|
||||
myError = testError('fail', 'I fail!');
|
||||
}
|
||||
nestedFn();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
// When running the modules test, then the page should not be bootstrapped.
|
||||
window.name = "NG_DEFER_BOOTSTRAP!";
|
||||
window.name = 'NG_DEFER_BOOTSTRAP!';
|
||||
|
||||
+15
-15
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
describe("$animateCss", function() {
|
||||
describe('$animateCss', function() {
|
||||
|
||||
var triggerRAF, element;
|
||||
beforeEach(inject(function($$rAF, $rootElement, $document) {
|
||||
@@ -14,9 +14,9 @@ describe("$animateCss", function() {
|
||||
body.append($rootElement);
|
||||
}));
|
||||
|
||||
describe("without animation", function() {
|
||||
describe('without animation', function() {
|
||||
|
||||
it("should not alter the provided options input in any way", inject(function($animateCss) {
|
||||
it('should not alter the provided options input in any way', inject(function($animateCss) {
|
||||
var initialOptions = {
|
||||
from: { height: '50px' },
|
||||
to: { width: '50px' },
|
||||
@@ -31,7 +31,7 @@ describe("$animateCss", function() {
|
||||
expect(copiedOptions).toEqual(initialOptions);
|
||||
}));
|
||||
|
||||
it("should not create a copy of the provided options if they have already been prepared earlier",
|
||||
it('should not create a copy of the provided options if they have already been prepared earlier',
|
||||
inject(function($animateCss, $$rAF) {
|
||||
|
||||
var options = {
|
||||
@@ -53,26 +53,26 @@ describe("$animateCss", function() {
|
||||
expect(options.from).toBeFalsy();
|
||||
}));
|
||||
|
||||
it("should apply the provided [from] CSS to the element", inject(function($animateCss) {
|
||||
it('should apply the provided [from] CSS to the element', inject(function($animateCss) {
|
||||
$animateCss(element, { from: { height: '50px' }}).start();
|
||||
expect(element.css('height')).toBe('50px');
|
||||
}));
|
||||
|
||||
it("should apply the provided [to] CSS to the element after the first frame", inject(function($animateCss) {
|
||||
it('should apply the provided [to] CSS to the element after the first frame', inject(function($animateCss) {
|
||||
$animateCss(element, { to: { width: '50px' }}).start();
|
||||
expect(element.css('width')).not.toBe('50px');
|
||||
triggerRAF();
|
||||
expect(element.css('width')).toBe('50px');
|
||||
}));
|
||||
|
||||
it("should apply the provided [addClass] CSS classes to the element after the first frame", inject(function($animateCss) {
|
||||
it('should apply the provided [addClass] CSS classes to the element after the first frame', inject(function($animateCss) {
|
||||
$animateCss(element, { addClass: 'golden man' }).start();
|
||||
expect(element).not.toHaveClass('golden man');
|
||||
triggerRAF();
|
||||
expect(element).toHaveClass('golden man');
|
||||
}));
|
||||
|
||||
it("should apply the provided [removeClass] CSS classes to the element after the first frame", inject(function($animateCss) {
|
||||
it('should apply the provided [removeClass] CSS classes to the element after the first frame', inject(function($animateCss) {
|
||||
element.addClass('silver');
|
||||
$animateCss(element, { removeClass: 'silver dude' }).start();
|
||||
expect(element).toHaveClass('silver');
|
||||
@@ -80,17 +80,17 @@ describe("$animateCss", function() {
|
||||
expect(element).not.toHaveClass('silver');
|
||||
}));
|
||||
|
||||
it("should return an animator with a start method which returns a promise", inject(function($animateCss) {
|
||||
it('should return an animator with a start method which returns a promise', inject(function($animateCss) {
|
||||
var promise = $animateCss(element, { addClass: 'cool' }).start();
|
||||
expect(isPromiseLike(promise)).toBe(true);
|
||||
}));
|
||||
|
||||
it("should return an animator with an end method which returns a promise", inject(function($animateCss) {
|
||||
it('should return an animator with an end method which returns a promise', inject(function($animateCss) {
|
||||
var promise = $animateCss(element, { addClass: 'cool' }).end();
|
||||
expect(isPromiseLike(promise)).toBe(true);
|
||||
}));
|
||||
|
||||
it("should only resolve the promise once both a digest and RAF have passed after start",
|
||||
it('should only resolve the promise once both a digest and RAF have passed after start',
|
||||
inject(function($animateCss, $rootScope) {
|
||||
|
||||
var doneSpy = jasmine.createSpy();
|
||||
@@ -106,7 +106,7 @@ describe("$animateCss", function() {
|
||||
expect(doneSpy).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("should resolve immediately if runner.end() is called",
|
||||
it('should resolve immediately if runner.end() is called',
|
||||
inject(function($animateCss, $rootScope) {
|
||||
|
||||
var doneSpy = jasmine.createSpy();
|
||||
@@ -120,7 +120,7 @@ describe("$animateCss", function() {
|
||||
expect(doneSpy).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("should reject immediately if runner.end() is called",
|
||||
it('should reject immediately if runner.end() is called',
|
||||
inject(function($animateCss, $rootScope) {
|
||||
|
||||
var cancelSpy = jasmine.createSpy();
|
||||
@@ -134,7 +134,7 @@ describe("$animateCss", function() {
|
||||
expect(cancelSpy).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("should not resolve after the next frame if the runner has already been cancelled",
|
||||
it('should not resolve after the next frame if the runner has already been cancelled',
|
||||
inject(function($animateCss, $rootScope) {
|
||||
|
||||
var doneSpy = jasmine.createSpy();
|
||||
@@ -153,7 +153,7 @@ describe("$animateCss", function() {
|
||||
expect(doneSpy).not.toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("should not bother applying the provided [from] and [to] styles to the element if [cleanupStyles] is present",
|
||||
it('should not bother applying the provided [from] and [to] styles to the element if [cleanupStyles] is present',
|
||||
inject(function($animateCss, $rootScope) {
|
||||
|
||||
var animator = $animateCss(element, {
|
||||
|
||||
@@ -29,8 +29,8 @@ describe('$$animateAsyncRun', function() {
|
||||
}));
|
||||
});
|
||||
|
||||
describe("$$AnimateRunner", function() {
|
||||
they("should trigger the host $prop function",
|
||||
describe('$$AnimateRunner', function() {
|
||||
they('should trigger the host $prop function',
|
||||
['end', 'cancel', 'pause', 'resume'], function(method) {
|
||||
|
||||
inject(function($$AnimateRunner) {
|
||||
@@ -42,7 +42,7 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
they("should trigger the inner runner's host $prop function",
|
||||
they('should trigger the inner runner\'s host $prop function',
|
||||
['end', 'cancel', 'pause', 'resume'], function(method) {
|
||||
|
||||
inject(function($$AnimateRunner) {
|
||||
@@ -56,7 +56,7 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
it("should resolve the done function only if one RAF has passed",
|
||||
it('should resolve the done function only if one RAF has passed',
|
||||
inject(function($$AnimateRunner, $$rAF) {
|
||||
|
||||
var runner = new $$AnimateRunner();
|
||||
@@ -68,7 +68,7 @@ describe("$$AnimateRunner", function() {
|
||||
expect(spy).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it("should resolve with the status provided in the completion function",
|
||||
it('should resolve with the status provided in the completion function',
|
||||
inject(function($$AnimateRunner, $$rAF) {
|
||||
|
||||
var runner = new $$AnimateRunner();
|
||||
@@ -81,7 +81,7 @@ describe("$$AnimateRunner", function() {
|
||||
expect(capturedValue).toBe('special value');
|
||||
}));
|
||||
|
||||
they("should immediately resolve each combined runner in a bottom-up order when $prop is called",
|
||||
they('should immediately resolve each combined runner in a bottom-up order when $prop is called',
|
||||
['end', 'cancel'], function(method) {
|
||||
|
||||
inject(function($$AnimateRunner) {
|
||||
@@ -109,7 +109,7 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
they("should resolve/reject using a newly created promise when .then() is used upon $prop",
|
||||
they('should resolve/reject using a newly created promise when .then() is used upon $prop',
|
||||
['end', 'cancel'], function(method) {
|
||||
|
||||
inject(function($$AnimateRunner, $rootScope) {
|
||||
@@ -140,14 +140,14 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
it("should expose/create the contained promise when getPromise() is called",
|
||||
it('should expose/create the contained promise when getPromise() is called',
|
||||
inject(function($$AnimateRunner, $rootScope) {
|
||||
|
||||
var runner = new $$AnimateRunner();
|
||||
expect(isPromiseLike(runner.getPromise())).toBeTruthy();
|
||||
}));
|
||||
|
||||
it("should expose the `catch` promise function to handle the rejected state",
|
||||
it('should expose the `catch` promise function to handle the rejected state',
|
||||
inject(function($$AnimateRunner, $rootScope) {
|
||||
|
||||
var runner = new $$AnimateRunner();
|
||||
@@ -160,7 +160,7 @@ describe("$$AnimateRunner", function() {
|
||||
expect(animationFailed).toBe(true);
|
||||
}));
|
||||
|
||||
it("should use timeouts to trigger async operations when the document is hidden", function() {
|
||||
it('should use timeouts to trigger async operations when the document is hidden', function() {
|
||||
var hidden = true;
|
||||
|
||||
module(function($provide) {
|
||||
@@ -196,7 +196,7 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
they("should expose the `finally` promise function to handle the final state when $prop",
|
||||
they('should expose the `finally` promise function to handle the final state when $prop',
|
||||
{ 'rejected': 'cancel', 'resolved': 'end' }, function(method) {
|
||||
inject(function($$AnimateRunner, $rootScope) {
|
||||
var runner = new $$AnimateRunner();
|
||||
@@ -210,8 +210,8 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe(".all()", function() {
|
||||
it("should resolve when all runners have naturally resolved",
|
||||
describe('.all()', function() {
|
||||
it('should resolve when all runners have naturally resolved',
|
||||
inject(function($$rAF, $$AnimateRunner) {
|
||||
|
||||
var runner1 = new $$AnimateRunner();
|
||||
@@ -234,7 +234,7 @@ describe("$$AnimateRunner", function() {
|
||||
expect(status).toBe(true);
|
||||
}));
|
||||
|
||||
they("should immediately resolve if and when all runners have been $prop",
|
||||
they('should immediately resolve if and when all runners have been $prop',
|
||||
{ ended: 'end', cancelled: 'cancel' }, function(method) {
|
||||
|
||||
inject(function($$AnimateRunner) {
|
||||
@@ -257,7 +257,7 @@ describe("$$AnimateRunner", function() {
|
||||
});
|
||||
});
|
||||
|
||||
it("should return a status of `false` if one or more runners was cancelled",
|
||||
it('should return a status of `false` if one or more runners was cancelled',
|
||||
inject(function($$AnimateRunner) {
|
||||
|
||||
var runner1 = new $$AnimateRunner();
|
||||
@@ -277,8 +277,8 @@ describe("$$AnimateRunner", function() {
|
||||
}));
|
||||
});
|
||||
|
||||
describe(".chain()", function() {
|
||||
it("should evaluate an array of functions in a chain",
|
||||
describe('.chain()', function() {
|
||||
it('should evaluate an array of functions in a chain',
|
||||
inject(function($$rAF, $$AnimateRunner) {
|
||||
|
||||
var runner1 = new $$AnimateRunner();
|
||||
@@ -329,7 +329,7 @@ describe("$$AnimateRunner", function() {
|
||||
expect(status).toBe(true);
|
||||
}));
|
||||
|
||||
it("should break the chian when a function evaluates to false",
|
||||
it('should break the chian when a function evaluates to false',
|
||||
inject(function($$rAF, $$AnimateRunner) {
|
||||
|
||||
var runner1 = new $$AnimateRunner();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user