From 9360aa2d27fd4b35c377ecff3eea2a656ecf7114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski?= Date: Wed, 10 Aug 2016 12:13:14 +0200 Subject: [PATCH] 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 --- .eslintrc-base.json | 1 + .eslintrc-todo.json | 3 +- Gruntfile.js | 2 +- angularFiles.js | 2 +- benchmarks/ng-options-bp/app.js | 2 +- benchmarks/orderby-bp/bp.conf.js | 4 +- benchmarks/select-ng-value-bp/app.js | 2 +- changelog.js | 2 +- docs/app/e2e/api-docs/api-pages.scenario.js | 8 +- .../e2e/api-docs/provider-pages.scenario.js | 4 +- .../e2e/api-docs/service-pages.scenario.js | 6 +- docs/app/e2e/app.scenario.js | 4 +- docs/app/src/docs.js | 2 +- docs/app/src/examples.js | 8 +- docs/app/test/directivesSpec.js | 2 +- docs/app/test/docsSpec.js | 6 +- docs/config/index.js | 2 +- docs/config/processors/index-page.js | 2 +- docs/config/processors/keywords.js | 2 +- docs/config/processors/versions-data.js | 2 +- docs/config/services/deployments/debug.js | 2 +- docs/config/services/deployments/default.js | 2 +- docs/config/services/deployments/jquery.js | 2 +- .../config/services/deployments/production.js | 4 +- docs/config/services/errorNamespaceMap.js | 2 +- docs/config/services/getMinerrInfo.js | 2 +- docs/config/services/getVersion.js | 2 +- docs/content/guide/$location.ngdoc | 12 +- docs/content/guide/concepts.ngdoc | 6 +- docs/content/guide/controller.ngdoc | 2 +- docs/content/guide/filter.ngdoc | 2 +- docs/content/guide/i18n.ngdoc | 8 +- docs/content/guide/services.ngdoc | 2 +- docs/gulpfile.js | 10 +- gdocs.js | 20 +- i18n/e2e/i18n-e2e.js | 38 +- i18n/spec/closureI18nExtractorSpec.js | 246 +++++----- i18n/spec/converterSpec.js | 4 +- i18n/spec/parserSpec.js | 4 +- i18n/src/closureI18nExtractor.js | 10 +- i18n/src/closureSlurper.js | 6 +- karma-shared.conf.js | 8 +- lib/grunt/utils.js | 18 +- lib/grunt/validate-angular-files.js | 2 +- lib/versions/version-info.js | 4 +- scripts/npm/clean-shrinkwrap.js | 2 +- src/Angular.js | 22 +- src/AngularPublic.js | 6 +- src/auto/injector.js | 8 +- src/jqLite.js | 26 +- src/loader.js | 6 +- src/ng/animate.js | 4 +- src/ng/browser.js | 2 +- src/ng/cacheFactory.js | 2 +- src/ng/compile.js | 58 +-- src/ng/controller.js | 6 +- src/ng/directive/attrs.js | 6 +- src/ng/directive/ngController.js | 4 +- src/ng/directive/ngModel.js | 4 +- src/ng/directive/ngOptions.js | 6 +- src/ng/directive/ngPluralize.js | 2 +- src/ng/directive/ngRepeat.js | 8 +- src/ng/directive/ngTransclude.js | 2 +- src/ng/filter/filters.js | 4 +- src/ng/http.js | 2 +- src/ng/httpBackend.js | 12 +- src/ng/interpolate.js | 8 +- src/ng/location.js | 2 +- src/ng/parse.js | 16 +- src/ng/q.js | 8 +- src/ng/sce.js | 8 +- src/ng/urlUtils.js | 4 +- src/ngAnimate/animateCss.js | 6 +- src/ngAnimate/module.js | 20 +- src/ngAnimate/shared.js | 2 +- src/ngCookies/cookieWriter.js | 6 +- src/ngMessageFormat/messageFormatParser.js | 38 +- src/ngMessageFormat/messageFormatSelector.js | 8 +- src/ngMessageFormat/messageFormatService.js | 26 +- src/ngMock/angular-mocks.js | 28 +- src/ngMock/browserTrigger.js | 2 +- src/ngResource/resource.js | 16 +- src/ngRoute/directive/ngView.js | 4 +- src/ngRoute/route.js | 4 +- src/ngSanitize/sanitize.js | 34 +- src/ngScenario/Application.js | 2 +- src/ngScenario/angular-bootstrap.js | 36 +- src/ngScenario/dsl.js | 48 +- src/ngScenario/output/Html.js | 2 +- test/AngularSpec.js | 196 ++++---- test/BinderSpec.js | 14 +- test/auto/injectorSpec.js | 28 +- test/helpers/matchers.js | 32 +- test/helpers/testabilityPatch.js | 6 +- test/jqLiteSpec.js | 38 +- test/loaderSpec.js | 14 +- test/minErrSpec.js | 2 +- test/modules/no_bootstrap.js | 2 +- test/ng/animateCssSpec.js | 30 +- test/ng/animateRunnerSpec.js | 36 +- test/ng/animateSpec.js | 44 +- test/ng/browserSpecs.js | 8 +- test/ng/cacheFactorySpec.js | 4 +- test/ng/compileSpec.js | 268 +++++------ test/ng/controllerSpec.js | 34 +- test/ng/cookieReaderSpec.js | 16 +- test/ng/directive/booleanAttrsSpec.js | 10 +- test/ng/directive/formSpec.js | 4 +- test/ng/directive/inputSpec.js | 124 ++--- test/ng/directive/ngBindSpec.js | 2 +- test/ng/directive/ngClassSpec.js | 16 +- test/ng/directive/ngIncludeSpec.js | 6 +- test/ng/directive/ngInitSpec.js | 6 +- test/ng/directive/ngListSpec.js | 10 +- test/ng/directive/ngModelSpec.js | 12 +- test/ng/directive/ngNonBindableSpec.js | 8 +- test/ng/directive/ngOptionsSpec.js | 2 +- test/ng/directive/ngPluralizeSpec.js | 128 +++--- test/ng/directive/ngRepeatSpec.js | 26 +- test/ng/directive/ngSrcSpec.js | 28 +- test/ng/directive/ngSwitchSpec.js | 6 +- test/ng/directive/selectSpec.js | 22 +- test/ng/directive/validatorsSpec.js | 16 +- test/ng/documentSpec.js | 2 +- test/ng/filter/filterSpec.js | 6 +- test/ng/filter/filtersSpec.js | 130 +++--- test/ng/filter/limitToSpec.js | 56 +-- test/ng/filter/orderBySpec.js | 24 +- test/ng/httpBackendSpec.js | 22 +- test/ng/httpSpec.js | 6 +- test/ng/interpolateSpec.js | 58 +-- test/ng/intervalSpec.js | 10 +- test/ng/locationSpec.js | 26 +- test/ng/logSpec.js | 10 +- test/ng/parseSpec.js | 430 +++++++++--------- test/ng/qSpec.js | 82 ++-- test/ng/rafSpec.js | 2 +- test/ng/rootScopeSpec.js | 36 +- test/ng/sanitizeUriSpec.js | 92 ++-- test/ng/sceSpecs.js | 28 +- test/ng/timeoutSpec.js | 10 +- test/ng/urlUtilsSpec.js | 10 +- test/ng/windowSpec.js | 2 +- test/ngAnimate/animateCssDriverSpec.js | 70 +-- test/ngAnimate/animateCssSpec.js | 224 ++++----- test/ngAnimate/animateJsDriverSpec.js | 2 +- test/ngAnimate/animateJsSpec.js | 30 +- test/ngAnimate/animateSpec.js | 14 +- .../ngAnimate/animationHelperFunctionsSpec.js | 2 +- test/ngAnimate/animationSpec.js | 44 +- test/ngAnimate/integrationSpec.js | 6 +- test/ngAnimate/ngAnimateSwapSpec.js | 4 +- test/ngAnimate/rafSchedulerSpec.js | 2 +- test/ngAria/ariaSpec.js | 82 ++-- test/ngCookies/cookieWriterSpec.js | 18 +- test/ngCookies/cookiesSpec.js | 8 +- test/ngMessageFormat/messageFormatSpec.js | 190 ++++---- test/ngMessages/messagesSpec.js | 34 +- test/ngMock/angular-mocksSpec.js | 144 +++--- test/ngResource/resourceSpec.js | 38 +- test/ngRoute/directive/ngViewSpec.js | 2 +- test/ngRoute/routeSpec.js | 4 +- test/ngSanitize/filter/linkySpec.js | 28 +- test/ngSanitize/sanitizeSpec.js | 4 +- test/ngScenario/ApplicationSpec.js | 8 +- test/ngScenario/RunnerSpec.js | 2 +- test/ngScenario/ScenarioSpec.js | 8 +- test/ngScenario/dslSpec.js | 4 +- test/ngScenario/e2e/widgets-scenario.js | 8 +- test/ngScenario/matchersSpec.js | 2 +- test/ngScenario/output/HtmlSpec.js | 2 +- validate-commit-msg.spec.js | 2 +- 172 files changed, 2119 insertions(+), 2111 deletions(-) diff --git a/.eslintrc-base.json b/.eslintrc-base.json index a22993a7761f..ee3a411bb2d7 100644 --- a/.eslintrc-base.json +++ b/.eslintrc-base.json @@ -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"], diff --git a/.eslintrc-todo.json b/.eslintrc-todo.json index a80e6722b527..7e89110084b7 100644 --- a/.eslintrc-todo.json +++ b/.eslintrc-todo.json @@ -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" }}] } } diff --git a/Gruntfile.js b/Gruntfile.js index bf4b1470d621..5b31c8ea24be 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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'] } diff --git a/angularFiles.js b/angularFiles.js index cde1a9c1eccb..4769808ad391 100755 --- a/angularFiles.js +++ b/angularFiles.js @@ -209,7 +209,7 @@ var angularFiles = { 'build/docs/docs-scenario.js' ], - "karmaModules": [ + 'karmaModules': [ 'build/angular.js', '@angularSrcModules', 'test/modules/no_bootstrap.js', diff --git a/benchmarks/ng-options-bp/app.js b/benchmarks/ng-options-bp/app.js index 2447b8738241..01b70009bf4a 100755 --- a/benchmarks/ng-options-bp/app.js +++ b/benchmarks/ng-options-bp/app.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* globals angular, benchmarkSteps */ diff --git a/benchmarks/orderby-bp/bp.conf.js b/benchmarks/orderby-bp/bp.conf.js index 5fe179be8623..95e53709338f 100644 --- a/benchmarks/orderby-bp/bp.conf.js +++ b/benchmarks/orderby-bp/bp.conf.js @@ -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' diff --git a/benchmarks/select-ng-value-bp/app.js b/benchmarks/select-ng-value-bp/app.js index ef53b3c00c94..de19c14c6a26 100755 --- a/benchmarks/select-ng-value-bp/app.js +++ b/benchmarks/select-ng-value-bp/app.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /* globals angular, benchmarkSteps */ diff --git a/changelog.js b/changelog.js index e33bb20747ed..ccaae08d9df3 100755 --- a/changelog.js +++ b/changelog.js @@ -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: [] }); diff --git a/docs/app/e2e/api-docs/api-pages.scenario.js b/docs/app/e2e/api-docs/api-pages.scenario.js index f30e4d1cffa7..f6f296fd759a 100644 --- a/docs/app/e2e/api-docs/api-pages.scenario.js +++ b/docs/app/e2e/api-docs/api-pages.scenario.js @@ -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')); diff --git a/docs/app/e2e/api-docs/provider-pages.scenario.js b/docs/app/e2e/api-docs/provider-pages.scenario.js index b83af4614d18..c0d5e95976f9 100644 --- a/docs/app/e2e/api-docs/provider-pages.scenario.js +++ b/docs/app/e2e/api-docs/provider-pages.scenario.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'); diff --git a/docs/app/e2e/api-docs/service-pages.scenario.js b/docs/app/e2e/api-docs/service-pages.scenario.js index b63c7320e5c8..8b55169cf6d9 100644 --- a/docs/app/e2e/api-docs/service-pages.scenario.js +++ b/docs/app/e2e/api-docs/service-pages.scenario.js @@ -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)'); }); diff --git a/docs/app/e2e/app.scenario.js b/docs/app/e2e/app.scenario.js index e8e675328845..829323bb6115 100644 --- a/docs/app/e2e/app.scenario.js +++ b/docs/app/e2e/app.scenario.js @@ -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!'); }); diff --git a/docs/app/src/docs.js b/docs/app/src/docs.js index fb6a35565e8c..3593009b653b 100644 --- a/docs/app/src/docs.js +++ b/docs/app/src/docs.js @@ -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; diff --git a/docs/app/src/examples.js b/docs/app/src/examples.js index b6e8d5760256..fca74d9fc21a 100644 --- a/docs/app/src/examples.js +++ b/docs/app/src/examples.js @@ -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 { diff --git a/docs/app/test/directivesSpec.js b/docs/app/test/directivesSpec.js index 7966bb4be7f6..b9a24465f1b9 100644 --- a/docs/app/test/directivesSpec.js +++ b/docs/app/test/directivesSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe("code", function() { +describe('code', function() { var prettyPrintOne, oldPP; var compile, scope; diff --git a/docs/app/test/docsSpec.js b/docs/app/test/docsSpec.js index 26f708976395..905a6d511181 100644 --- a/docs/app/test/docsSpec.js +++ b/docs/app/test/docsSpec.js @@ -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'); diff --git a/docs/config/index.js b/docs/config/index.js index d0716012ad1c..4ec1423c65a0 100644 --- a/docs/config/index.js +++ b/docs/config/index.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var path = require('canonical-path'); var packagePath = __dirname; diff --git a/docs/config/processors/index-page.js b/docs/config/processors/index-page.js index 5b07daa3982d..102e3f53db50 100644 --- a/docs/config/processors/index-page.js +++ b/docs/config/processors/index-page.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var _ = require('lodash'); diff --git a/docs/config/processors/keywords.js b/docs/config/processors/keywords.js index 2028d6e01f91..fb47e70add8a 100644 --- a/docs/config/processors/keywords.js +++ b/docs/config/processors/keywords.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var _ = require('lodash'); var fs = require('fs'); diff --git a/docs/config/processors/versions-data.js b/docs/config/processors/versions-data.js index b2dbf5cb55da..5e0fa94cb7e0 100644 --- a/docs/config/processors/versions-data.js +++ b/docs/config/processors/versions-data.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var _ = require('lodash'); diff --git a/docs/config/services/deployments/debug.js b/docs/config/services/deployments/debug.js index 991b9c79ce1d..991474c47ea0 100644 --- a/docs/config/services/deployments/debug.js +++ b/docs/config/services/deployments/debug.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function debugDeployment(getVersion) { return { diff --git a/docs/config/services/deployments/default.js b/docs/config/services/deployments/default.js index 51e8dde3f466..5a10e4dbddf0 100644 --- a/docs/config/services/deployments/default.js +++ b/docs/config/services/deployments/default.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function defaultDeployment(getVersion) { return { diff --git a/docs/config/services/deployments/jquery.js b/docs/config/services/deployments/jquery.js index ea7b640d4e70..b480b9f50056 100644 --- a/docs/config/services/deployments/jquery.js +++ b/docs/config/services/deployments/jquery.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; module.exports = function jqueryDeployment(getVersion) { return { diff --git a/docs/config/services/deployments/production.js b/docs/config/services/deployments/production.js index 5d680b82bd3e..f0de9890278c 100644 --- a/docs/config/services/deployments/production.js +++ b/docs/config/services/deployments/production.js @@ -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 { diff --git a/docs/config/services/errorNamespaceMap.js b/docs/config/services/errorNamespaceMap.js index e1f3b9b37f28..237bcc905ebf 100644 --- a/docs/config/services/errorNamespaceMap.js +++ b/docs/config/services/errorNamespaceMap.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var StringMap = require('stringmap'); /** diff --git a/docs/config/services/getMinerrInfo.js b/docs/config/services/getMinerrInfo.js index 9538bdc0bf5e..2847240dc0e8 100644 --- a/docs/config/services/getMinerrInfo.js +++ b/docs/config/services/getMinerrInfo.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var path = require('canonical-path'); diff --git a/docs/config/services/getVersion.js b/docs/config/services/getVersion.js index fa7a5d42e1b8..473a6fd9349b 100644 --- a/docs/config/services/getVersion.js +++ b/docs/config/services/getVersion.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var path = require('canonical-path'); /** diff --git a/docs/content/guide/$location.ngdoc b/docs/content/guide/$location.ngdoc index db121430cd24..921d400a2286 100644 --- a/docs/content/guide/$location.ngdoc +++ b/docs/content/guide/$location.ngdoc @@ -409,9 +409,9 @@ In these examples we use ``. 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 ``. The inputs represen return { template: 'Address: ', 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 ``. 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 ``. The inputs represen return { template: 'Address: ', 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); diff --git a/docs/content/guide/concepts.ngdoc b/docs/content/guide/concepts.ngdoc index 3e8d941f9c27..69f1845ad883 100644 --- a/docs/content/guide/concepts.ngdoc +++ b/docs/content/guide/concepts.ngdoc @@ -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!'); }; }); @@ -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!'); }; }]); @@ -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!'); }; }]); diff --git a/docs/content/guide/controller.ngdoc b/docs/content/guide/controller.ngdoc index 947cae136abd..f4df3fb9fa64 100644 --- a/docs/content/guide/controller.ngdoc +++ b/docs/content/guide/controller.ngdoc @@ -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) { diff --git a/docs/content/guide/filter.ngdoc b/docs/content/guide/filter.ngdoc index 7e9b4ec33dc3..8f28388176fb 100644 --- a/docs/content/guide/filter.ngdoc +++ b/docs/content/guide/filter.ngdoc @@ -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; } diff --git a/docs/content/guide/i18n.ngdoc b/docs/content/guide/i18n.ngdoc index f419f4a0dbc8..680478d26436 100644 --- a/docs/content/guide/i18n.ngdoc +++ b/docs/content/guide/i18n.ngdoc @@ -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) { diff --git a/docs/content/guide/services.ngdoc b/docs/content/guide/services.ngdoc index 4fb2fd93f7a9..5c02774cf9a5 100644 --- a/docs/content/guide/services.ngdoc +++ b/docs/content/guide/services.ngdoc @@ -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 = []; } }; diff --git a/docs/gulpfile.js b/docs/gulpfile.js index 93e0ca312761..386b5dd798bb 100644 --- a/docs/gulpfile.js +++ b/docs/gulpfile.js @@ -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 diff --git a/gdocs.js b/gdocs.js index dab9b083221d..e83e0eca26fd 100755 --- a/gdocs.js +++ b/gdocs.js @@ -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: diff --git a/i18n/e2e/i18n-e2e.js b/i18n/e2e/i18n-e2e.js index dd01295db5c4..b34022d5174a 100644 --- a/i18n/e2e/i18n-e2e.js +++ b/i18n/e2e/i18n-e2e.js @@ -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'); }); diff --git a/i18n/spec/closureI18nExtractorSpec.js b/i18n/spec/closureI18nExtractorSpec.js index 822aea4065b3..41ef480bbebf 100644 --- a/i18n/spec/closureI18nExtractorSpec.js +++ b/i18n/spec/closureI18nExtractorSpec.js @@ -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"'); diff --git a/i18n/spec/converterSpec.js b/i18n/spec/converterSpec.js index decaf04033d4..ee6bf80698ed 100644 --- a/i18n/spec/converterSpec.js +++ b/i18n/spec/converterSpec.js @@ -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'], diff --git a/i18n/spec/parserSpec.js b/i18n/spec/parserSpec.js index 968185af1e20..f383122a057a 100644 --- a/i18n/spec/parserSpec.js +++ b/i18n/spec/parserSpec.js @@ -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); diff --git a/i18n/src/closureI18nExtractor.js b/i18n/src/closureI18nExtractor.js index 45b32a229b53..81d367a7158b 100644 --- a/i18n/src/closureI18nExtractor.js +++ b/i18n/src/closureI18nExtractor.js @@ -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"' + diff --git a/i18n/src/closureSlurper.js b/i18n/src/closureSlurper.js index 4cc23358ab3a..c5226bf323b6 100755 --- a/i18n/src/closureSlurper.js +++ b/i18n/src/closureSlurper.js @@ -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); }); diff --git a/karma-shared.conf.js b/karma-shared.conf.js index 5a60585001cb..ee4c78d00d7b 100644 --- a/karma-shared.conf.js +++ b/karma-shared.conf.js @@ -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': { diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js index dc925339f271..60980d7e508f 100644 --- a/lib/grunt/utils.js +++ b/lib/grunt/utils.js @@ -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('');"; + js = '!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend(\'\');'; 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(); }; diff --git a/lib/grunt/validate-angular-files.js b/lib/grunt/validate-angular-files.js index 94829f9e729a..d305076bcfe4 100644 --- a/lib/grunt/validate-angular-files.js +++ b/lib/grunt/validate-angular-files.js @@ -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; diff --git a/lib/versions/version-info.js b/lib/versions/version-info.js index 7baef6500b04..39a5f8a1d9ff 100644 --- a/lib/versions/version-info.js +++ b/lib/versions/version-info.js @@ -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; }; diff --git a/scripts/npm/clean-shrinkwrap.js b/scripts/npm/clean-shrinkwrap.js index a5a5421c0863..0e05f7c73790 100755 --- a/scripts/npm/clean-shrinkwrap.js +++ b/scripts/npm/clean-shrinkwrap.js @@ -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'); diff --git a/src/Angular.js b/src/Angular.js index 252582517e65..60463f1e1eb3 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -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']; @@ -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(//,'>')); } @@ -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); } } diff --git a/src/AngularPublic.js b/src/AngularPublic.js index 342690988d4b..ed7358178204 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -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"' }; diff --git a/src/auto/injector.js b/src/auto/injector.js index 1b00ecc13705..61eac820e035 100644 --- a/src/auto/injector.js +++ b/src/auto/injector.js @@ -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); } }); diff --git a/src/jqLite.js b/src/jqLite.js index 54d42b033d41..802fdb574a13 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -166,7 +166,7 @@ var wrapMap = { 'col': [2, '', '
'], 'tr': [2, '', '
'], 'td': [3, '', '
'], - '_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>") + wrap[2]; + tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1>') + 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); diff --git a/src/loader.js b/src/loader.js index da71b184f241..e7395558950c 100644 --- a/src/loader.js +++ b/src/loader.js @@ -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.>} */ diff --git a/src/ng/animate.js b/src/ng/animate.js index 06c706e7c12b..b55a0376bf4a 100644 --- a/src/ng/animate.js +++ b/src/ng/animate.js @@ -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); diff --git a/src/ng/browser.js b/src/ng/browser.js index ebed151bbcd6..001f09b9c511 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -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,'\''); } }; diff --git a/src/ng/cacheFactory.js b/src/ng/cacheFactory.js index ae121d3bfacb..84e91c9883bd 100644 --- a/src/ng/cacheFactory.js +++ b/src/ng/cacheFactory.js @@ -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, diff --git a/src/ng/compile.js b/src/ng/compile.js index 7e836fd020a3..e61307f3760f 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -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 = ""; + specialAttrHolder.innerHTML = ''; 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 . - 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); diff --git a/src/ng/controller.js b/src/ng/controller.js index 39f5c319e820..b1cbdc5cf91d 100644 --- a/src/ng/controller.js +++ b/src/ng/controller.js @@ -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); } diff --git a/src/ng/directive/attrs.js b/src/ng/directive/attrs.js index 0e3233ee9f35..adc398425fd9 100644 --- a/src/ng/directive/attrs.js +++ b/src/ng/directive/attrs.js @@ -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; } } diff --git a/src/ng/directive/ngController.js b/src/ng/directive/ngController.js index 565d81c7c6e4..cd3bfed63a4c 100644 --- a/src/ng/directive/ngController.js +++ b/src/ng/directive/ngController.js @@ -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'} diff --git a/src/ng/directive/ngModel.js b/src/ng/directive/ngModel.js index 9dc344519de4..6ef8ba408187 100644 --- a/src/ng/directive/ngModel.js +++ b/src/ng/directive/ngModel.js @@ -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() { diff --git a/src/ng/directive/ngOptions.js b/src/ng/directive/ngOptions.js index 8a1d6739d260..16a23b18ca17 100644 --- a/src/ng/directive/ngOptions.js +++ b/src/ng/directive/ngOptions.js @@ -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)); } diff --git a/src/ng/directive/ngPluralize.js b/src/ng/directive/ngPluralize.js index 1cbb8a595d0f..8d3a8a8cc48d 100644 --- a/src/ng/directive/ngPluralize.js +++ b/src/ng/directive/ngPluralize.js @@ -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(); diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index 26d357b9487a..213cd3bc583c 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -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 diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js index ea21eb155ad0..f19c251fc3b6 100644 --- a/src/ng/directive/ngTransclude.js +++ b/src/ng/directive/ngTransclude.js @@ -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...'; * }]); * diff --git a/src/ng/filter/filters.js b/src/ng/filter/filters.js index f35911d0965d..8d8f221a56cb 100644 --- a/src/ng/filter/filters.js +++ b/src/ng/filter/filters.js @@ -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; diff --git a/src/ng/http.js b/src/ng/http.js index 00b9f71c2f64..0cbc72571a32 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -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; }); }; diff --git a/src/ng/httpBackend.js b/src/ng/httpBackend.js index 5d3604271f25..501c1de86c73 100644 --- a/src/ng/httpBackend.js +++ b/src/ng/httpBackend.js @@ -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) { diff --git a/src/ng/interpolate.js b/src/ng/interpolate.js index 9414ae22b5c3..ebfdb72c5f26 100644 --- a/src/ng/interpolate.js +++ b/src/ng/interpolate.js @@ -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()); }; /** diff --git a/src/ng/location.js b/src/ng/location.js index 7e131182cf1a..31d1b2735caf 100644 --- a/src/ng/location.js +++ b/src/ng/location.js @@ -829,7 +829,7 @@ function $LocationProvider() { if (html5Mode.enabled) { if (!baseHref && html5Mode.requireBase) { throw $locationMinErr('nobase', - "$location in HTML5 mode requires a tag to be present!"); + '$location in HTML5 mode requires a tag to be present!'); } appBase = serverBase(initialUrl) + (baseHref || '/'); LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; diff --git a/src/ng/parse.js b/src/ng/parse.js index 3a81c1e990b8..a008dd1e4fea 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -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'; diff --git a/src/ng/q.js b/src/ng/q.js index 1b1802c6e82a..8664c992a43c 100644 --- a/src/ng/q.js +++ b/src/ng/q.js @@ -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(); diff --git a/src/ng/sce.js b/src/ng/sce.js index b2140e21bcbb..f16aee5597a8 100644 --- a/src/ng/sce.js +++ b/src/ng/sce.js @@ -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); }; }); diff --git a/src/ng/urlUtils.js b/src/ng/urlUtils.js index ee58b435f3e9..60a40b7caa87 100644 --- a/src/ng/urlUtils.js +++ b/src/ng/urlUtils.js @@ -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; } diff --git a/src/ngAnimate/animateCss.js b/src/ngAnimate/animateCss.js index 8127222e3e83..27619d67c29b 100644 --- a/src/ngAnimate/animateCss.js +++ b/src/ngAnimate/animateCss.js @@ -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; diff --git a/src/ngAnimate/module.js b/src/ngAnimate/module.js index 402e2c6752a8..b1167608c099 100644 --- a/src/ngAnimate/module.js +++ b/src/ngAnimate/module.js @@ -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() { diff --git a/src/ngAnimate/shared.js b/src/ngAnimate/shared.js index adfd35fc4668..f65ec61b0996 100644 --- a/src/ngAnimate/shared.js +++ b/src/ngAnimate/shared.js @@ -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; } diff --git a/src/ngCookies/cookieWriter.js b/src/ngCookies/cookieWriter.js index 2c8b6fe654d0..33daf8fb74cd 100644 --- a/src/ngCookies/cookieWriter.js +++ b/src/ngCookies/cookieWriter.js @@ -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; diff --git a/src/ngMessageFormat/messageFormatParser.js b/src/ngMessageFormat/messageFormatParser.js index 8621a3ee8727..cabacd2bb90d 100644 --- a/src/ngMessageFormat/messageFormatParser.js +++ b/src/ngMessageFormat/messageFormatParser.js @@ -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', diff --git a/src/ngMessageFormat/messageFormatSelector.js b/src/ngMessageFormat/messageFormatSelector.js index b672dca0d23a..749d9fd861f4 100644 --- a/src/ngMessageFormat/messageFormatSelector.js +++ b/src/ngMessageFormat/messageFormatSelector.js @@ -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'; } }; diff --git a/src/ngMessageFormat/messageFormatService.js b/src/ngMessageFormat/messageFormatService.js index a8ad661c611a..458130f879dc 100644 --- a/src/ngMessageFormat/messageFormatService.js +++ b/src/ngMessageFormat/messageFormatService.js @@ -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']; diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index c94a4a752cc3..93f99c62f5bd 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -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); } }); diff --git a/src/ngMock/browserTrigger.js b/src/ngMock/browserTrigger.js index 036d8d636106..e2483204d467 100644 --- a/src/ngMock/browserTrigger.js +++ b/src/ngMock/browserTrigger.js @@ -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) { diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 032e66f65564..c20207a44143 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -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 diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index 8cff45618261..dba842f1eafa 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -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; }]); diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js index 1c289e600117..551781da9346 100644 --- a/src/ngRoute/route.js +++ b/src/ngRoute/route.js @@ -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; * }) * diff --git a/src/ngSanitize/sanitize.js b/src/ngSanitize/sanitize.js index 64759e9c017a..a816069bcf48 100644 --- a/src/ngSanitize/sanitize.js +++ b/src/ngSanitize/sanitize.js @@ -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--; diff --git a/src/ngScenario/Application.js b/src/ngScenario/Application.js index 07efe4fa2baa..3639a3274506 100644 --- a/src/ngScenario/Application.js +++ b/src/ngScenario/Application.js @@ -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); }; diff --git a/src/ngScenario/angular-bootstrap.js b/src/ngScenario/angular-bootstrap.js index 3f1b0bf7bee5..fae98227f1a5 100644 --- a/src/ngScenario/angular-bootstrap.js +++ b/src/ngScenario/angular-bootstrap.js @@ -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( '' ); - 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('../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'); // Create the runner (which also sets up the global API) window.document.write( diff --git a/src/ngScenario/dsl.js b/src/ngScenario/dsl.js index 625c2b80c368..142811b043d1 100644 --- a/src/ngScenario/dsl.js +++ b/src/ngScenario/dsl.js @@ -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(); diff --git a/src/ngScenario/output/Html.js b/src/ngScenario/output/Html.js index 7f69a734db20..962d5a32303a 100644 --- a/src/ngScenario/output/Html.js +++ b/src/ngScenario/output/Html.js @@ -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(); diff --git a/test/AngularSpec.js b/test/AngularSpec.js index d8b9bf5b9af2..6fa00567139a 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -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("

s1s2

").find("span") }; + jqObject: jqLite('

s1s2

').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("

s1s2

").find("span"), + var jqObject = jqLite('

s1s2

').find('span'), log = []; forEach(jqObject, function(value, key) { log.push(key + ':' + value.innerHTML); }); expect(log).toEqual(['0:s1', '1:s2']); log = []; - jqObject = jqLite(""); + jqObject = jqLite(''); 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("

abc

")[0].childNodes, + var nodeList = jqLite('

abc

')[0].childNodes, log = []; @@ -1340,11 +1340,11 @@ describe('angular', function() { it('should handle HTMLCollection objects like arrays', function() { - document.body.innerHTML = "

" + - "a" + - "b" + - "c" + - "

"; + document.body.innerHTML = '

' + + 'a' + + 'b' + + 'c' + + '

'; 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("ab")); + testForEachSpec(2, jqLite('ab')); }); it('should follow the ES spec when called with childNodes NodeList', function() { - testForEachSpec(2, jqLite("

ab

")[0].childNodes); + testForEachSpec(2, jqLite('

ab

')[0].childNodes); }); it('should follow the ES spec when called with getElementsByTagName HTMLCollection', function() { - testForEachSpec(2, jqLite("

ab

")[0].getElementsByTagName("*")); + testForEachSpec(2, jqLite('

ab

')[0].getElementsByTagName('*')); }); it('should follow the ES spec when called with querySelectorAll HTMLCollection', function() { - testForEachSpec(2, jqLite("

ab

")[0].querySelectorAll("*")); + testForEachSpec(2, jqLite('

ab

')[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('
{{1+2}}
'); 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('

Hello, world!

')($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'); diff --git a/test/BinderSpec.js b/test/BinderSpec.js index faeb9a9f25c7..5d9beae964cc 100644 --- a/test/BinderSpec.js +++ b/test/BinderSpec.js @@ -62,7 +62,7 @@ describe('Binder', function() { })); it('InputTypeButtonActionExecutesInScope2', inject(function($rootScope, $compile) { - var log = ""; + var log = ''; element = $compile('')($rootScope); $rootScope.action = function() { log += 'click;'; @@ -359,11 +359,11 @@ describe('Binder', function() { it('ShoulIgnoreVbNonBindable', inject(function($rootScope, $compile) { element = $compile( - "
{{a}}" + - "
{{a}}
" + - "
{{b}}
" + - "
{{c}}
" + - "
")($rootScope); + '
{{a}}' + + '
{{a}}
' + + '
{{b}}
' + + '
{{c}}
' + + '
')($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('
Hello {{name}}!
')($rootScope); - $rootScope.name = "World"; + $rootScope.name = 'World'; $rootScope.$apply(); expect(sortedHtml(element)).toBe('
Hello World!
'); diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js index c0760aecb687..2e93498bb819 100644 --- a/test/auto/injectorSpec.js +++ b/test/auto/injectorSpec.js @@ -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'); }); diff --git a/test/helpers/matchers.js b/test/helpers/matchers.js index ec8cc436acb6..d68233e47db9 100644 --- a/test/helpers/matchers.js +++ b/test/helpers/matchers.js @@ -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); diff --git a/test/helpers/testabilityPatch.js b/test/helpers/testabilityPatch.js index 669c304d861c..dfb03b31e739 100644 --- a/test/helpers/testabilityPatch.js +++ b/test/helpers/testabilityPatch.js @@ -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, '>'); - } else if (node.nodeName === "#comment") { + } else if (node.nodeName === '#comment') { html += ''; } else { html += '<' + (node.nodeName || '?NOT_A_NODE?').toLowerCase(); diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 48835bb000c9..87ad0566a08f 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -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('
A<a>B</a>C
'); var text = root.contents(); - expect(text.wrap("")[0]).toBe(text[0]); + expect(text.wrap('')[0]).toBe(text[0]); expect(root.find('span').text()).toEqual('ABC'); }); it('should wrap free text node', function() { @@ -1866,7 +1866,7 @@ describe('jqLite', function() { text.remove(); expect(root.text()).toBe(''); - text.wrap(""); + text.wrap(''); expect(text.parent().text()).toEqual('ABC'); }); 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('poke'), pokeSpy = jasmine.createSpy('poke'), customEvent = { diff --git a/test/loaderSpec.js b/test/loaderSpec.js index 26d676452b26..c4f7a33989bd 100644 --- a/test/loaderSpec.js +++ b/test/loaderSpec.js @@ -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() { diff --git a/test/minErrSpec.js b/test/minErrSpec.js index abf036883eba..d438dc517b58 100644 --- a/test/minErrSpec.js +++ b/test/minErrSpec.js @@ -19,7 +19,7 @@ describe('minErr', function() { function someFn() { function nestedFn() { - myError = testError('fail', "I fail!"); + myError = testError('fail', 'I fail!'); } nestedFn(); } diff --git a/test/modules/no_bootstrap.js b/test/modules/no_bootstrap.js index b44324c59dfb..d39f8a5b1d76 100644 --- a/test/modules/no_bootstrap.js +++ b/test/modules/no_bootstrap.js @@ -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!'; diff --git a/test/ng/animateCssSpec.js b/test/ng/animateCssSpec.js index dcc37b7fc9c9..5299cfa0a4fc 100644 --- a/test/ng/animateCssSpec.js +++ b/test/ng/animateCssSpec.js @@ -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, { diff --git a/test/ng/animateRunnerSpec.js b/test/ng/animateRunnerSpec.js index 94f8b79fd1df..cd3ddea7f33d 100644 --- a/test/ng/animateRunnerSpec.js +++ b/test/ng/animateRunnerSpec.js @@ -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(); diff --git a/test/ng/animateSpec.js b/test/ng/animateSpec.js index eb98ed2811b9..9481a5619083 100644 --- a/test/ng/animateSpec.js +++ b/test/ng/animateSpec.js @@ -1,8 +1,8 @@ 'use strict'; -describe("$animate", function() { +describe('$animate', function() { - describe("without animation", function() { + describe('without animation', function() { var element, $rootElement; beforeEach(module(function() { @@ -12,14 +12,14 @@ describe("$animate", function() { }; })); - it("should add element at the start of enter animation", inject(function($animate, $compile, $rootScope) { + it('should add element at the start of enter animation', inject(function($animate, $compile, $rootScope) { var child = $compile('
')($rootScope); expect(element.contents().length).toBe(0); $animate.enter(child, element); expect(element.contents().length).toBe(1); })); - it("should enter the element to the start of the parent container", + it('should enter the element to the start of the parent container', inject(function($animate, $compile, $rootScope) { for (var i = 0; i < 5; i++) { @@ -32,7 +32,7 @@ describe("$animate", function() { expect(element.text()).toEqual('first 0 1 2 3 4'); })); - it("should remove the element at the end of leave animation", inject(function($animate, $compile, $rootScope) { + it('should remove the element at the end of leave animation', inject(function($animate, $compile, $rootScope) { var child = $compile('
')($rootScope); element.append(child); expect(element.contents().length).toBe(1); @@ -40,7 +40,7 @@ describe("$animate", function() { expect(element.contents().length).toBe(0); })); - it("should reorder the move animation", inject(function($animate, $compile, $rootScope) { + it('should reorder the move animation', inject(function($animate, $compile, $rootScope) { var child1 = $compile('
1
')($rootScope); var child2 = $compile('
2
')($rootScope); element.append(child1); @@ -50,7 +50,7 @@ describe("$animate", function() { expect(element.text()).toBe('21'); })); - it("should apply styles instantly to the element", + it('should apply styles instantly to the element', inject(function($animate, $compile, $rootScope) { $animate.animate(element, { color: 'rgb(0, 0, 0)' }); @@ -60,7 +60,7 @@ describe("$animate", function() { expect(element.css('color')).toBe('rgb(0, 255, 0)'); })); - it("should still perform DOM operations even if animations are disabled (post-digest)", inject(function($animate, $rootScope) { + it('should still perform DOM operations even if animations are disabled (post-digest)', inject(function($animate, $rootScope) { $animate.enabled(false); expect(element).toBeShown(); $animate.addClass(element, 'ng-hide'); @@ -68,7 +68,7 @@ describe("$animate", function() { expect(element).toBeHidden(); })); - it("should run each method and return a promise", inject(function($animate, $document) { + it('should run each method and return a promise', inject(function($animate, $document) { var element = jqLite('
'); var move = jqLite('
'); var parent = jqLite($document[0].body); @@ -82,17 +82,17 @@ describe("$animate", function() { expect($animate.leave(element)).toBeAPromise(); })); - it("should provide the `enabled` and `cancel` methods", inject(function($animate) { + it('should provide the `enabled` and `cancel` methods', inject(function($animate) { expect($animate.enabled()).toBeUndefined(); expect($animate.cancel({})).toBeUndefined(); })); - it("should provide the `on` and `off` methods", inject(function($animate) { + it('should provide the `on` and `off` methods', inject(function($animate) { expect(isFunction($animate.on)).toBe(true); expect(isFunction($animate.off)).toBe(true); })); - it("should add and remove classes on SVG elements", inject(function($animate, $rootScope) { + it('should add and remove classes on SVG elements', inject(function($animate, $rootScope) { if (!window.SVGElement) return; var svg = jqLite(''); var rect = svg.children(); @@ -106,16 +106,16 @@ describe("$animate", function() { expect(rect).not.toBeHidden(); })); - it("should throw error on wrong selector", function() { + it('should throw error on wrong selector', function() { module(function($animateProvider) { expect(function() { $animateProvider.register('abc', null); - }).toThrowMinErr("$animate", "notcsel", "Expecting class selector starting with '.' got 'abc'."); + }).toThrowMinErr('$animate', 'notcsel', 'Expecting class selector starting with \'.\' got \'abc\'.'); }); inject(); }); - it("should register the animation and be available for lookup", function() { + it('should register the animation and be available for lookup', function() { var provider; module(function($animateProvider) { provider = $animateProvider; @@ -130,7 +130,7 @@ describe("$animate", function() { }); }); - it("should apply and retain inline styles on the element that is animated", inject(function($animate, $rootScope) { + it('should apply and retain inline styles on the element that is animated', inject(function($animate, $rootScope) { var element = jqLite('
'); var parent = jqLite('
'); var other = jqLite('
'); @@ -176,7 +176,7 @@ describe("$animate", function() { } })); - it("should merge the from and to styles that are provided", + it('should merge the from and to styles that are provided', inject(function($animate, $rootScope) { var element = jqLite('
'); @@ -193,7 +193,7 @@ describe("$animate", function() { expect(style.borderColor).toBe('purple'); })); - it("should avoid cancelling out add/remove when the element already contains the class", + it('should avoid cancelling out add/remove when the element already contains the class', inject(function($animate, $rootScope) { var element = jqLite('
'); @@ -205,7 +205,7 @@ describe("$animate", function() { expect(element).not.toHaveClass('ng-hide'); })); - it("should avoid cancelling out remove/add if the element does not contain the class", + it('should avoid cancelling out remove/add if the element does not contain the class', inject(function($animate, $rootScope) { var element = jqLite('
'); @@ -217,7 +217,7 @@ describe("$animate", function() { expect(element).toHaveClass('ng-hide'); })); - they("should accept an unwrapped \"parent\" element for the $prop event", + they('should accept an unwrapped "parent" element for the $prop event', ['enter', 'move'], function(method) { inject(function($document, $animate, $rootElement) { @@ -230,7 +230,7 @@ describe("$animate", function() { }); }); - they("should accept an unwrapped \"after\" element for the $prop event", + they('should accept an unwrapped "after" element for the $prop event', ['enter', 'move'], function(method) { inject(function($document, $animate, $rootElement) { @@ -378,7 +378,7 @@ describe("$animate", function() { }); }); - it("should not alter the provided options input in any way throughout the animation", inject(function($animate, $rootElement, $rootScope) { + it('should not alter the provided options input in any way throughout the animation', inject(function($animate, $rootElement, $rootScope) { var element = jqLite('
'); var parent = $rootElement; diff --git a/test/ng/browserSpecs.js b/test/ng/browserSpecs.js index 2777d616763a..5c55800d7134 100755 --- a/test/ng/browserSpecs.js +++ b/test/ng/browserSpecs.js @@ -337,7 +337,7 @@ describe('browser', function() { expect(locationReplace).not.toHaveBeenCalled(); }); - it("should retain the # character when the only change is clearing the hash fragment, to prevent page reload", function() { + it('should retain the # character when the only change is clearing the hash fragment, to prevent page reload', function() { sniffer.history = true; browser.url('http://server/#123'); @@ -384,8 +384,8 @@ describe('browser', function() { }); it('should decode single quotes to work around FF bug 407273', function() { - fakeWindow.location.href = "http://ff-bug/?single%27quote"; - expect(browser.url()).toBe("http://ff-bug/?single'quote"); + fakeWindow.location.href = 'http://ff-bug/?single%27quote'; + expect(browser.url()).toBe('http://ff-bug/?single\'quote'); }); it('should not set URL when the URL is already set', function() { @@ -733,7 +733,7 @@ describe('browser', function() { }); - it("should stop calling callbacks when application has been torn down", function() { + it('should stop calling callbacks when application has been torn down', function() { sniffer.history = true; browser.onUrlChange(callback); fakeWindow.location.href = 'http://server/new'; diff --git a/test/ng/cacheFactorySpec.js b/test/ng/cacheFactorySpec.js index cb65a1740679..ddfd8a2819e9 100644 --- a/test/ng/cacheFactorySpec.js +++ b/test/ng/cacheFactorySpec.js @@ -17,7 +17,7 @@ describe('$cacheFactory', function() { it('should complain if the cache id is being reused', inject(function($cacheFactory) { $cacheFactory('cache1'); expect(function() { $cacheFactory('cache1'); }). - toThrowMinErr("$cacheFactory", "iid", "CacheId 'cache1' is already taken!"); + toThrowMinErr('$cacheFactory', 'iid', 'CacheId \'cache1\' is already taken!'); })); @@ -108,7 +108,7 @@ describe('$cacheFactory', function() { })); - it("should return value from put", inject(function($cacheFactory) { + it('should return value from put', inject(function($cacheFactory) { var obj = {}; expect(cache.put('k1', obj)).toBe(obj); })); diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index cac88465c7dd..800fb1be9d27 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -70,7 +70,7 @@ describe('$compile', function() { directive('greet', function() { return { restrict: 'CAM', priority:10, compile: valueFn(function(scope, element, attrs) { - element.text("Hello " + attrs.greet); + element.text('Hello ' + attrs.greet); })}; }); @@ -201,7 +201,7 @@ describe('$compile', function() { module(function() { expect(function() { directive('hasOwnProperty', function() { }); - }).toThrowMinErr('ng','badname', "hasOwnProperty is not a valid directive name"); + }).toThrowMinErr('ng','badname', 'hasOwnProperty is not a valid directive name'); }); inject(function($compile) {}); }); @@ -210,7 +210,7 @@ describe('$compile', function() { module(function() { expect(function() { directive('BadDirectiveName', function() { }); - }).toThrowMinErr('$compile','baddir', "Directive/Component name 'BadDirectiveName' is invalid. The first character must be a lowercase letter"); + }).toThrowMinErr('$compile','baddir', 'Directive/Component name \'BadDirectiveName\' is invalid. The first character must be a lowercase letter'); }); inject(function($compile) {}); }); @@ -221,7 +221,7 @@ describe('$compile', function() { directive(name, function() { }); }).toThrowMinErr( '$compile','baddir', 'Directive/Component name \'' + name + '\' is invalid. ' + - "The name should not contain leading or trailing whitespaces"); + 'The name should not contain leading or trailing whitespaces'); } assertLeadingOrTrailingWhitespaceInDirectiveName(' leadingWhitespaceDirectiveName'); assertLeadingOrTrailingWhitespaceInDirectiveName('trailingWhitespaceDirectiveName '); @@ -535,7 +535,7 @@ describe('$compile', function() { $rootScope.$apply(); // object's children can't be compiled in this case, so we expect them to be raw - expect(element.html()).toBe("3"); + expect(element.html()).toBe('3'); })); it('should detect anchor elements with the string "SVG" in the `href` attribute as an anchor', inject(function($compile, $rootScope) { @@ -685,7 +685,7 @@ describe('$compile', function() { })); }); inject(function($compile, $rootScope, log) { - element = jqLite("
A
"); + element = jqLite('
A
'); $compile(element)($rootScope); expect(element.text()).toBe('AB'); expect(log).toEqual('LOG'); @@ -1128,7 +1128,7 @@ describe('$compile', function() { }); }); - it("should fail if replacing and template doesn't have a single root element", function() { + it('should fail if replacing and template doesn\'t have a single root element', function() { module(function() { directive('noRootElem', function() { return { @@ -1153,11 +1153,11 @@ describe('$compile', function() { inject(function($compile) { expect(function() { $compile('

'); - }).toThrowMinErr("$compile", "tplrt", "Template for directive 'noRootElem' must have exactly one root element. "); + }).toThrowMinErr('$compile', 'tplrt', 'Template for directive \'noRootElem\' must have exactly one root element. '); expect(function() { $compile('

'); - }).toThrowMinErr("$compile", "tplrt", "Template for directive 'multiRootElem' must have exactly one root element. "); + }).toThrowMinErr('$compile', 'tplrt', 'Template for directive \'multiRootElem\' must have exactly one root element. '); // ws is ok expect(function() { @@ -1240,7 +1240,7 @@ describe('$compile', function() { $rootScope.$digest(); expect(nodeName_(child)).toMatch(/a/i); expect(isSVGElement(child[0])).toBe(true); - expect(child[0].href.baseVal).toBe("/foo/bar"); + expect(child[0].href.baseVal).toBe('/foo/bar'); }); }); @@ -1295,12 +1295,12 @@ describe('$compile', function() { module(function() { function DirectiveClass() { this.restrict = 'E'; - this.template = "

{{value}}

"; + this.template = '

{{value}}

'; } DirectiveClass.prototype.compile = function() { return function(scope, element, attrs) { - scope.value = "Test Value"; + scope.value = 'Test Value'; }; }; @@ -1310,7 +1310,7 @@ describe('$compile', function() { inject(function($compile, $rootScope) { element = $compile('')($rootScope); $rootScope.$digest(); - expect(element.find("p")[0].innerHTML).toEqual("Test Value"); + expect(element.find('p')[0].innerHTML).toEqual('Test Value'); }); }); }); @@ -1987,7 +1987,7 @@ describe('$compile', function() { )); - it("should fail if replacing and template doesn't have a single root element", function() { + it('should fail if replacing and template doesn\'t have a single root element', function() { module(function($exceptionHandlerProvider) { $exceptionHandlerProvider.mode('log'); @@ -2175,7 +2175,7 @@ describe('$compile', function() { var child = element.children().eq(0); expect(nodeName_(child)).toMatch(/a/i); expect(isSVGElement(child[0])).toBe(true); - expect(child[0].href.baseVal).toBe("/foo/bar"); + expect(child[0].href.baseVal).toBe('/foo/bar'); }); }); @@ -2234,12 +2234,12 @@ describe('$compile', function() { module(function() { function DirectiveClass() { this.restrict = 'E'; - this.templateUrl = "test.html"; + this.templateUrl = 'test.html'; } DirectiveClass.prototype.compile = function() { return function(scope, element, attrs) { - scope.value = "Test Value"; + scope.value = 'Test Value'; }; }; @@ -2252,7 +2252,7 @@ describe('$compile', function() { element = $compile('')($rootScope); $httpBackend.flush(); $rootScope.$digest(); - expect(element.find("p")[0].innerHTML).toEqual("Test Value"); + expect(element.find('p')[0].innerHTML).toEqual('Test Value'); }); }); @@ -3253,7 +3253,7 @@ describe('$compile', function() { var base = jqLite('
— {{ "This doesn\'t." }}
'); element = $compile(base)($rootScope); $rootScope.$digest(); - expect(element.text()).toBe("— This doesn't."); + expect(element.text()).toBe('— This doesn\'t.'); // Unregister the MutationObserver (and hope it doesn't mess up with subsequent tests) observer.disconnect(); @@ -5058,7 +5058,7 @@ describe('$compile', function() { componentScope.ref = 'ignore me'; expect(function() { $rootScope.$apply(); }). - toThrowMinErr("$compile", "nonassign", "Expression ''hello ' + name' in attribute 'ref' used with directive 'myComponent' is non-assignable!"); + toThrowMinErr('$compile', 'nonassign', 'Expression \'\'hello \' + name\' in attribute \'ref\' used with directive \'myComponent\' is non-assignable!'); expect(componentScope.ref).toBe('hello world'); // reset since the exception was rethrown which prevented phase clearing $rootScope.$$phase = null; @@ -5075,7 +5075,7 @@ describe('$compile', function() { componentScope.ref = 'ignore me'; expect(function() { $rootScope.$apply(); }). - toThrowMinErr("$compile", "nonassign", "Expression 'undefined' in attribute 'ref' used with directive 'myComponent' is non-assignable!"); + toThrowMinErr('$compile', 'nonassign', 'Expression \'undefined\' in attribute \'ref\' used with directive \'myComponent\' is non-assignable!'); expect(componentScope.ref).toBeUndefined(); $rootScope.$$phase = null; // reset since the exception was rethrown which prevented phase clearing @@ -5132,7 +5132,7 @@ describe('$compile', function() { componentScope.reference = {name: 'b'}; expect(function() { $rootScope.$apply(); - }).toThrowMinErr("$compile", "nonassign", "Expression '{name: name}' in attribute 'reference' used with directive 'myComponent' is non-assignable!"); + }).toThrowMinErr('$compile', 'nonassign', 'Expression \'{name: name}\' in attribute \'reference\' used with directive \'myComponent\' is non-assignable!'); })); @@ -5140,7 +5140,7 @@ describe('$compile', function() { test('1', 1); test('null', null); test('undefined', undefined); - test("'someString'", 'someString'); + test('\'someString\'', 'someString'); test('true', true); function test(literalString, literalValue) { @@ -5193,7 +5193,7 @@ describe('$compile', function() { name: 'Tony', value: 91 }]; - $rootScope.query = ""; + $rootScope.query = ''; $rootScope.$apply(); compile('
'); @@ -5201,7 +5201,7 @@ describe('$compile', function() { expect(componentScope.colref).toEqual($rootScope.collection); expect(componentScope.colrefAlias).toEqual(componentScope.colref); - $rootScope.query = "Gab"; + $rootScope.query = 'Gab'; $rootScope.$apply(); expect(componentScope.colref).toEqual([$rootScope.collection[0]]); @@ -5548,7 +5548,7 @@ describe('$compile', function() { test('1', 1); test('null', null); test('undefined', undefined); - test("'someString'", 'someString'); + test('\'someString\'', 'someString'); test('true', true); function test(literalString, literalValue) { @@ -5606,7 +5606,7 @@ describe('$compile', function() { it('should throw on unknown definition', inject(function() { expect(function() { compile('
'); - }).toThrowMinErr("$compile", "iscp", "Invalid isolate scope definition for directive 'badDeclaration'. Definition: {... attr: 'xxx' ...}"); + }).toThrowMinErr('$compile', 'iscp', 'Invalid isolate scope definition for directive \'badDeclaration\'. Definition: {... attr: \'xxx\' ...}'); })); it('should expose a $$isolateBindings property onto the scope', inject(function() { @@ -5687,23 +5687,23 @@ describe('$compile', function() { var controllerCalled = false; // eslint-disable-next-line no-eval var Controller = eval( - "class Foo {\n" + - " constructor($scope) {}\n" + - " $onInit() { this.check(); }\n" + - " check() {\n" + - " expect(this.data).toEqualData({\n" + - " 'foo': 'bar',\n" + - " 'baz': 'biz'\n" + - " });\n" + - " expect(this.oneway).toEqualData({\n" + - " 'foo': 'bar',\n" + - " 'baz': 'biz'\n" + - " });\n" + - " expect(this.str).toBe('Hello, world!');\n" + - " expect(this.fn()).toBe('called!');\n" + - " controllerCalled = true;\n" + - " }\n" + - "}"); + 'class Foo {\n' + + ' constructor($scope) {}\n' + + ' $onInit() { this.check(); }\n' + + ' check() {\n' + + ' expect(this.data).toEqualData({\n' + + ' \'foo\': \'bar\',\n' + + ' \'baz\': \'biz\'\n' + + ' });\n' + + ' expect(this.oneway).toEqualData({\n' + + ' \'foo\': \'bar\',\n' + + ' \'baz\': \'biz\'\n' + + ' });\n' + + ' expect(this.str).toBe(\'Hello, world!\');\n' + + ' expect(this.fn()).toBe(\'called!\');\n' + + ' controllerCalled = true;\n' + + ' }\n' + + '}'); spyOn(Controller.prototype, '$onInit').and.callThrough(); module(function($compileProvider) { @@ -6755,7 +6755,7 @@ describe('$compile', function() { inject(function($compile, $rootScope) { expect(function() { element = $compile('
')($rootScope); - }).toThrowMinErr('$compile', 'ctreq', "Controller 'nested', required by directive 'nested', can't be found!"); + }).toThrowMinErr('$compile', 'ctreq', 'Controller \'nested\', required by directive \'nested\', can\'t be found!'); }); }); @@ -7353,7 +7353,7 @@ describe('$compile', function() { }); - it("should throw an error if required controller can't be found",function() { + it('should throw an error if required controller can\'t be found',function() { module(function() { directive('dep', function(log) { return { @@ -7367,12 +7367,12 @@ describe('$compile', function() { inject(function(log, $compile, $rootScope) { expect(function() { $compile('
')($rootScope); - }).toThrowMinErr("$compile", "ctreq", "Controller 'main', required by directive 'dep', can't be found!"); + }).toThrowMinErr('$compile', 'ctreq', 'Controller \'main\', required by directive \'dep\', can\'t be found!'); }); }); - it("should pass null if required controller can't be found and is optional",function() { + it('should pass null if required controller can\'t be found and is optional',function() { module(function() { directive('dep', function(log) { return { @@ -7390,7 +7390,7 @@ describe('$compile', function() { }); - it("should pass null if required controller can't be found and is optional with the question mark on the right",function() { + it('should pass null if required controller can\'t be found and is optional with the question mark on the right',function() { module(function() { directive('dep', function(log) { return { @@ -7585,7 +7585,7 @@ describe('$compile', function() { directive('myDirective', function() { return { scope: { - myFoo: "=" + myFoo: '=' }, template: '

Hello

', controller: Ctrl @@ -7594,7 +7594,7 @@ describe('$compile', function() { }); inject(function($templateCache, $compile, $rootScope, log) { - $rootScope.foo = "bar"; + $rootScope.foo = 'bar'; element = $compile('
')($rootScope); $rootScope.$apply(); @@ -7612,7 +7612,7 @@ describe('$compile', function() { directive('myDirective', function() { return { scope: { - myFoo: "=" + myFoo: '=' }, templateUrl: 'hello.html', controller: Ctrl @@ -7622,7 +7622,7 @@ describe('$compile', function() { inject(function($templateCache, $compile, $rootScope, log) { $templateCache.put('hello.html', '

Hello

'); - $rootScope.foo = "bar"; + $rootScope.foo = 'bar'; element = $compile('
')($rootScope); $rootScope.$apply(); @@ -7747,8 +7747,8 @@ describe('$compile', function() { it('should throw ctreq with correct directive name, regardless of order', function() { module(function($compileProvider) { $compileProvider.directive('aDir', valueFn({ - restrict: "E", - require: "ngModel", + restrict: 'E', + require: 'ngModel', link: noop })); }); @@ -7760,7 +7760,7 @@ describe('$compile', function() { // affect which directive is referenced in the minErr message. element = $compile('')($rootScope); }).toThrowMinErr('$compile', 'ctreq', - "Controller 'ngModel', required by directive 'aDir', can't be found!"); + 'Controller \'ngModel\', required by directive \'aDir\', can\'t be found!'); }); }); }); @@ -7844,15 +7844,15 @@ describe('$compile', function() { }); inject(function($rootScope, $compile) { element = $compile('
This is after {{after}}
')($rootScope); - $rootScope.before = "BEFORE"; - $rootScope.after = "AFTER"; + $rootScope.before = 'BEFORE'; + $rootScope.after = 'AFTER'; $rootScope.$apply(); expect(element.text()).toEqual('This is before BEFORE. This is after AFTER'); - $rootScope.before = "Not-Before"; - $rootScope.after = "AfTeR"; - $rootScope.$$childHead.before = "BeFoRe"; - $rootScope.$$childHead.after = "Not-After"; + $rootScope.before = 'Not-Before'; + $rootScope.after = 'AfTeR'; + $rootScope.$$childHead.before = 'BeFoRe'; + $rootScope.$$childHead.after = 'Not-After'; $rootScope.$apply(); expect(element.text()).toEqual('This is before BeFoRe. This is after AfTeR'); }); @@ -8115,7 +8115,7 @@ describe('$compile', function() { //Ensure the angular $destroy event is still sent var destroyCount = 0; - element.find("div").on("$destroy", function() { destroyCount++; }); + element.find('div').on('$destroy', function() { destroyCount++; }); $rootScope.$apply('xs = null'); @@ -9085,7 +9085,7 @@ describe('$compile', function() { describe('multiple siblings receiving transclusion', function() { - it("should only receive transclude from parent", function() { + it('should only receive transclude from parent', function() { module(function($compileProvider) { @@ -9458,9 +9458,9 @@ describe('$compile', function() { var child = element.children(); expect(log.toArray()).toEqual([ - "outer:#comment:outer:", - "innerAgain:#comment:innerAgain:", - "inner:#comment:innerAgain:" + 'outer:#comment:outer:', + 'innerAgain:#comment:innerAgain:', + 'inner:#comment:innerAgain:' ]); expect(child.length).toBe(1); expect(child.contents().length).toBe(2); @@ -9527,7 +9527,7 @@ describe('$compile', function() { describe('lazy compilation', function() { // See https://github.com/angular/angular.js/issues/7183 - it("should pass transclusion through to template of a 'replace' directive", function() { + it('should pass transclusion through to template of a \'replace\' directive', function() { module(function() { directive('transSync', function() { return { @@ -9556,7 +9556,7 @@ describe('$compile', function() { directive('replaceWithTemplate', function() { return { - templateUrl: "template.html", + templateUrl: 'template.html', replace: true }; }); @@ -10154,7 +10154,7 @@ describe('$compile', function() { it('should not sanitize attributes other than src', inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "javascript:doEvilStuff()"; + $rootScope.testUrl = 'javascript:doEvilStuff()'; $rootScope.$apply(); expect(element.attr('title')).toBe('javascript:doEvilStuff()'); @@ -10183,7 +10183,7 @@ describe('$compile', function() { }); inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "someUrl"; + $rootScope.testUrl = 'someUrl'; $$sanitizeUri.and.returnValue('someSanitizedUrl'); $rootScope.$apply(); @@ -10234,7 +10234,7 @@ describe('$compile', function() { }); inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "someUrl"; + $rootScope.testUrl = 'someUrl'; $$sanitizeUri.and.returnValue('someSanitizedUrl'); $rootScope.$apply(); @@ -10286,7 +10286,7 @@ describe('$compile', function() { it('should not sanitize href on elements other than anchor', inject(function($compile, $rootScope) { element = $compile('
')($rootScope); - $rootScope.testUrl = "javascript:doEvilStuff()"; + $rootScope.testUrl = 'javascript:doEvilStuff()'; $rootScope.$apply(); expect(element.attr('href')).toBe('javascript:doEvilStuff()'); @@ -10294,7 +10294,7 @@ describe('$compile', function() { it('should not sanitize attributes other than href', inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "javascript:doEvilStuff()"; + $rootScope.testUrl = 'javascript:doEvilStuff()'; $rootScope.$apply(); expect(element.attr('title')).toBe('javascript:doEvilStuff()'); @@ -10323,7 +10323,7 @@ describe('$compile', function() { }); inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "someUrl"; + $rootScope.testUrl = 'someUrl'; $$sanitizeUri.and.returnValue('someSanitizedUrl'); $rootScope.$apply(); @@ -10339,7 +10339,7 @@ describe('$compile', function() { }); inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "someUrl"; + $rootScope.testUrl = 'someUrl'; $$sanitizeUri.and.returnValue('someSanitizedUrl'); $rootScope.$apply(); @@ -10355,7 +10355,7 @@ describe('$compile', function() { }); inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "evilUrl"; + $rootScope.testUrl = 'evilUrl'; $$sanitizeUri.and.returnValue('someSanitizedUrl'); $rootScope.$apply(); @@ -10372,7 +10372,7 @@ describe('$compile', function() { }); inject(function($compile, $rootScope) { element = $compile('')($rootScope); - $rootScope.testUrl = "evilUrl"; + $rootScope.testUrl = 'evilUrl'; $$sanitizeUri.and.returnValue('someSanitizedUrl'); $rootScope.$apply(); @@ -10385,22 +10385,22 @@ describe('$compile', function() { describe('interpolation on HTML DOM event handler attributes onclick, onXYZ, formaction', function() { it('should disallow interpolation on onclick', inject(function($compile, $rootScope) { // All interpolations are disallowed. - $rootScope.onClickJs = ""; + $rootScope.onClickJs = ''; expect(function() { $compile('", - 'a': "", - 'input[text]': "", - 'input[radio]': "", - 'input[checkbox]': "", - 'textarea': "", - 'select': "", - 'details': "
" + 'button': '', + 'a': '
', + 'input[text]': '', + 'input[radio]': '', + 'input[checkbox]': '', + 'textarea': '', + 'select': '', + 'details': '
' }, function(html) { compileElement(html); expect(element.attr('tabindex')).toBeUndefined(); diff --git a/test/ngCookies/cookieWriterSpec.js b/test/ngCookies/cookieWriterSpec.js index 4a1419c4f8cf..d43fa8b37f6b 100644 --- a/test/ngCookies/cookieWriterSpec.js +++ b/test/ngCookies/cookieWriterSpec.js @@ -4,16 +4,16 @@ describe('$$cookieWriter', function() { var $$cookieWriter, document; function deleteAllCookies() { - var cookies = document.cookie.split(";"); + var cookies = document.cookie.split(';'); var path = window.location.pathname; for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; - var eqPos = cookie.indexOf("="); + var eqPos = cookie.indexOf('='); var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; var parts = path.split('/'); while (parts.length) { - document.cookie = name + "=;path=" + (parts.join('/') || '/') + ";expires=Thu, 01 Jan 1970 00:00:00 GMT"; + document.cookie = name + '=;path=' + (parts.join('/') || '/') + ';expires=Thu, 01 Jan 1970 00:00:00 GMT'; parts.pop(); } } @@ -64,7 +64,7 @@ describe('$$cookieWriter', function() { it('should overwrite an existing unsynced cookie', function() { - document.cookie = "cookie=new;path=/"; + document.cookie = 'cookie=new;path=/'; var oldVal = $$cookieWriter('cookie', 'newer'); @@ -76,7 +76,7 @@ describe('$$cookieWriter', function() { $$cookieWriter('cookie1=', 'val;ue'); $$cookieWriter('cookie2=bar;baz', 'val=ue'); - var rawCookies = document.cookie.split("; "); //order is not guaranteed, so we need to parse + var rawCookies = document.cookie.split('; '); //order is not guaranteed, so we need to parse expect(rawCookies.length).toEqual(2); expect(rawCookies).toContain('cookie1%3D=val%3Bue'); expect(rawCookies).toContain('cookie2%3Dbar%3Bbaz=val%3Due'); @@ -97,8 +97,8 @@ describe('$$cookieWriter', function() { $$cookieWriter('x', longVal + 'xxxx'); //total size 4097-4099, a warning should be logged expect($log.warn.logs).toEqual( - [["Cookie 'x' possibly not set or overflowed because it was too large (4097 > 4096 " + - "bytes)!"]]); + [['Cookie \'x\' possibly not set or overflowed because it was too large (4097 > 4096 ' + + 'bytes)!']]); //force browser to dropped a cookie and make sure that the cache is not out of sync $$cookieWriter('x', 'shortVal'); @@ -107,8 +107,8 @@ describe('$$cookieWriter', function() { $$cookieWriter('x', longVal + longVal + longVal); //should be too long for all browsers if (document.cookie !== cookieStr) { - this.fail(new Error("browser didn't drop long cookie when it was expected. make the " + - "cookie in this test longer")); + this.fail(new Error('browser didn\'t drop long cookie when it was expected. make the ' + + 'cookie in this test longer')); } expect(document.cookie).toEqual('x=shortVal'); diff --git a/test/ngCookies/cookiesSpec.js b/test/ngCookies/cookiesSpec.js index 1b36749901d3..38c030443c3f 100644 --- a/test/ngCookies/cookiesSpec.js +++ b/test/ngCookies/cookiesSpec.js @@ -29,7 +29,7 @@ describe('$cookies', function() { it('should delete objects from the store when remove is called', inject(function($cookies) { - $cookies.putObject('gonner', { "I'll":"Be Back"}); + $cookies.putObject('gonner', { 'I\'ll':'Be Back'}); expect($cookies.get('gonner')).toEqual('{"I\'ll":"Be Back"}'); $cookies.remove('gonner'); expect($cookies.get('gonner')).toEqual(undefined); @@ -37,11 +37,11 @@ describe('$cookies', function() { it('should handle empty string value cookies', inject(function($cookies) { - $cookies.putObject("emptyCookie",''); + $cookies.putObject('emptyCookie',''); expect($cookies.get('emptyCookie')).toEqual('""'); - expect($cookies.getObject("emptyCookie")).toEqual(''); + expect($cookies.getObject('emptyCookie')).toEqual(''); mockedCookies['blankCookie'] = ''; - expect($cookies.getObject("blankCookie")).toEqual(''); + expect($cookies.getObject('blankCookie')).toEqual(''); })); diff --git a/test/ngMessageFormat/messageFormatSpec.js b/test/ngMessageFormat/messageFormatSpec.js index 43a6ae477293..4e2405fe4423 100644 --- a/test/ngMessageFormat/messageFormatSpec.js +++ b/test/ngMessageFormat/messageFormatSpec.js @@ -24,10 +24,10 @@ describe('$$ngMessageFormat', function() { this.gender = gender; } - var alice = new Person("Alice", "female"), - bob = new Person("Bob", "male"), - charlie = new Person("Charlie", "male"), - harry = new Person("Harry Potter", "male"); + var alice = new Person('Alice', 'female'), + bob = new Person('Bob', 'male'), + charlie = new Person('Charlie', 'male'), + harry = new Person('Harry Potter', 'male'); function initScope($scope) { $scope.recipients = [alice, bob, charlie]; @@ -55,40 +55,40 @@ describe('$$ngMessageFormat', function() { } it('should suppress falsy objects', function() { - assertMustache("{{undefined}}", ""); - assertMustache("{{null}}", ""); - assertMustache("{{a.b}}", ""); + assertMustache('{{undefined}}', ''); + assertMustache('{{null}}', ''); + assertMustache('{{a.b}}', ''); }); it('should jsonify objects', function() { - assertMustache("{{ {} }}", "{}"); - assertMustache("{{ true }}", "true"); - assertMustache("{{ false }}", "false"); - assertMustache("{{ 1 }}", "1"); - assertMustache("{{ '1' }}", "1"); - assertMustache("{{ sender }}", '{"name":"Harry Potter","gender":"male"}'); + assertMustache('{{ {} }}', '{}'); + assertMustache('{{ true }}', 'true'); + assertMustache('{{ false }}', 'false'); + assertMustache('{{ 1 }}', '1'); + assertMustache('{{ \'1\' }}', '1'); + assertMustache('{{ sender }}', '{"name":"Harry Potter","gender":"male"}'); }); it('should return function that can be called with no context', inject(function($interpolate) { - expect($interpolate("{{sender.name}}")()).toEqual(""); + expect($interpolate('{{sender.name}}')()).toEqual(''); })); describe('watchable', function() { it('ckck', function() { var calls = []; - $rootScope.$watch($interpolate("{{::name}}"), function(val) { + $rootScope.$watch($interpolate('{{::name}}'), function(val) { calls.push(val); }); $rootScope.$apply(); expect(calls.length).toBe(1); - $rootScope.name = "foo"; + $rootScope.name = 'foo'; $rootScope.$apply(); expect(calls.length).toBe(2); expect(calls[1]).toBe('foo'); - $rootScope.name = "bar"; + $rootScope.name = 'bar'; $rootScope.$apply(); expect(calls.length).toBe(2); }); @@ -117,96 +117,96 @@ describe('$$ngMessageFormat', function() { describe('plural', function() { it('no interpolation', function() { - var text = "" + - "{{recipients.length, plural,\n" + - " =0 {You gave no gifts}\n" + - " =1 {You gave one person a gift}\n" + + var text = '' + + '{{recipients.length, plural,\n' + + ' =0 {You gave no gifts}\n' + + ' =1 {You gave one person a gift}\n' + // "=1" should override "one" for exact value. - " one {YOU SHOULD NEVER SEE THIS MESSAGE}\n" + - " other {You gave some people gifts}\n" + - "}}"; + ' one {YOU SHOULD NEVER SEE THIS MESSAGE}\n' + + ' other {You gave some people gifts}\n' + + '}}'; var parsedFn = $interpolate(text, /*mustHaveExpression=*/true); expect(parsedFn.expressions.length).toBe(1); - expect(parsedFn.expressions[0]).toEqual("recipients.length"); + expect(parsedFn.expressions[0]).toEqual('recipients.length'); $rootScope.recipients.length = 2; - expect(parsedFn($rootScope)).toEqual("You gave some people gifts"); + expect(parsedFn($rootScope)).toEqual('You gave some people gifts'); $rootScope.recipients.length = 1; - expect(parsedFn($rootScope)).toEqual("You gave one person a gift"); + expect(parsedFn($rootScope)).toEqual('You gave one person a gift'); $rootScope.recipients.length = 0; - expect(parsedFn($rootScope)).toEqual("You gave no gifts"); + expect(parsedFn($rootScope)).toEqual('You gave no gifts'); }); it('with interpolation', function() { - var text = "" + - "{{recipients.length, plural,\n" + - " =0 {{{sender.name}} gave no gifts}\n" + - " =1 {{{sender.name}} gave one gift to {{recipients[0].name}}}\n" + + var text = '' + + '{{recipients.length, plural,\n' + + ' =0 {{{sender.name}} gave no gifts}\n' + + ' =1 {{{sender.name}} gave one gift to {{recipients[0].name}}}\n' + // "=1" should override "one" for exact value. - " one {YOU SHOULD NEVER SEE THIS MESSAGE}\n" + - " other {{{sender.name}} gave them a gift}\n" + - "}}"; + ' one {YOU SHOULD NEVER SEE THIS MESSAGE}\n' + + ' other {{{sender.name}} gave them a gift}\n' + + '}}'; var parsedFn = $interpolate(text, /*mustHaveExpression=*/true); expect(parsedFn.expressions.length).toBe(1); - expect(parsedFn.expressions[0]).toEqual("recipients.length"); + expect(parsedFn.expressions[0]).toEqual('recipients.length'); $rootScope.recipients.length = 2; - expect(parsedFn($rootScope)).toEqual("Harry Potter gave them a gift"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave them a gift'); $rootScope.recipients.length = 1; - expect(parsedFn($rootScope)).toEqual("Harry Potter gave one gift to Alice"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave one gift to Alice'); $rootScope.recipients.length = 0; - expect(parsedFn($rootScope)).toEqual("Harry Potter gave no gifts"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave no gifts'); }); it('with offset, interpolation, "#" symbol with and without escaping', function() { - var text = "" + - "{{recipients.length, plural, offset:1\n" + + var text = '' + + '{{recipients.length, plural, offset:1\n' + // NOTE: It's nonsensical to use "#" for "=0" with a positive offset. - " =0 {{{sender.name}} gave no gifts (\\#=#)}\n" + - " =1 {{{sender.name}} gave one gift to {{recipients[0].name}} (\\#=#)}\n" + - " one {{{sender.name}} gave {{recipients[0].name}} and one other person a gift (\\#=#)}\n" + - " other {{{sender.name}} gave {{recipients[0].name}} and # other people a gift (\\#=#)}\n" + - "}}"; + ' =0 {{{sender.name}} gave no gifts (\\#=#)}\n' + + ' =1 {{{sender.name}} gave one gift to {{recipients[0].name}} (\\#=#)}\n' + + ' one {{{sender.name}} gave {{recipients[0].name}} and one other person a gift (\\#=#)}\n' + + ' other {{{sender.name}} gave {{recipients[0].name}} and # other people a gift (\\#=#)}\n' + + '}}'; var parsedFn = $interpolate(text, /*mustHaveExpression=*/true); expect(parsedFn.expressions.length).toBe(1); - expect(parsedFn.expressions[0]).toEqual("recipients.length"); + expect(parsedFn.expressions[0]).toEqual('recipients.length'); $rootScope.recipients.length = 3; // "#" should get replaced with the value of "recipients.length - offset" - expect(parsedFn($rootScope)).toEqual("Harry Potter gave Alice and 2 other people a gift (#=2)"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave Alice and 2 other people a gift (#=2)'); $rootScope.recipients.length = 2; - expect(parsedFn($rootScope)).toEqual("Harry Potter gave Alice and one other person a gift (#=1)"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave Alice and one other person a gift (#=1)'); $rootScope.recipients.length = 1; - expect(parsedFn($rootScope)).toEqual("Harry Potter gave one gift to Alice (#=0)"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave one gift to Alice (#=0)'); $rootScope.recipients.length = 0; - expect(parsedFn($rootScope)).toEqual("Harry Potter gave no gifts (#=-1)"); + expect(parsedFn($rootScope)).toEqual('Harry Potter gave no gifts (#=-1)'); }); }); it('nested plural and select', function() { - var text = "" + - "{{recipients.length, plural,\n" + - " =0 {You gave no gifts}\n" + - " =1 {{{recipients[0].gender, select,\n" + - " male {You gave him a gift. -{{sender.name}}}\n" + - " female {You gave her a gift. -{{sender.name}}}\n" + - " other {You gave them a gift. -{{sender.name}}}\n" + - " }}\n" + - " }\n" + - " other {You gave {{recipients.length}} people gifts. -{{sender.name}}}\n" + - "}}"; + var text = '' + + '{{recipients.length, plural,\n' + + ' =0 {You gave no gifts}\n' + + ' =1 {{{recipients[0].gender, select,\n' + + ' male {You gave him a gift. -{{sender.name}}}\n' + + ' female {You gave her a gift. -{{sender.name}}}\n' + + ' other {You gave them a gift. -{{sender.name}}}\n' + + ' }}\n' + + ' }\n' + + ' other {You gave {{recipients.length}} people gifts. -{{sender.name}}}\n' + + '}}'; var parsedFn = $interpolate(text, /*mustHaveExpression=*/true); expect(parsedFn.expressions.length).toBe(1); - expect(parsedFn.expressions[0]).toEqual("recipients.length"); + expect(parsedFn.expressions[0]).toEqual('recipients.length'); var result = parsedFn($rootScope); - expect(result).toEqual("You gave 3 people gifts. -Harry Potter"); + expect(result).toEqual('You gave 3 people gifts. -Harry Potter'); }); }); @@ -217,11 +217,11 @@ describe('$$ngMessageFormat', function() { } it('should interpolate a plain string', function() { - assertInterpolation(" Hello, world! ", " Hello, world! "); + assertInterpolation(' Hello, world! ', ' Hello, world! '); }); it('should interpolate a simple expression', function() { - assertInterpolation("Hello, {{sender.name}}!", "Hello, Harry Potter!"); + assertInterpolation('Hello, {{sender.name}}!', 'Hello, Harry Potter!'); }); }); }); @@ -349,12 +349,12 @@ describe('$$ngMessageFormat', function() { it('should ignore undefined model', inject(function($interpolate) { - expect($interpolate("Hello {{'World'}}{{foo}}")({})).toBe('Hello World'); + expect($interpolate('Hello {{\'World\'}}{{foo}}')({})).toBe('Hello World'); })); it('should interpolate with undefined context', inject(function($interpolate) { - expect($interpolate("Hello, world!{{bloop}}")()).toBe("Hello, world!"); + expect($interpolate('Hello, world!{{bloop}}')()).toBe('Hello, world!'); })); describe('watching', function() { @@ -524,7 +524,7 @@ describe('$$ngMessageFormat', function() { it('should NOT interpolate non-trusted expressions', inject(function($interpolate, $rootScope) { var scope = $rootScope.$new(); - scope.foo = "foo"; + scope.foo = 'foo'; expect(function() { $interpolate('{{foo}}', true, sce.CSS)(scope); @@ -533,7 +533,7 @@ describe('$$ngMessageFormat', function() { it('should NOT interpolate mistyped expressions', inject(function($interpolate, $rootScope) { var scope = $rootScope.$new(); - scope.foo = sce.trustAsCss("foo"); + scope.foo = sce.trustAsCss('foo'); expect(function() { $interpolate('{{foo}}', true, sce.HTML)(scope); @@ -541,12 +541,12 @@ describe('$$ngMessageFormat', function() { })); it('should interpolate trusted expressions in a regular context', inject(function($interpolate) { - var foo = sce.trustAsCss("foo"); + var foo = sce.trustAsCss('foo'); expect($interpolate('{{foo}}', true)({foo: foo})).toBe('foo'); })); it('should interpolate trusted expressions in a specific trustedContext', inject(function($interpolate) { - var foo = sce.trustAsCss("foo"); + var foo = sce.trustAsCss('foo'); expect($interpolate('{{foo}}', true, sce.CSS)({foo: foo})).toBe('foo'); })); @@ -554,15 +554,15 @@ describe('$$ngMessageFormat', function() { // instance, you can construct evil JS code by putting together pieces of JS strings that are by // themselves safe to execute in isolation.) it('should NOT interpolate trusted expressions with multiple parts', inject(function($interpolate) { - var foo = sce.trustAsCss("foo"); - var bar = sce.trustAsCss("bar"); + var foo = sce.trustAsCss('foo'); + var bar = sce.trustAsCss('bar'); expect(function() { return $interpolate('{{foo}}{{bar}}', true, sce.CSS)({foo: foo, bar: bar}); }).toThrowMinErr( - "$interpolate", "noconcat", "Error while interpolating: {{foo}}{{bar}}\n" + - "Strict Contextual Escaping disallows interpolations that concatenate multiple " + - "expressions when a trusted value is required. See " + - "http://docs.angularjs.org/api/ng.$sce"); + '$interpolate', 'noconcat', 'Error while interpolating: {{foo}}{{bar}}\n' + + 'Strict Contextual Escaping disallows interpolations that concatenate multiple ' + + 'expressions when a trusted value is required. See ' + + 'http://docs.angularjs.org/api/ng.$sce'); })); }); @@ -584,50 +584,50 @@ describe('$$ngMessageFormat', function() { describe('parseBindings', function() { it('should Parse Text With No Bindings', inject(function($interpolate) { - expect($interpolate("a").expressions).toEqual([]); + expect($interpolate('a').expressions).toEqual([]); })); it('should Parse Empty Text', inject(function($interpolate) { - expect($interpolate("").expressions).toEqual([]); + expect($interpolate('').expressions).toEqual([]); })); it('should Parse Inner Binding', inject(function($interpolate) { - var interpolateFn = $interpolate("a{{b}}C"), + var interpolateFn = $interpolate('a{{b}}C'), expressions = interpolateFn.expressions; expect(expressions).toEqual(['b']); expect(interpolateFn({b: 123})).toEqual('a123C'); })); it('should Parse Ending Binding', inject(function($interpolate) { - var interpolateFn = $interpolate("a{{b}}"), + var interpolateFn = $interpolate('a{{b}}'), expressions = interpolateFn.expressions; expect(expressions).toEqual(['b']); expect(interpolateFn({b: 123})).toEqual('a123'); })); it('should Parse Begging Binding', inject(function($interpolate) { - var interpolateFn = $interpolate("{{b}}c"), + var interpolateFn = $interpolate('{{b}}c'), expressions = interpolateFn.expressions; expect(expressions).toEqual(['b']); expect(interpolateFn({b: 123})).toEqual('123c'); })); it('should Parse Loan Binding', inject(function($interpolate) { - var interpolateFn = $interpolate("{{b}}"), + var interpolateFn = $interpolate('{{b}}'), expressions = interpolateFn.expressions; expect(expressions).toEqual(['b']); expect(interpolateFn({b: 123})).toEqual('123'); })); it('should Parse Two Bindings', inject(function($interpolate) { - var interpolateFn = $interpolate("{{b}}{{c}}"), + var interpolateFn = $interpolate('{{b}}{{c}}'), expressions = interpolateFn.expressions; expect(expressions).toEqual(['b', 'c']); expect(interpolateFn({b: 111, c: 222})).toEqual('111222'); })); it('should Parse Two Bindings With Text In Middle', inject(function($interpolate) { - var interpolateFn = $interpolate("{{b}}x{{c}}"), + var interpolateFn = $interpolate('{{b}}x{{c}}'), expressions = interpolateFn.expressions; expect(expressions).toEqual(['b', 'c']); expect(interpolateFn({b: 111, c: 222})).toEqual('111x222'); @@ -648,21 +648,21 @@ describe('$$ngMessageFormat', function() { expect(function() { $interpolate('constant/{{var}}', true, isTrustedContext); }).toThrowMinErr( - "$interpolate", "noconcat", "Error while interpolating: constant/{{var}}\nStrict " + - "Contextual Escaping disallows interpolations that concatenate multiple expressions " + - "when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce"); + '$interpolate', 'noconcat', 'Error while interpolating: constant/{{var}}\nStrict ' + + 'Contextual Escaping disallows interpolations that concatenate multiple expressions ' + + 'when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce'); expect(function() { $interpolate('{{var}}/constant', true, isTrustedContext); }).toThrowMinErr( - "$interpolate", "noconcat", "Error while interpolating: {{var}}/constant\nStrict " + - "Contextual Escaping disallows interpolations that concatenate multiple expressions " + - "when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce"); + '$interpolate', 'noconcat', 'Error while interpolating: {{var}}/constant\nStrict ' + + 'Contextual Escaping disallows interpolations that concatenate multiple expressions ' + + 'when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce'); expect(function() { $interpolate('{{foo}}{{bar}}', true, isTrustedContext); }).toThrowMinErr( - "$interpolate", "noconcat", "Error while interpolating: {{foo}}{{bar}}\nStrict " + - "Contextual Escaping disallows interpolations that concatenate multiple expressions " + - "when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce"); + '$interpolate', 'noconcat', 'Error while interpolating: {{foo}}{{bar}}\nStrict ' + + 'Contextual Escaping disallows interpolations that concatenate multiple expressions ' + + 'when a trusted value is required. See http://docs.angularjs.org/api/ng.$sce'); })); it('should interpolate a multi-part expression when isTrustedContext is false', inject(function($interpolate) { diff --git a/test/ngMessages/messagesSpec.js b/test/ngMessages/messagesSpec.js index 5bfbb0898c0d..a12a0ff11da8 100644 --- a/test/ngMessages/messagesSpec.js +++ b/test/ngMessages/messagesSpec.js @@ -342,21 +342,21 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(0); - expect(trim(element.text())).toEqual(""); + expect(trim(element.text())).toEqual(''); $rootScope.$apply(function() { $rootScope.col = { hair: true }; }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("Your hair is too long"); + expect(trim(element.text())).toEqual('Your hair is too long'); $rootScope.$apply(function() { $rootScope.col = { age: true, hair: true}; }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("Your age is incorrect"); + expect(trim(element.text())).toEqual('Your age is incorrect'); $rootScope.$apply(function() { // remove the age! @@ -364,7 +364,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("Your hair is too long"); + expect(trim(element.text())).toEqual('Your hair is too long'); $rootScope.$apply(function() { // remove the hair! @@ -373,7 +373,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("Enter something"); + expect(trim(element.text())).toEqual('Enter something'); })); @@ -743,7 +743,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("A"); + expect(trim(element.text())).toEqual('A'); $rootScope.$apply(function() { $rootScope.data = { @@ -752,7 +752,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("C"); + expect(trim(element.text())).toEqual('C'); }); }); @@ -790,13 +790,13 @@ describe('ngMessages', function() { $rootScope.$digest(); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("Your value is that of failure"); + expect(trim(element.text())).toEqual('Your value is that of failure'); $httpBackend.flush(); $rootScope.$digest(); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("You did not enter a value"); + expect(trim(element.text())).toEqual('You did not enter a value'); })); it('should allow for overriding the remote template messages within the element depending on where the remote template is placed', @@ -821,7 +821,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("AAA"); + expect(trim(element.text())).toEqual('AAA'); $rootScope.$apply(function() { $rootScope.data = { @@ -831,7 +831,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("B"); + expect(trim(element.text())).toEqual('B'); $rootScope.$apply(function() { $rootScope.data = { @@ -840,7 +840,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(1); - expect(trim(element.text())).toEqual("C"); + expect(trim(element.text())).toEqual('C'); })); it('should properly detect a previous message, even if it was registered later', @@ -934,7 +934,7 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(2); - expect(s(element.text())).toContain("13"); + expect(s(element.text())).toContain('13'); }); }); @@ -958,14 +958,14 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(2); - expect(s(element.text())).toEqual("XZ"); + expect(s(element.text())).toEqual('XZ'); $rootScope.$apply(function() { $rootScope.data.y = {}; }); expect(messageChildren(element).length).toBe(3); - expect(s(element.text())).toEqual("XYZ"); + expect(s(element.text())).toEqual('XYZ'); })); it('should render and override all truthy messages from a remote template', @@ -990,14 +990,14 @@ describe('ngMessages', function() { }); expect(messageChildren(element).length).toBe(2); - expect(s(element.text())).toEqual("ZZZX"); + expect(s(element.text())).toEqual('ZZZX'); $rootScope.$apply(function() { $rootScope.data.y = {}; }); expect(messageChildren(element).length).toBe(3); - expect(s(element.text())).toEqual("YYYZZZX"); + expect(s(element.text())).toEqual('YYYZZZX'); })); }); }); diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js index c52c0758fc95..134b282515d1 100644 --- a/test/ngMock/angular-mocksSpec.js +++ b/test/ngMock/angular-mocksSpec.js @@ -172,7 +172,7 @@ describe('ngMock', function() { $log.reset(); })); - it("should skip debugging output if disabled (" + debugEnabled + ")", inject(function($log) { + it('should skip debugging output if disabled (' + debugEnabled + ')', inject(function($log) { $log.log('fake log'); $log.info('fake log'); $log.warn('fake log'); @@ -432,10 +432,10 @@ describe('ngMock', function() { expect($exceptionHandler.errors).toEqual([]); $interval.flush(1000); - expect($exceptionHandler.errors).toEqual(["Test Error"]); + expect($exceptionHandler.errors).toEqual(['Test Error']); $interval.flush(1000); - expect($exceptionHandler.errors).toEqual(["Test Error", "Test Error"]); + expect($exceptionHandler.errors).toEqual(['Test Error', 'Test Error']); })); @@ -626,7 +626,7 @@ describe('ngMock', function() { module(function($exceptionHandlerProvider) { expect(function() { $exceptionHandlerProvider.mode('XXX'); - }).toThrowError("Unknown mode 'XXX', only 'log'/'rethrow' modes are allowed!"); + }).toThrowError('Unknown mode \'XXX\', only \'log\'/\'rethrow\' modes are allowed!'); }); inject(); // Trigger the tests in `module` @@ -1013,28 +1013,28 @@ describe('ngMock', function() { it('should provide "expect" methods for each HTTP verb', function() { - expect(typeof hb.expectGET).toBe("function"); - expect(typeof hb.expectPOST).toBe("function"); - expect(typeof hb.expectPUT).toBe("function"); - expect(typeof hb.expectPATCH).toBe("function"); - expect(typeof hb.expectDELETE).toBe("function"); - expect(typeof hb.expectHEAD).toBe("function"); + expect(typeof hb.expectGET).toBe('function'); + expect(typeof hb.expectPOST).toBe('function'); + expect(typeof hb.expectPUT).toBe('function'); + expect(typeof hb.expectPATCH).toBe('function'); + expect(typeof hb.expectDELETE).toBe('function'); + expect(typeof hb.expectHEAD).toBe('function'); }); it('should provide "when" methods for each HTTP verb', function() { - expect(typeof hb.whenGET).toBe("function"); - expect(typeof hb.whenPOST).toBe("function"); - expect(typeof hb.whenPUT).toBe("function"); - expect(typeof hb.whenPATCH).toBe("function"); - expect(typeof hb.whenDELETE).toBe("function"); - expect(typeof hb.whenHEAD).toBe("function"); + expect(typeof hb.whenGET).toBe('function'); + expect(typeof hb.whenPOST).toBe('function'); + expect(typeof hb.whenPUT).toBe('function'); + expect(typeof hb.whenPATCH).toBe('function'); + expect(typeof hb.whenDELETE).toBe('function'); + expect(typeof hb.whenHEAD).toBe('function'); }); it('should provide "route" shortcuts for expect and when', function() { - expect(typeof hb.whenRoute).toBe("function"); - expect(typeof hb.expectRoute).toBe("function"); + expect(typeof hb.whenRoute).toBe('function'); + expect(typeof hb.expectRoute).toBe('function'); }); @@ -1342,7 +1342,7 @@ describe('ngMock', function() { it('should decode query parameters in respond() function', function() { hb.expect('GET', '/url?query=l%E2%80%A2ng%20string%20w%2F%20spec%5Eal%20char%24&id=1234&orderBy=-name') .respond(function(m, u, d, h, p) { - return [200, "id=" + p.id + ";orderBy=" + p.orderBy + ";query=" + p.query]; + return [200, 'id=' + p.id + ';orderBy=' + p.orderBy + ';query=' + p.query]; }); hb('GET', '/url?query=l%E2%80%A2ng%20string%20w%2F%20spec%5Eal%20char%24&id=1234&orderBy=-name', null, callback); @@ -1354,7 +1354,7 @@ describe('ngMock', function() { it('should include regex captures in respond() params when keys provided', function() { hb.expect('GET', /\/(.+)\/article\/(.+)/, undefined, undefined, ['id', 'name']) .respond(function(m, u, d, h, p) { - return [200, "id=" + p.id + ";name=" + p.name]; + return [200, 'id=' + p.id + ';name=' + p.name]; }); hb('GET', '/1234/article/cool-angular-article', null, callback); @@ -1491,7 +1491,7 @@ describe('ngMock', function() { }); - it("should use when's respond() when no expect() respond is defined", function() { + it('should use when\'s respond() when no expect() respond is defined', function() { callback.and.callFake(function(status, response) { expect(status).toBe(201); expect(response).toBe('data'); @@ -1848,7 +1848,7 @@ describe('ngMock', function() { expect(exp.matchData({})).toBe(false); expect(exp.match('POST', '/url', '{"id": "xxx", "status": "N"}')).toBe(true); - expect(exp.match('POST', '/url', {"id": "xxx", "status": "N"})).toBe(true); + expect(exp.match('POST', '/url', {'id': 'xxx', 'status': 'N'})).toBe(true); }); @@ -2856,42 +2856,42 @@ describe('sharedInjector', function() { // we use the 'module' and 'inject' globals from ngMock - it("allowes me to mutate a single instace of a module (proving it has been shared)", ngMockTest(function() { - sdescribe("test state is shared", function() { - angular.module("sharedInjectorTestModuleA", []) - .factory("testService", function() { + it('allowes me to mutate a single instace of a module (proving it has been shared)', ngMockTest(function() { + sdescribe('test state is shared', function() { + angular.module('sharedInjectorTestModuleA', []) + .factory('testService', function() { return { state: 0 }; }); module.sharedInjector(); - sbeforeAll(module("sharedInjectorTestModuleA")); + sbeforeAll(module('sharedInjectorTestModuleA')); - sit("access and mutate", inject(function(testService) { + sit('access and mutate', inject(function(testService) { testService.state += 1; })); - sit("expect mutation to have persisted", inject(function(testService) { + sit('expect mutation to have persisted', inject(function(testService) { expect(testService.state).toEqual(1); })); }); })); - it("works with standard beforeEach", ngMockTest(function() { - sdescribe("test state is not shared", function() { - angular.module("sharedInjectorTestModuleC", []) - .factory("testService", function() { + it('works with standard beforeEach', ngMockTest(function() { + sdescribe('test state is not shared', function() { + angular.module('sharedInjectorTestModuleC', []) + .factory('testService', function() { return { state: 0 }; }); - sbeforeEach(module("sharedInjectorTestModuleC")); + sbeforeEach(module('sharedInjectorTestModuleC')); - sit("access and mutate", inject(function(testService) { + sit('access and mutate', inject(function(testService) { testService.state += 1; })); - sit("expect mutation not to have persisted", inject(function(testService) { + sit('expect mutation not to have persisted', inject(function(testService) { expect(testService.state).toEqual(0); })); }); @@ -2899,70 +2899,70 @@ describe('sharedInjector', function() { it('allows me to stub with shared injector', ngMockTest(function() { - sdescribe("test state is shared", function() { - angular.module("sharedInjectorTestModuleD", []) - .value("testService", 43); + sdescribe('test state is shared', function() { + angular.module('sharedInjectorTestModuleD', []) + .value('testService', 43); module.sharedInjector(); - sbeforeAll(module("sharedInjectorTestModuleD", function($provide) { - $provide.value("testService", 42); + sbeforeAll(module('sharedInjectorTestModuleD', function($provide) { + $provide.value('testService', 42); })); - sit("expected access stubbed value", inject(function(testService) { + sit('expected access stubbed value', inject(function(testService) { expect(testService).toEqual(42); })); }); })); - it("doesn't interfere with other test describes", ngMockTest(function() { - angular.module("sharedInjectorTestModuleE", []) - .factory("testService", function() { + it('doesn\'t interfere with other test describes', ngMockTest(function() { + angular.module('sharedInjectorTestModuleE', []) + .factory('testService', function() { return { state: 0 }; }); - sdescribe("with stubbed injector", function() { + sdescribe('with stubbed injector', function() { module.sharedInjector(); - sbeforeAll(module("sharedInjectorTestModuleE")); + sbeforeAll(module('sharedInjectorTestModuleE')); - sit("access and mutate", inject(function(testService) { + sit('access and mutate', inject(function(testService) { expect(testService.state).toEqual(0); testService.state += 1; })); - sit("expect mutation to have persisted", inject(function(testService) { + sit('expect mutation to have persisted', inject(function(testService) { expect(testService.state).toEqual(1); })); }); - sdescribe("without stubbed injector", function() { - sbeforeEach(module("sharedInjectorTestModuleE")); + sdescribe('without stubbed injector', function() { + sbeforeEach(module('sharedInjectorTestModuleE')); - sit("access and mutate", inject(function(testService) { + sit('access and mutate', inject(function(testService) { expect(testService.state).toEqual(0); testService.state += 1; })); - sit("expect original, unmutated value", inject(function(testService) { + sit('expect original, unmutated value', inject(function(testService) { expect(testService.state).toEqual(0); })); }); })); - it("prevents nested use of sharedInjector()", function() { + it('prevents nested use of sharedInjector()', function() { var test = ngMockTest(function() { - sdescribe("outer", function() { + sdescribe('outer', function() { module.sharedInjector(); - sdescribe("inner", function() { + sdescribe('inner', function() { module.sharedInjector(); - sit("should not get here", function() { - throw Error("should have thrown before here!"); + sit('should not get here', function() { + throw Error('should have thrown before here!'); }); }); @@ -2986,9 +2986,9 @@ describe('sharedInjector', function() { if (re.test(e.message)) { return; } - throw Error("thrown error '" + e.message + "' did not match:" + re); + throw Error('thrown error \'' + e.message + '\' did not match:' + re); } - throw Error("should have thrown error"); + throw Error('should have thrown error'); } // run a set of test cases in the sdescribe stub test framework @@ -3002,7 +3002,7 @@ describe('sharedInjector', function() { module.$$beforeAllHook = sbeforeAll; module.$$afterAllHook = safterAll; - sdescribe.root = sdescribe("root", function() {}); + sdescribe.root = sdescribe('root', function() {}); sdescribe.root.beforeEach.push(module.$$beforeEach); sdescribe.root.afterEach.push(module.$$afterEach); @@ -3045,21 +3045,21 @@ describe('sharedInjector', function() { self.run = function() { var spec = {}; - self.hooks("beforeAll", spec); + self.hooks('beforeAll', spec); self.tests.forEach(function(test) { - if (self.parent) self.parent.hooks("beforeEach", spec); - self.hooks("beforeEach", spec); + if (self.parent) self.parent.hooks('beforeEach', spec); + self.hooks('beforeEach', spec); test.run.call(spec); - self.hooks("afterEach", spec); - if (self.parent) self.parent.hooks("afterEach", spec); + self.hooks('afterEach', spec); + if (self.parent) self.parent.hooks('afterEach', spec); }); self.describes.forEach(function(d) { d.run(); }); - self.hooks("afterAll", spec); + self.hooks('afterAll', spec); }; self.hooks = function(hook, spec) { @@ -3076,7 +3076,7 @@ describe('sharedInjector', function() { } function sit(name, fn) { - if (typeof fn !== "function") throw Error("not fn", fn); + if (typeof fn !== 'function') throw Error('not fn', fn); sdescribe.current.tests.push({ name: name, run: fn @@ -3084,22 +3084,22 @@ describe('sharedInjector', function() { } function sbeforeAll(fn) { - if (typeof fn !== "function") throw Error("not fn", fn); + if (typeof fn !== 'function') throw Error('not fn', fn); sdescribe.current.beforeAll.push(fn); } function safterAll(fn) { - if (typeof fn !== "function") throw Error("not fn", fn); + if (typeof fn !== 'function') throw Error('not fn', fn); sdescribe.current.afterAll.push(fn); } function sbeforeEach(fn) { - if (typeof fn !== "function") throw Error("not fn", fn); + if (typeof fn !== 'function') throw Error('not fn', fn); sdescribe.current.beforeEach.push(fn); } function safterEach(fn) { - if (typeof fn !== "function") throw Error("not fn", fn); + if (typeof fn !== 'function') throw Error('not fn', fn); sdescribe.current.afterEach.push(fn); } }); diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js index 40e9df6b5695..7a142a43f7b2 100644 --- a/test/ngResource/resourceSpec.js +++ b/test/ngResource/resourceSpec.js @@ -1,8 +1,8 @@ 'use strict'; -describe("resource", function() { +describe('resource', function() { -describe("basic usage", function() { +describe('basic usage', function() { var $resource, CreditCard, callback, $httpBackend, resourceProvider; beforeEach(module('ngResource')); @@ -98,7 +98,7 @@ describe("basic usage", function() { }); - it("should build resource", function() { + it('should build resource', function() { expect(typeof CreditCard).toBe('function'); expect(typeof CreditCard.get).toBe('function'); expect(typeof CreditCard.save).toBe('function'); @@ -140,14 +140,14 @@ describe("basic usage", function() { it('should omit properties from prototype chain', function() { var original, clone = {}; function Func() {} - Func.prototype.hello = "world"; + Func.prototype.hello = 'world'; original = new Func(); - original.goodbye = "world"; + original.goodbye = 'world'; expect(shallowClearAndCopy(original, clone)).toBe(clone); expect(clone.hello).toBeUndefined(); - expect(clone.goodbye).toBe("world"); + expect(clone.goodbye).toBe('world'); }); }); @@ -403,7 +403,7 @@ describe("basic usage", function() { }); - it("should build resource with action default param overriding default param", function() { + it('should build resource with action default param overriding default param', function() { $httpBackend.expect('GET', '/Customer/123').respond({id: 'abc'}); var TypeItem = $resource('/:type/:typeId', {type: 'Order'}, {get: {method: 'GET', params: {type: 'Customer'}}}); @@ -448,11 +448,11 @@ describe("basic usage", function() { it('should throw an exception if a param is called "hasOwnProperty"', function() { expect(function() { $resource('/:hasOwnProperty').get(); - }).toThrowMinErr('$resource','badname', "hasOwnProperty is not a valid parameter name"); + }).toThrowMinErr('$resource','badname', 'hasOwnProperty is not a valid parameter name'); }); - it("should create resource", function() { + it('should create resource', function() { $httpBackend.expect('POST', '/CreditCard', '{"name":"misko"}').respond({id: 123, name: 'misko'}); var cc = CreditCard.save({name: 'misko'}, callback); @@ -467,7 +467,7 @@ describe("basic usage", function() { }); - it("should read resource", function() { + it('should read resource', function() { $httpBackend.expect('GET', '/CreditCard/123').respond({id: 123, number: '9876'}); var cc = CreditCard.get({id: 123}, callback); @@ -484,14 +484,14 @@ describe("basic usage", function() { it('should send correct headers', function() { $httpBackend.expectPUT('/CreditCard/123', undefined, function(headers) { - return headers['If-None-Match'] === "*"; + return headers['If-None-Match'] === '*'; }).respond({id:123}); CreditCard.conditionalPut({id: {key:123}}); }); - it("should read partial resource", function() { + it('should read partial resource', function() { $httpBackend.expect('GET', '/CreditCard').respond([{id:{key:123}}]); var ccs = CreditCard.query(); @@ -511,7 +511,7 @@ describe("basic usage", function() { }); - it("should update resource", function() { + it('should update resource', function() { $httpBackend.expect('POST', '/CreditCard/123', '{"id":{"key":123},"name":"misko"}'). respond({id: {key: 123}, name: 'rama'}); @@ -522,7 +522,7 @@ describe("basic usage", function() { }); - it("should query resource", function() { + it('should query resource', function() { $httpBackend.expect('GET', '/CreditCard?key=value').respond([{id: 1}, {id: 2}]); var ccs = CreditCard.query({key: 'value'}, callback); @@ -536,7 +536,7 @@ describe("basic usage", function() { }); - it("should have all arguments optional", function() { + it('should have all arguments optional', function() { $httpBackend.expect('GET', '/CreditCard').respond([{id:1}]); var log = ''; @@ -583,7 +583,7 @@ describe("basic usage", function() { }); - it("should patch a resource", function() { + it('should patch a resource', function() { $httpBackend.expectPATCH('/CreditCard/123', '{"name":"igor"}'). respond({id: 123, name: 'rama'}); @@ -1228,10 +1228,10 @@ describe("basic usage", function() { }); it('should not convert string literals in array into Resource objects', function() { - $httpBackend.expect('GET', '/names.json').respond(["mary", "jane"]); + $httpBackend.expect('GET', '/names.json').respond(['mary', 'jane']); var strings = $resource('/names.json').query(); $httpBackend.flush(); - expect(strings).toEqualData(["mary", "jane"]); + expect(strings).toEqualData(['mary', 'jane']); }); it('should not convert number literals in array into Resource objects', function() { @@ -1288,7 +1288,7 @@ describe("basic usage", function() { }); }); - describe("save", function() { + describe('save', function() { it('should append the suffix', function() { $httpBackend.expect('POST', '/users.json', '{"name":"user1"}').respond({id: 123, name: 'user1'}); var UserService = $resource('/users/:user_id.json', {user_id: '@id'}); diff --git a/test/ngRoute/directive/ngViewSpec.js b/test/ngRoute/directive/ngViewSpec.js index 37ce71d33071..d201ff331dac 100644 --- a/test/ngRoute/directive/ngViewSpec.js +++ b/test/ngRoute/directive/ngViewSpec.js @@ -633,7 +633,7 @@ describe('ngView', function() { }); }); - it("should compile its content correctly (although we remove it later)", function() { + it('should compile its content correctly (although we remove it later)', function() { var testElement; module(function($compileProvider, $routeProvider) { $routeProvider.when('/view', {template: ' '}); diff --git a/test/ngRoute/routeSpec.js b/test/ngRoute/routeSpec.js index 5a0780f5efbf..dd325e10e580 100644 --- a/test/ngRoute/routeSpec.js +++ b/test/ngRoute/routeSpec.js @@ -403,7 +403,7 @@ describe('$route', function() { expect($route.current).toBeDefined(); })); - it("should use route params inherited from prototype chain", function() { + it('should use route params inherited from prototype chain', function() { function BaseRoute() {} BaseRoute.prototype.templateUrl = 'foo.html'; @@ -882,7 +882,7 @@ describe('$route', function() { $rootScope.$digest(); $httpBackend.flush(); - expect($exceptionHandler.errors.pop().message).toContain("[$compile:tpload] Failed to load template: r1.html"); + expect($exceptionHandler.errors.pop().message).toContain('[$compile:tpload] Failed to load template: r1.html'); $httpBackend.expectGET('r2.html').respond(''); $location.path('/r2'); diff --git a/test/ngSanitize/filter/linkySpec.js b/test/ngSanitize/filter/linkySpec.js index eee62d237ee8..4599c1ee48ab 100644 --- a/test/ngSanitize/filter/linkySpec.js +++ b/test/ngSanitize/filter/linkySpec.js @@ -10,7 +10,7 @@ describe('linky', function() { })); it('should do basic filter', function() { - expect(linky("http://ab/ (http://a/) http://1.2/v:~-123. c “http://example.com” ‘http://me.com’")). + expect(linky('http://ab/ (http://a/) http://1.2/v:~-123. c “http://example.com” ‘http://me.com’')). toEqual('
http://ab/ ' + '(http://a/) ' + '<http://a/> ' + @@ -65,13 +65,13 @@ describe('linky', function() { }); it('should handle mailto:', function() { - expect(linky("mailto:me@example.com")). + expect(linky('mailto:me@example.com')). toEqual('me@example.com'); - expect(linky("me@example.com")). + expect(linky('me@example.com')). toEqual('me@example.com'); - expect(linky("send email to me@example.com, but")). + expect(linky('send email to me@example.com, but')). toEqual('send email to me@example.com, but'); - expect(linky("my email is \"me@example.com\"")). + expect(linky('my email is "me@example.com"')). toEqual('my email is "me@example.com"'); }); @@ -80,10 +80,10 @@ describe('linky', function() { }); it('should handle target:', function() { - expect(linky("http://example.com", "_blank")). + expect(linky('http://example.com', '_blank')). toBeOneOf('http://example.com', 'http://example.com'); - expect(linky("http://example.com", "someNamedIFrame")). + expect(linky('http://example.com', 'someNamedIFrame')). toBeOneOf('http://example.com', 'http://example.com'); }); @@ -91,21 +91,21 @@ describe('linky', function() { describe('custom attributes', function() { it('should optionally add custom attributes', function() { - expect(linky("http://example.com", "_self", {rel: "nofollow"})). + expect(linky('http://example.com', '_self', {rel: 'nofollow'})). toBeOneOf('http://example.com', 'http://example.com'); }); it('should override target parameter with custom attributes', function() { - expect(linky("http://example.com", "_self", {target: "_blank"})). + expect(linky('http://example.com', '_self', {target: '_blank'})). toBeOneOf('http://example.com', 'http://example.com'); }); it('should optionally add custom attributes from function', function() { - expect(linky("http://example.com", "_self", function(url) {return {"class": "blue"};})). + expect(linky('http://example.com', '_self', function(url) {return {'class': 'blue'};})). toBeOneOf('http://example.com', 'http://example.com', 'http://example.com'); @@ -113,21 +113,21 @@ describe('linky', function() { it('should pass url as parameter to custom attribute function', function() { - var linkParameters = jasmine.createSpy('linkParameters').and.returnValue({"class": "blue"}); - linky("http://example.com", "_self", linkParameters); + var linkParameters = jasmine.createSpy('linkParameters').and.returnValue({'class': 'blue'}); + linky('http://example.com', '_self', linkParameters); expect(linkParameters).toHaveBeenCalledWith('http://example.com'); }); it('should call the attribute function for all links in the input', function() { var attributeFn = jasmine.createSpy('attributeFn').and.returnValue({}); - linky("http://example.com and http://google.com", "_self", attributeFn); + linky('http://example.com and http://google.com', '_self', attributeFn); expect(attributeFn.calls.allArgs()).toEqual([['http://example.com'], ['http://google.com']]); }); it('should strip unsafe attributes', function() { - expect(linky("http://example.com", "_self", {"class": "blue", "onclick": "alert('Hi')"})). + expect(linky('http://example.com', '_self', {'class': 'blue', 'onclick': 'alert(\'Hi\')'})). toBeOneOf('http://example.com', 'http://example.com', 'http://example.com'); diff --git a/test/ngSanitize/sanitizeSpec.js b/test/ngSanitize/sanitizeSpec.js index 5794d06e17a8..3c6e63829ec9 100644 --- a/test/ngSanitize/sanitizeSpec.js +++ b/test/ngSanitize/sanitizeSpec.js @@ -22,7 +22,7 @@ describe('HTML', function() { var handler, start, text, comment; beforeEach(function() { - text = ""; + text = ''; start = null; handler = { start: function(tag, attrs) { @@ -347,7 +347,7 @@ describe('HTML', function() { }); it('should ignore unknown attributes', function() { - writer.start('div', {unknown:""}); + writer.start('div', {unknown:''}); expect(html).toEqual('
'); }); diff --git a/test/ngScenario/ApplicationSpec.js b/test/ngScenario/ApplicationSpec.js index a6343cea424a..176f5b0a8ce0 100644 --- a/test/ngScenario/ApplicationSpec.js +++ b/test/ngScenario/ApplicationSpec.js @@ -10,7 +10,7 @@ describe('angular.scenario.Application', function() { beforeEach(function() { window.document.body.innerHTML = ''; - frames = _jQuery("
"); + frames = _jQuery('
'); _jQuery(window.document.body).append(frames); app = new angular.scenario.Application(frames); }); @@ -134,7 +134,7 @@ describe('angular.scenario.Application', function() { var injectorGet = $injector.get; spyOn($injector, 'get').and.callFake(function(name) { switch (name) { - case "$rootElement": return jqLite(testWindow.document); + case '$rootElement': return jqLite(testWindow.document); default: return injectorGet(name); } }); @@ -164,7 +164,7 @@ describe('angular.scenario.Application', function() { var injectorGet = $injector.get; var injectorSpy = spyOn($injector, 'get').and.callFake(function(name) { switch (name) { - case "$rootElement": return jqLite(testWindow.document); + case '$rootElement': return jqLite(testWindow.document); default: return injectorGet(name); } }); @@ -183,7 +183,7 @@ describe('angular.scenario.Application', function() { testWindow.angular.resumeDeferredBootstrap(); expect(app.rootElement).toBe(testWindow.document); expect(resumeBootstrapSpy).toHaveBeenCalled(); - expect(injectorSpy).toHaveBeenCalledWith("$rootElement"); + expect(injectorSpy).toHaveBeenCalledWith('$rootElement'); dealoc(testWindow.document); })); diff --git a/test/ngScenario/RunnerSpec.js b/test/ngScenario/RunnerSpec.js index 9f62504409b1..3de151a55d27 100644 --- a/test/ngScenario/RunnerSpec.js +++ b/test/ngScenario/RunnerSpec.js @@ -103,7 +103,7 @@ describe('angular.scenario.Runner', function() { $window.describe('describe', function() { $window.it('1', function() { var scope = $window.dslScope(); - scope.test = "foo"; + scope.test = 'foo'; expect($window.dslScope().test).toBeUndefined(); }); $window.it('2', function() { diff --git a/test/ngScenario/ScenarioSpec.js b/test/ngScenario/ScenarioSpec.js index a8e5280b5784..d3451a2ba327 100644 --- a/test/ngScenario/ScenarioSpec.js +++ b/test/ngScenario/ScenarioSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe("ScenarioSpec: Compilation", function() { +describe('ScenarioSpec: Compilation', function() { var element; afterEach(function() { @@ -9,7 +9,7 @@ describe("ScenarioSpec: Compilation", function() { describe('compilation', function() { - it("should compile dom node and return scope", inject(function($rootScope, $compile) { + it('should compile dom node and return scope', inject(function($rootScope, $compile) { var node = jqLite('
{{b=a+1}}
')[0]; element = $compile(node)($rootScope); $rootScope.$digest(); @@ -17,13 +17,13 @@ describe("ScenarioSpec: Compilation", function() { expect($rootScope.b).toEqual(2); })); - it("should compile jQuery node and return scope", inject(function($rootScope, $compile) { + it('should compile jQuery node and return scope', inject(function($rootScope, $compile) { element = $compile(jqLite('
{{a=123}}
'))($rootScope); $rootScope.$digest(); expect(jqLite(element).text()).toEqual('123'); })); - it("should compile text node and return scope", inject(function($rootScope, $compile) { + it('should compile text node and return scope', inject(function($rootScope, $compile) { element = $compile('
{{a=123}}
')($rootScope); $rootScope.$digest(); expect(jqLite(element).text()).toEqual('123'); diff --git a/test/ngScenario/dslSpec.js b/test/ngScenario/dslSpec.js index 700270af8574..a34d59d20d8d 100644 --- a/test/ngScenario/dslSpec.js +++ b/test/ngScenario/dslSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe("angular.scenario.dsl", function() { +describe('angular.scenario.dsl', function() { var element; var $window, $root; var eventLog; @@ -765,7 +765,7 @@ describe("angular.scenario.dsl", function() { it('should return value in text input', function() { doc.append(''); $root.dsl.input('test.input').val(); - expect($root.futureResult).toEqual("something"); + expect($root.futureResult).toEqual('something'); }); }); }); diff --git a/test/ngScenario/e2e/widgets-scenario.js b/test/ngScenario/e2e/widgets-scenario.js index 3d7a3e383645..40b176d1b30a 100644 --- a/test/ngScenario/e2e/widgets-scenario.js +++ b/test/ngScenario/e2e/widgets-scenario.js @@ -32,18 +32,18 @@ describe('widgets', function() { expect(binding('button').fromJson()).toEqual({'count': 0}); expect(binding('form').fromJson()).toEqual({'count': 0}); - element('form a', "'action' link").click(); + element('form a', '\'action\' link').click(); expect(binding('button').fromJson()).toEqual({'count': 1}); - element('input[value="submit input"]', "'submit input' button").click(); + element('input[value="submit input"]', '\'submit input\' button').click(); expect(binding('button').fromJson()).toEqual({'count': 2}); expect(binding('form').fromJson()).toEqual({'count': 1}); - element('button:contains("submit button")', "'submit button' button").click(); + element('button:contains("submit button")', '\'submit button\' button').click(); expect(binding('button').fromJson()).toEqual({'count': 2}); expect(binding('form').fromJson()).toEqual({'count': 2}); - element('input[value="button"]', "'button' button").click(); + element('input[value="button"]', '\'button\' button').click(); expect(binding('button').fromJson()).toEqual({'count': 3}); element('input[type="image"]', 'form image').click(); diff --git a/test/ngScenario/matchersSpec.js b/test/ngScenario/matchersSpec.js index d8a62a02d4bd..7b68d2b9b731 100644 --- a/test/ngScenario/matchersSpec.js +++ b/test/ngScenario/matchersSpec.js @@ -34,7 +34,7 @@ describe('angular.scenario.matchers', function() { expectMatcher(10, function() { matchers.toEqual(10); }); expectMatcher('value', function() { matchers.toBeDefined(); }); expectMatcher([1], function() { matchers.toBeTruthy(); }); - expectMatcher("", function() { matchers.toBeFalsy(); }); + expectMatcher('', function() { matchers.toBeFalsy(); }); expectMatcher(0, function() { matchers.toBeFalsy(); }); expectMatcher('foo', function() { matchers.toMatch('.o.'); }); expectMatcher(null, function() { matchers.toBeNull(); }); diff --git a/test/ngScenario/output/HtmlSpec.js b/test/ngScenario/output/HtmlSpec.js index 295fa45eaa54..541d4d4afadf 100644 --- a/test/ngScenario/output/HtmlSpec.js +++ b/test/ngScenario/output/HtmlSpec.js @@ -24,7 +24,7 @@ describe('angular.scenario.output.html', function() { }; runner = new angular.scenario.testing.MockRunner(); model = new angular.scenario.ObjectModel(runner); - context = _jQuery("
"); + context = _jQuery('
'); ui = angular.scenario.output.html(context, runner, model); }); diff --git a/validate-commit-msg.spec.js b/validate-commit-msg.spec.js index a00102174b5b..5a8ab1dc409e 100644 --- a/validate-commit-msg.spec.js +++ b/validate-commit-msg.spec.js @@ -44,7 +44,7 @@ describe('validate-commit-msg.js', function() { it('should validate 100 characters length', function() { - var msg = "fix($compile): something super mega extra giga tera long, maybe even longer and longer and longer... "; + var msg = 'fix($compile): something super mega extra giga tera long, maybe even longer and longer and longer... '; expect(m.validateMessage(msg)).toBe(INVALID); expect(errors).toEqual(['INVALID COMMIT MSG: is longer than 100 characters !']);