From e2b09860eaad8ac1b2977849bcbf48fbdf4fcfc4 Mon Sep 17 00:00:00 2001 From: Peter Halliday Date: Tue, 2 May 2017 10:33:23 -0700 Subject: [PATCH] adding initialization pending state --- app/src/ducklings/app/index.js | 1 + app/test/src/ducklings/app/index.js | 4 + bower.json | 3 +- bower_components/paper-spinner/.bower.json | 59 +++ .../paper-spinner/.github/ISSUE_TEMPLATE.md | 33 ++ bower_components/paper-spinner/.gitignore | 2 + bower_components/paper-spinner/.travis.yml | 28 ++ .../paper-spinner/CONTRIBUTING.md | 77 ++++ bower_components/paper-spinner/README.md | 49 +++ bower_components/paper-spinner/bower.json | 50 +++ .../paper-spinner/demo/index.html | 101 ++++++ bower_components/paper-spinner/hero.svg | 27 ++ bower_components/paper-spinner/index.html | 30 ++ .../paper-spinner/paper-spinner-behavior.html | 82 +++++ .../paper-spinner/paper-spinner-lite.html | 74 ++++ .../paper-spinner/paper-spinner-styles.html | 341 ++++++++++++++++++ .../paper-spinner/paper-spinner.html | 94 +++++ .../paper-spinner/test/index.html | 31 ++ .../paper-spinner/test/paper-spinner.html | 86 +++++ ui/src/initialize-passphrase.html | 56 +-- ui/src/initialize-pending.html | 38 ++ ui/src/ui-root.html | 26 +- ui/test/src/initialize-pending.html | 46 +++ ui/test/src/ui-root.html | 17 + 24 files changed, 1318 insertions(+), 37 deletions(-) create mode 100644 bower_components/paper-spinner/.bower.json create mode 100644 bower_components/paper-spinner/.github/ISSUE_TEMPLATE.md create mode 100644 bower_components/paper-spinner/.gitignore create mode 100644 bower_components/paper-spinner/.travis.yml create mode 100644 bower_components/paper-spinner/CONTRIBUTING.md create mode 100644 bower_components/paper-spinner/README.md create mode 100644 bower_components/paper-spinner/bower.json create mode 100644 bower_components/paper-spinner/demo/index.html create mode 100755 bower_components/paper-spinner/hero.svg create mode 100644 bower_components/paper-spinner/index.html create mode 100644 bower_components/paper-spinner/paper-spinner-behavior.html create mode 100644 bower_components/paper-spinner/paper-spinner-lite.html create mode 100644 bower_components/paper-spinner/paper-spinner-styles.html create mode 100644 bower_components/paper-spinner/paper-spinner.html create mode 100644 bower_components/paper-spinner/test/index.html create mode 100644 bower_components/paper-spinner/test/paper-spinner.html create mode 100644 ui/src/initialize-pending.html create mode 100644 ui/test/src/initialize-pending.html diff --git a/app/src/ducklings/app/index.js b/app/src/ducklings/app/index.js index 3af933e..1a1bdaa 100644 --- a/app/src/ducklings/app/index.js +++ b/app/src/ducklings/app/index.js @@ -31,6 +31,7 @@ export default factory( const completeClear = action('COMPLETE_CLEAR'); return { initialState: { + pending: true, count: 0, settings: undefined, }, diff --git a/app/test/src/ducklings/app/index.js b/app/test/src/ducklings/app/index.js index b73402e..fff31e5 100644 --- a/app/test/src/ducklings/app/index.js +++ b/app/test/src/ducklings/app/index.js @@ -87,6 +87,10 @@ describe('ducklings', () => { }); describe('initial state', () => { + it('should be pending', () => { + app.isPending(initialState).should.be.true; + }); + it('should not have settings entries', () => { app.hasSettings(initialState).should.be.false; }); diff --git a/bower.json b/bower.json index e06d135..8291e84 100644 --- a/bower.json +++ b/bower.json @@ -24,7 +24,8 @@ "paper-button": "PolymerElements/paper-button#2.0-preview", "paper-styles": "PolymerElements/paper-styles#2.0-preview", "paper-card": "PolymerElements/paper-card#2.0-preview", - "polymer-redux": "polymer-2" + "polymer-redux": "polymer-2", + "paper-spinner": "PolymerElements/paper-spinner#2.0-preview" }, "devDependencies": { "web-component-tester": "Polymer/web-component-tester#^v6.0.0-prerelease.9" diff --git a/bower_components/paper-spinner/.bower.json b/bower_components/paper-spinner/.bower.json new file mode 100644 index 0000000..a866831 --- /dev/null +++ b/bower_components/paper-spinner/.bower.json @@ -0,0 +1,59 @@ +{ + "name": "paper-spinner", + "description": "A material design spinner", + "authors": [ + "The Polymer Authors" + ], + "keywords": [ + "web-components", + "polymer", + "spinner", + "loading" + ], + "private": true, + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/paper-spinner" + }, + "license": "http://polymer.github.io/LICENSE.txt", + "homepage": "https://github.com/PolymerElements/paper-spinner", + "ignore": [], + "dependencies": { + "paper-styles": "PolymerElements/paper-styles#2.0-preview", + "polymer": "Polymer/polymer#^2.0.0-rc.1" + }, + "devDependencies": { + "iron-component-page": "PolymerElements/iron-component-page#2.0-preview", + "iron-demo-helpers": "PolymerElements/iron-demo-helpers#2.0-preview", + "web-component-tester": "Polymer/web-component-tester#^6.0.0-prerelease.6", + "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0-rc.1" + }, + "main": [ + "paper-spinner.html", + "paper-spinner-lite.html" + ], + "variants": { + "1.x": { + "dependencies": { + "polymer": "Polymer/polymer#^1.7.1", + "paper-styles": "PolymerElements/paper-styles#^1.0.0" + }, + "devDependencies": { + "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", + "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", + "web-component-tester": "Polymer/web-component-tester#^4.0.0" + } + } + }, + "_release": "ecb0d932de", + "_resolution": { + "type": "branch", + "branch": "2.0-preview", + "commit": "ecb0d932de650184ec5724dca13364aa537b6846" + }, + "_source": "https://github.com/PolymerElements/paper-spinner.git", + "_target": "2.0-preview", + "_originalSource": "PolymerElements/paper-spinner", + "_direct": true +} \ No newline at end of file diff --git a/bower_components/paper-spinner/.github/ISSUE_TEMPLATE.md b/bower_components/paper-spinner/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..f1a728a --- /dev/null +++ b/bower_components/paper-spinner/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,33 @@ + +### Description + + +### Expected outcome + + + +### Actual outcome + + + +### Live Demo + + +### Steps to reproduce + + + +### Browsers Affected + +- [ ] Chrome +- [ ] Firefox +- [ ] Safari 9 +- [ ] Safari 8 +- [ ] Safari 7 +- [ ] Edge +- [ ] IE 11 +- [ ] IE 10 diff --git a/bower_components/paper-spinner/.gitignore b/bower_components/paper-spinner/.gitignore new file mode 100644 index 0000000..2be39e4 --- /dev/null +++ b/bower_components/paper-spinner/.gitignore @@ -0,0 +1,2 @@ +bower_components* +bower-*.json diff --git a/bower_components/paper-spinner/.travis.yml b/bower_components/paper-spinner/.travis.yml new file mode 100644 index 0000000..f80c186 --- /dev/null +++ b/bower_components/paper-spinner/.travis.yml @@ -0,0 +1,28 @@ +language: node_js +sudo: required +before_script: + - npm install -g bower polymer-cli@next + - polymer install --variants + - sudo mv /usr/bin/google-chrome /usr/bin/google-chrome-old + - sudo mv /usr/bin/google-chrome-beta /usr/bin/google-chrome +env: + global: + - secure: >- + dIA8M55rHJN07lbp0VCU9RkN4CWlbkVdU6cP4wFZabuJJusISThMZVrZeGtbdErvQ8oiSexrE8iCZ7A/OcLnVNCrVBZX5YwJlfbex4I4uG6L8zw1E3oOX1MmdcTx2sI8MffDyG1pnXzwP5lzPItKiscEpepGY9+V0JP1j5z9qVg= + - secure: >- + KvttUgmPIlCz4WU2WIpse5s/1SVXHoS+snGDkNqYLOVXscRjJoncXYbdvLltf7SPrU7gK4HuEuEVRthhDGtuvgrXUlIOS/gaK8dWI3kuVYPppOU1DnlXgAtj/3quGZG1dNw07IGzOEW4Taq/5KdU8LRqb9clvK+jyoBQZKIXbtg= +node_js: stable +addons: + firefox: latest + apt: + sources: + - google-chrome + packages: + - google-chrome-beta + sauce_connect: true +script: + - xvfb-run polymer test + - >- + if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then polymer test -s 'default'; + fi +dist: trusty diff --git a/bower_components/paper-spinner/CONTRIBUTING.md b/bower_components/paper-spinner/CONTRIBUTING.md new file mode 100644 index 0000000..093090d --- /dev/null +++ b/bower_components/paper-spinner/CONTRIBUTING.md @@ -0,0 +1,77 @@ + + +# Polymer Elements +## Guide for Contributors + +Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines: + +### Filing Issues + +**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions: + + 1. **Who will use the feature?** _“As someone filling out a form…”_ + 2. **When will they use the feature?** _“When I enter an invalid value…”_ + 3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_ + +**If you are filing an issue to report a bug**, please provide: + + 1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug: + + ```markdown + The `paper-foo` element causes the page to turn pink when clicked. + + ## Expected outcome + + The page stays the same color. + + ## Actual outcome + + The page turns pink. + + ## Steps to reproduce + + 1. Put a `paper-foo` element in the page. + 2. Open the page in a web browser. + 3. Click the `paper-foo` element. + ``` + + 2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output). + + 3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers. + +### Submitting Pull Requests + +**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request. + +When submitting pull requests, please provide: + + 1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax: + + ```markdown + (For a single issue) + Fixes #20 + + (For multiple issues) + Fixes #32, fixes #40 + ``` + + 2. **A succinct description of the design** used to fix any related issues. For example: + + ```markdown + This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked. + ``` + + 3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered. + +If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that! diff --git a/bower_components/paper-spinner/README.md b/bower_components/paper-spinner/README.md new file mode 100644 index 0000000..7ade4e9 --- /dev/null +++ b/bower_components/paper-spinner/README.md @@ -0,0 +1,49 @@ +[![Build status](https://travis-ci.org/PolymerElements/paper-spinner.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-spinner) + +## <paper-spinner> + +Material design: [Progress & activity](https://www.google.com/design/spec/components/progress-activity.html) + +Element providing a multiple color material design circular spinner. + + +```html +... + + + + +``` diff --git a/bower_components/paper-spinner/bower.json b/bower_components/paper-spinner/bower.json new file mode 100644 index 0000000..76d3e38 --- /dev/null +++ b/bower_components/paper-spinner/bower.json @@ -0,0 +1,50 @@ +{ + "name": "paper-spinner", + "version": "2.0.0", + "description": "A material design spinner", + "authors": [ + "The Polymer Authors" + ], + "keywords": [ + "web-components", + "polymer", + "spinner", + "loading" + ], + "private": true, + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/paper-spinner" + }, + "license": "http://polymer.github.io/LICENSE.txt", + "homepage": "https://github.com/PolymerElements/paper-spinner", + "ignore": [], + "dependencies": { + "paper-styles": "PolymerElements/paper-styles#2.0-preview", + "polymer": "Polymer/polymer#^2.0.0-rc.1" + }, + "devDependencies": { + "iron-component-page": "PolymerElements/iron-component-page#2.0-preview", + "iron-demo-helpers": "PolymerElements/iron-demo-helpers#2.0-preview", + "web-component-tester": "Polymer/web-component-tester#^6.0.0-prerelease.6", + "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0-rc.1" + }, + "main": [ + "paper-spinner.html", + "paper-spinner-lite.html" + ], + "variants": { + "1.x": { + "dependencies": { + "polymer": "Polymer/polymer#^1.7.1", + "paper-styles": "PolymerElements/paper-styles#^1.0.0" + }, + "devDependencies": { + "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", + "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0", + "web-component-tester": "Polymer/web-component-tester#^4.0.0" + } + } + } +} diff --git a/bower_components/paper-spinner/demo/index.html b/bower_components/paper-spinner/demo/index.html new file mode 100644 index 0000000..71feb30 --- /dev/null +++ b/bower_components/paper-spinner/demo/index.html @@ -0,0 +1,101 @@ + + + + + paper-spinner demo + + + + + + + + + + + + + + + + + + + +
+

Spinners can be deactivated or activated

+ + + + +

Spinners can be styled using custom properties

+ + + +
+ + + + diff --git a/bower_components/paper-spinner/hero.svg b/bower_components/paper-spinner/hero.svg new file mode 100755 index 0000000..034b1f1 --- /dev/null +++ b/bower_components/paper-spinner/hero.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/bower_components/paper-spinner/index.html b/bower_components/paper-spinner/index.html new file mode 100644 index 0000000..9874334 --- /dev/null +++ b/bower_components/paper-spinner/index.html @@ -0,0 +1,30 @@ + + + + + + + + + paper-spinner + + + + + + + + + + + + + diff --git a/bower_components/paper-spinner/paper-spinner-behavior.html b/bower_components/paper-spinner/paper-spinner-behavior.html new file mode 100644 index 0000000..392ff2f --- /dev/null +++ b/bower_components/paper-spinner/paper-spinner-behavior.html @@ -0,0 +1,82 @@ + + + + + diff --git a/bower_components/paper-spinner/paper-spinner-lite.html b/bower_components/paper-spinner/paper-spinner-lite.html new file mode 100644 index 0000000..2d37044 --- /dev/null +++ b/bower_components/paper-spinner/paper-spinner-lite.html @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + diff --git a/bower_components/paper-spinner/paper-spinner-styles.html b/bower_components/paper-spinner/paper-spinner-styles.html new file mode 100644 index 0000000..b606109 --- /dev/null +++ b/bower_components/paper-spinner/paper-spinner-styles.html @@ -0,0 +1,341 @@ + + + + + diff --git a/bower_components/paper-spinner/paper-spinner.html b/bower_components/paper-spinner/paper-spinner.html new file mode 100644 index 0000000..c182908 --- /dev/null +++ b/bower_components/paper-spinner/paper-spinner.html @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + diff --git a/bower_components/paper-spinner/test/index.html b/bower_components/paper-spinner/test/index.html new file mode 100644 index 0000000..352eef4 --- /dev/null +++ b/bower_components/paper-spinner/test/index.html @@ -0,0 +1,31 @@ + + + paper-spinner tests + + + + + + + + + + + + + + + diff --git a/bower_components/paper-spinner/test/paper-spinner.html b/bower_components/paper-spinner/test/paper-spinner.html new file mode 100644 index 0000000..9e392ef --- /dev/null +++ b/bower_components/paper-spinner/test/paper-spinner.html @@ -0,0 +1,86 @@ + + + + + + + paper-spinner basic tests + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui/src/initialize-passphrase.html b/ui/src/initialize-passphrase.html index 2f1578c..9e20de1 100644 --- a/ui/src/initialize-passphrase.html +++ b/ui/src/initialize-passphrase.html @@ -9,34 +9,34 @@ + diff --git a/ui/src/ui-root.html b/ui/src/ui-root.html index d800d36..01b7cf8 100644 --- a/ui/src/ui-root.html +++ b/ui/src/ui-root.html @@ -1,6 +1,7 @@ + @@ -17,7 +18,12 @@
[[localize('app-title')]]
- + + @@ -35,6 +41,10 @@ language: { value: 'en', }, + isPending: { + type: Boolean, + statePath: app.isPending, + }, hasError: { type: Boolean, statePath: app.hasError, @@ -43,19 +53,15 @@ type: String, statePath: app.getErrorText, }, - isPending: { - type: Boolean, - statePath: app.isPending, - }, - count: { + hasSettings: { type: Boolean, statePath: app.hasSettings, }, - count: { + isUnlocked: { type: Boolean, statePath: app.isUnlocked, }, - count: { + settings: { type: Object, statePath: app.getSettings, }, @@ -72,6 +78,10 @@ this.loadResources(this.resolveUrl('../../locales.json')); this.dispatch('initialize'); } + + _initialize(isPending, hasSettings) { + return !isPending && !hasSettings; + } } window.customElements.define(UiRoot.is, UiRoot); diff --git a/ui/test/src/initialize-pending.html b/ui/test/src/initialize-pending.html new file mode 100644 index 0000000..a240c02 --- /dev/null +++ b/ui/test/src/initialize-pending.html @@ -0,0 +1,46 @@ + + + + + + + initialize-passphrase + + + + + + + + + + + + + + + diff --git a/ui/test/src/ui-root.html b/ui/test/src/ui-root.html index 22a2e99..4e233d2 100644 --- a/ui/test/src/ui-root.html +++ b/ui/test/src/ui-root.html @@ -45,6 +45,23 @@ app.initialize.value ); }); + + describe('while initialization is pending', function() { + beforeEach(function(done) { + app.helpers.reset(); + app.isPending.value = true; + app.helpers.notifyStateChange(); + flush(done); + }); + + it('should display the pending component', function() { + uiRoot.root.querySelector('#pending').style.display.should.eql(''); + }); + + it('should not display the initialize component', function() { + uiRoot.root.querySelector('#initialize').style.display.should.eql('none'); + }); + }); });