From 7231496ad1377a6599624c579180ca9722e61c2e Mon Sep 17 00:00:00 2001 From: Gerwin Sturm Date: Thu, 3 Nov 2016 17:49:16 +0000 Subject: [PATCH 1/9] Give iconset a unique name (#944) --- src/my-app.html | 2 +- src/my-icons.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/my-app.html b/src/my-app.html index 45a138325..002736118 100644 --- a/src/my-app.html +++ b/src/my-app.html @@ -86,7 +86,7 @@ - +
My App
diff --git a/src/my-icons.html b/src/my-icons.html index afed63b84..fcd758c80 100644 --- a/src/my-icons.html +++ b/src/my-icons.html @@ -11,7 +11,7 @@ - + From 02edfbae638dafa050ec3de2a7346d5bdbc892a2 Mon Sep 17 00:00:00 2001 From: Rob Dodson Date: Sat, 19 Nov 2016 14:39:31 -0800 Subject: [PATCH 2/9] Back out #940 --- index.html | 22 +++++++++++----------- sw-precache-config.js | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index 912e2d694..ef9fbeb4c 100644 --- a/index.html +++ b/index.html @@ -17,10 +17,10 @@ My App - + - + @@ -35,14 +35,14 @@ - - - - - + + + + + - + @@ -76,7 +76,7 @@ if (!webComponentsSupported) { var script = document.createElement('script'); script.async = true; - script.src = 'bower_components/webcomponentsjs/webcomponents-lite.min.js'; + script.src = '/bower_components/webcomponentsjs/webcomponents-lite.min.js'; script.onload = onload; document.head.appendChild(script); } else { @@ -87,12 +87,12 @@ // Load pre-caching Service Worker if ('serviceWorker' in navigator) { window.addEventListener('load', function() { - navigator.serviceWorker.register('service-worker.js'); + navigator.serviceWorker.register('/service-worker.js'); }); } - + @@ -113,12 +108,12 @@ page: { type: String, reflectToAttribute: true, - observer: '_pageChanged' - } + observer: '_pageChanged', + }, }, observers: [ - '_routePageChanged(routeData.page)' + '_routePageChanged(routeData.page)', ], _routePageChanged: function(page) { @@ -137,7 +132,7 @@ _showPage404: function() { this.page = 'view404'; - } + }, }); diff --git a/src/my-view1.html b/src/my-view1.html index 2171f6f44..b25d0f906 100644 --- a/src/my-view1.html +++ b/src/my-view1.html @@ -31,7 +31,7 @@

View One

diff --git a/src/my-view2.html b/src/my-view2.html index 1590511c4..06b082c8b 100644 --- a/src/my-view2.html +++ b/src/my-view2.html @@ -31,7 +31,7 @@

View Two

diff --git a/src/my-view3.html b/src/my-view3.html index 49c0875d1..c69c0723d 100644 --- a/src/my-view3.html +++ b/src/my-view3.html @@ -31,7 +31,7 @@

View Three

diff --git a/src/my-view404.html b/src/my-view404.html index 73c9352d5..3f342a62c 100644 --- a/src/my-view404.html +++ b/src/my-view404.html @@ -29,7 +29,7 @@ diff --git a/src/shared-styles.html b/src/shared-styles.html index e6769ea6a..5e4f2491d 100644 --- a/src/shared-styles.html +++ b/src/shared-styles.html @@ -17,7 +17,6 @@ .card { margin: 24px; padding: 16px; - color: #757575; border-radius: 5px; background-color: #fff; @@ -26,25 +25,19 @@ .circle { display: inline-block; - width: 64px; height: 64px; - text-align: center; - color: #555; border-radius: 50%; background: #ddd; - font-size: 30px; line-height: 64px; } h1 { margin: 16px 0; - color: #212121; - font-size: 22px; } diff --git a/sw-precache-config.js b/sw-precache-config.js index 6eca8d699..301bb56b0 100644 --- a/sw-precache-config.js +++ b/sw-precache-config.js @@ -7,11 +7,14 @@ * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ + +/* eslint-env node */ + module.exports = { staticFileGlobs: [ '/index.html', '/manifest.json', - '/bower_components/webcomponentsjs/webcomponents-lite.min.js' + '/bower_components/webcomponentsjs/webcomponents-lite.min.js', ], - navigateFallback: 'index.html' + navigateFallback: 'index.html', }; diff --git a/test/.eslintrc.json b/test/.eslintrc.json new file mode 100644 index 000000000..72c940381 --- /dev/null +++ b/test/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "env": { + "mocha": true + }, + "globals": { + "assert": false, + "fixture": false, + "WCT": false + } +} diff --git a/test/index.html b/test/index.html index abbabb506..8678e3845 100644 --- a/test/index.html +++ b/test/index.html @@ -22,7 +22,7 @@ diff --git a/test/my-view1.html b/test/my-view1.html index deae21468..bcb79628e 100644 --- a/test/my-view1.html +++ b/test/my-view1.html @@ -40,7 +40,7 @@ test('Number in circle should be 1', function() { var circle = Polymer.dom(home.root).querySelector('.circle'); assert.equal(circle.textContent, '1'); - }) + }); }); From 066d707a6d24f969b3ade69256e5acec9f7e78da Mon Sep 17 00:00:00 2001 From: Rob Dodson Date: Sun, 18 Dec 2016 18:42:53 -0800 Subject: [PATCH 4/9] Add generator tag --- index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/index.html b/index.html index 1e9fb36fc..c0ca1de0e 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,7 @@ + My App From 8e7437366a8eb0dbc2e2ec819efc794748e2a78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3n=20Rodr=C3=ADguez=20Davila?= Date: Tue, 10 Jan 2017 02:28:35 +0100 Subject: [PATCH 5/9] Add .gitignore as ignore-path to ESLint (#954) To avoid lint the `build` folder. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f851c4de3..2ad990610 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "eslint-plugin-html": "^1.7.0" }, "scripts": { - "lint": "eslint . --ext js,html; exit 0;", + "lint": "eslint . --ext js,html --ignore-path .gitignore", "test": "npm run lint && polymer test" } } From f9bb50d6adae2602740f4e60d3af6e77644465be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abd=C3=B3n=20Rodr=C3=ADguez=20Davila?= Date: Thu, 12 Jan 2017 20:43:02 +0100 Subject: [PATCH 6/9] Update README (#957) --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d5f3b15df..3bff7938b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ The PRPL pattern, in a nutshell: ##### Prerequisites -Install [polymer-cli](https://github.com/Polymer/polymer-cli): +First, install [Polymer CLI](https://github.com/Polymer/polymer-cli) using +[npm](https://www.npmjs.com) (we assume you have pre-installed [node.js](https://nodejs.org)). npm install -g polymer-cli @@ -43,7 +44,6 @@ routing for the app: polymer serve --open - ### Build This command performs HTML, CSS, and JS minification on the application @@ -72,17 +72,16 @@ generated using fragment bundling: ### Run tests -This command will run -[Web Component Tester](https://github.com/Polymer/web-component-tester) against the -browsers currently installed on your machine. +This command will run [Web Component Tester](https://github.com/Polymer/web-component-tester) +against the browsers currently installed on your machine: polymer test ### Adding a new view You can extend the app by adding more views that will be demand-loaded -e.g. based on the route, or to progressively render non-critical sections -of the application. Each new demand-loaded fragment should be added to the -list of `fragments` in the included `polymer.json` file. This will ensure -those components and their dependencies are added to the list of pre-cached -components (and will have bundles created in the fallback `bundled` build). \ No newline at end of file +e.g. based on the route, or to progressively render non-critical sections of the +application. Each new demand-loaded fragment should be added to the list of +`fragments` in the included `polymer.json` file. This will ensure those +components and their dependencies are added to the list of pre-cached components +and will be included in the `bundled` build. From 79b1ca5f483269ad7945a6284d0de78a94da3bed Mon Sep 17 00:00:00 2001 From: Austin D Murdock Date: Fri, 17 Feb 2017 11:17:56 -0600 Subject: [PATCH 7/9] Fixing some basic linting issues --- .eslintrc.json | 4 +++- sw-precache-config.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ce13b20e9..c806025bb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,9 @@ { "extends": ["eslint:recommended", "google"], "env": { - "browser": true + "browser": true, + "es6": true, + "node": true }, "plugins": [ "html" diff --git a/sw-precache-config.js b/sw-precache-config.js index 4a23a185d..70e0da692 100644 --- a/sw-precache-config.js +++ b/sw-precache-config.js @@ -15,7 +15,7 @@ module.exports = { '/index.html', '/manifest.json', '/bower_components/webcomponentsjs/webcomponents-lite.min.js', - '/bower_components/babel-polyfill/babel-polyfill.js' + '/bower_components/babel-polyfill/babel-polyfill.js', ], navigateFallback: 'index.html', }; From 0e49c84e8941028ef93de8645e3a5dea052ff601 Mon Sep 17 00:00:00 2001 From: Austin D Murdock Date: Fri, 17 Feb 2017 11:30:31 -0600 Subject: [PATCH 8/9] Fixing remaining lint issues --- .eslintrc.json | 10 ++++++++-- index.html | 3 +++ package.json | 1 + src/config/app-config-endpoints.html | 3 +++ src/pages/my-page-view1/my-page-view1.html | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c806025bb..25b2f3735 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,13 +6,19 @@ "node": true }, "plugins": [ + "chai-expect", "html" ], "rules": { "no-var": "off", - "new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }] + "new-cap": ["error", { "capIsNewExceptions": ["Polymer"] }], + "max-len": [1, 120, 2, { "ignoreComments": true }], + "comma-dangle": 0 }, "globals": { - "Polymer": true + "Polymer": true, + "AppBehaviors": true, + "AppConfigs": true, + "expect": true } } diff --git a/index.html b/index.html index ae7da3ce0..2343fdffe 100644 --- a/index.html +++ b/index.html @@ -120,6 +120,9 @@ // Load webcomponentsjs polyfill if browser does not support native Web Components (() => { + /** + * Handles the initial loading of imports. + */ function onload() { // For native Imports, manually fire WebComponentsReady so user code // can use the same code path for native and polyfill'd imports. diff --git a/package.json b/package.json index 2ad990610..298fe99c3 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "devDependencies": { "eslint": "^3.12.0", "eslint-config-google": "^0.7.1", + "eslint-plugin-chai-expect": "^1.1.1", "eslint-plugin-html": "^1.7.0" }, "scripts": { diff --git a/src/config/app-config-endpoints.html b/src/config/app-config-endpoints.html index 608bdf71a..c6327f689 100644 --- a/src/config/app-config-endpoints.html +++ b/src/config/app-config-endpoints.html @@ -9,6 +9,9 @@ } }; + /** + * Resolves the base url for API rest calls by appending an apiSuffix as needed. + */ function resolveApiBaseUrl() { const config = AppEndpoints.apiBase; let {protocol, port = ''} = window.location; diff --git a/src/pages/my-page-view1/my-page-view1.html b/src/pages/my-page-view1/my-page-view1.html index 7701df4b2..7a43f9cdc 100644 --- a/src/pages/my-page-view1/my-page-view1.html +++ b/src/pages/my-page-view1/my-page-view1.html @@ -68,7 +68,7 @@

View One

event.stopPropagation(); this._isLocalesLoaded = true; // TODO: Resolve slow localize data binding in Firefox - //this.style.display = 'block'; + // this.style.display = 'block'; this.set('app.pageTitle', this.localize('home')); } }); From 4fe73e0290fe3e54f2bfa21fb97891583664f185 Mon Sep 17 00:00:00 2001 From: Austin D Murdock Date: Fri, 17 Feb 2017 11:44:23 -0600 Subject: [PATCH 9/9] Fix: addressing broken tests --- src/behaviors/app-localize-behavior.html | 2 ++ src/pages/my-page-view1/my-page-view1.html | 1 + test/index.html | 4 ++-- test/{my-view1.html => my-page-view1.html} | 7 ++++--- 4 files changed, 9 insertions(+), 5 deletions(-) rename test/{my-view1.html => my-page-view1.html} (84%) diff --git a/src/behaviors/app-localize-behavior.html b/src/behaviors/app-localize-behavior.html index ae73ca0a0..774afab96 100644 --- a/src/behaviors/app-localize-behavior.html +++ b/src/behaviors/app-localize-behavior.html @@ -12,6 +12,8 @@ diff --git a/test/my-view1.html b/test/my-page-view1.html similarity index 84% rename from test/my-view1.html rename to test/my-page-view1.html index fb2567460..a6c1bbc59 100644 --- a/test/my-view1.html +++ b/test/my-page-view1.html @@ -18,14 +18,15 @@ + - + @@ -38,7 +39,7 @@ }); it('Number in circle should be 1', () => { - const circle = Polymer.dom(element.root).querySelector('.circle'); + const circle = element.$$('.circle'); expect(circle.textContent).to.equal('1'); }); });