Skip to content

Commit

Permalink
Updated to Polymer 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Download committed Sep 22, 2015
1 parent 9b7dec2 commit 94ae6c3
Show file tree
Hide file tree
Showing 310 changed files with 11,166 additions and 5,217 deletions.
713 changes: 371 additions & 342 deletions README.md

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions lib/firebase-element/.bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "firebase-element",
"version": "1.0.3",
"description": "An element that makes it easy to declaratively use the powerful firebase backend",
"version": "1.0.6",
"private": true,
"main": [
"firebase-collection.html",
Expand All @@ -21,11 +22,11 @@
"web-component-tester": "*"
},
"homepage": "https://github.com/GoogleWebComponents/firebase-element",
"_release": "1.0.3",
"_release": "1.0.6",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "6641f76631cc815a96e3e001fe1cd4e5d60556f0"
"tag": "v1.0.6",
"commit": "e0526a5a62c41b074e41ab3b0a0d21fb0b43ded0"
},
"_source": "git://github.com/GoogleWebComponents/firebase-element.git",
"_target": "^1.0.0",
Expand Down
3 changes: 2 additions & 1 deletion lib/firebase-element/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "firebase-element",
"version": "1.0.3",
"description": "An element that makes it easy to declaratively use the powerful firebase backend",
"version": "1.0.6",
"private": true,
"main": ["firebase-collection.html","firebase-document.html","firebase-auth.html","firebase-query-behavior.html"],
"dependencies": {
Expand Down
16 changes: 9 additions & 7 deletions lib/firebase-element/firebase-collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ <h4>[[dinosaur.__firebaseKey__]]</h4>
'firebase-child-added': '_onFirebaseChildAdded',
'firebase-child-removed': '_onFirebaseChildRemoved',
'firebase-child-changed': '_onFirebaseChildChanged',
'firebase-child-moved': '_onFirebaseChildChanged',
'firebase-child-moved': '_onFirebaseChildMoved',
},

/**
Expand Down Expand Up @@ -326,8 +326,6 @@ <h4>[[dinosaur.__firebaseKey__]]</h4>
this.remove(removed);
}, this);

this.data.splice(splice.index, splice.addedCount);

added.forEach(function(added) {
this.add(added);
}, this);
Expand Down Expand Up @@ -514,18 +512,22 @@ <h4>[[dinosaur.__firebaseKey__]]</h4>
var value = this._valueMap[key];
var previousChild;
var newIndex;
var currentIndex;
var previousIndex;

if (!value) {
this._error('Received firebase-child-moved event for unknown child "' + key + '"');
return;
}

previousValue = event.detail.previousChildName != null ?
previousChild = event.detail.previousChildName != null ?
this._valueMap[event.detail.previousChildName] : null;
newIndex = previousValue != null ?
this.data.indexOf(previousValue) + 1 : 0;

this.splice('data', this.data.indexOf(value), 1);
currentIndex = this.data.indexOf(value);
previousIndex = previousChild ? this.data.indexOf(previousChild) : -1;
newIndex = currentIndex > previousIndex ? previousIndex + 1 : previousIndex;

this.splice('data', currentIndex, 1);
this.splice('data', newIndex, 0, value);
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/firebase-element/firebase-document.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<firebase-document
location="https://dinosaur-facts.firebaseio.com/dinosaurs"
data="{{dinosaurs}}">
data="{{dinosaurs}}"></firebase-document>
In the above example, if the `dinosaurs` object is data-bound elsewhere via
Polymer's data-binding system, changes to the document will be automatically
Expand Down
7 changes: 6 additions & 1 deletion lib/firebase-element/firebase-query-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
},

_applyRemoteDataChange: function(applyChange) {
if (this._applyingLocalDataChanges) {
return;
}
this._receivingRemoteChanges = true;
applyChange.call(this);
this._receivingRemoteChanges = false;
Expand All @@ -84,7 +87,9 @@
return;
}

this._applyingLocalDataChanges = true;
this._applyLocalDataChanges(changes);
this._applyingLocalDataChanges = false;
},

_queryChanged: function(query, oldQuery) {
Expand Down Expand Up @@ -144,7 +149,7 @@
},

_onQueryChildMoved: function(childSnapshot, previousChildName) {
this._log('Firebase Event: "child_changed"', childSnapshot, previousChildName);
this._log('Firebase Event: "child_moved"', childSnapshot, previousChildName);
this.fire('firebase-child-moved', {
childSnapshot: childSnapshot,
previousChildName: previousChildName
Expand Down
41 changes: 41 additions & 0 deletions lib/firebase-element/test/firebase-collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,51 @@
</template>
</test-fixture>

<test-fixture id="BoundCollection">
<template>
<section>
<!-- TODO(cdata): Add support for elements like `dom-bind` at the root
of the template to `test-fixture`, so that we can remove this
wrapping `section`. -->
<template is="dom-bind">
<template is="dom-repeat" items="{{data}}">
<div>[[item.value]]</div>
</template>
<firebase-collection
location="https://fb-element-demo.firebaseio.com/test/empty"
data="{{data}}"
log>
</firebase-collection>
</template>
</section>
</template>
</test-fixture>

<script>
suite('<firebase-collection>', function() {
var firebase;

suite('collection manipulation', function() {
var domBind;
var dom;

setup(function() {
dom = fixture('BoundCollection');
domBind = dom.querySelector('[is=dom-bind]');
firebase = dom.querySelector('firebase-collection');
});

test('added values reflect 1-to-1 in the DOM', function(done) {
waitForEvent(firebase, 'firebase-value').then(function() {
waitForEvent(firebase, 'firebase-child-added').then(function() {
expect(dom.querySelectorAll('div').length).to.be.equal(firebase.data.length);
done();
});
domBind.unshift('data', { value: 'blah' });
});
});
});

suite('basic usage', function() {
setup(function() {
firebase = fixture('TrivialCollection');
Expand Down
2 changes: 1 addition & 1 deletion lib/font-roboto/.bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"commit": "21ce9b51a417fa9995cf6606e886aba0728f70a1"
},
"_source": "git://github.com/PolymerElements/font-roboto.git",
"_target": "^1.0.0",
"_target": "^1.0.1",
"_originalSource": "PolymerElements/font-roboto"
}
8 changes: 4 additions & 4 deletions lib/gold-cc-cvc-input/.bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gold-cc-cvc-input",
"version": "1.0.3",
"version": "1.0.4",
"description": "Provides an input field for a credit card cvc number",
"authors": [
"The Polymer Authors"
Expand Down Expand Up @@ -36,11 +36,11 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.3",
"_release": "1.0.4",
"_resolution": {
"type": "version",
"tag": "v1.0.3",
"commit": "a55d9f2e64f6a015374df5636126cacec2f0f484"
"tag": "v1.0.4",
"commit": "281c3cbebaf22d60b524c88347cdc586e9afc211"
},
"_source": "git://github.com/PolymerElements/gold-cc-cvc-input.git",
"_target": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion lib/gold-cc-cvc-input/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gold-cc-cvc-input",
"version": "1.0.3",
"version": "1.0.4",
"description": "Provides an input field for a credit card cvc number",
"authors": [
"The Polymer Authors"
Expand Down
4 changes: 2 additions & 2 deletions lib/gold-cc-cvc-input/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h4>Standard</h4>
<div class="vertical-section layout horizontal">
<gold-cc-cvc-input class="small"></gold-cc-cvc-input>
<gold-cc-cvc-input class="small" label="AMEX" card-type="amex"></gold-cc-cvc-input>
<gold-cc-cvc-input auto-validate label="Auto"></gold-cc-cvc-input>
<gold-cc-cvc-input auto-validate required label="Auto"></gold-cc-cvc-input>
</div>

<h4>Pre-validated</h4>
Expand All @@ -46,7 +46,7 @@ <h4>Pre-validated</h4>
<gold-cc-cvc-input required auto-validate value="12"></gold-cc-cvc-input>
</div>

<h4>Custom error message</h4>
<h4>Custom error message, auto-validates on blur</h4>
<div class="vertical-section">
<gold-cc-cvc-input required auto-validate error-message="Please enter a valid CVC"></gold-cc-cvc-input>
</div>
Expand Down
41 changes: 33 additions & 8 deletions lib/gold-cc-cvc-input/gold-cc-cvc-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
_amex: {
type: Boolean,
computed: '_computeIsAmex(cardType)'
},

value: {
observer: '_onValueChanged'
}
},

Expand All @@ -148,18 +152,24 @@
Polymer.IronFormElementBehavior
],

listeners: {
'input': '_onInput'
},
observers: [
'_onFocusedChanged(focused)'
],

ready: function() {
this._onInput();
// If there's an initial input, validate it.
if (this.value)
this._handleAutoValidate();
},

_onInput: function() {
if (this.autoValidate) {
this.validate();
}
/**
* A handler that is called on input
*/
_onValueChanged: function(value, oldValue) {
// The initial property assignment is handled by `ready`.
if (oldValue == undefined)
return;
this._handleAutoValidate();
},

_computeRequiredLength: function(cardType) {
Expand All @@ -170,6 +180,12 @@
return cardType.toLowerCase() == 'amex';
},

/**
* Returns true if the element has a valid value, and sets the visual
* error state.
*
* @return {boolean} Whether the input is currently valid or not.
*/
validate: function() {
// Empty, non-required input is valid.
if (!this.required && this.value == '') {
Expand All @@ -187,6 +203,15 @@
});

return valid;
},

/**
* Overidden from Polymer.IronControlState.
*/
_onFocusedChanged: function(focused) {
if (!focused) {
this._handleAutoValidate();
}
}
})

Expand Down
27 changes: 21 additions & 6 deletions lib/gold-cc-cvc-input/test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<script src="../../test-fixture/test-fixture-mocha.js"></script>

<script src="../../iron-test-helpers/test-helpers.js"></script>
<script src="../../iron-test-helpers/mock-interactions.js"></script>

<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="../gold-cc-cvc-input.html">
Expand Down Expand Up @@ -65,29 +66,43 @@
test('valid input is ok', function() {
var input = fixture('required');
input.value='123';
input._onInput();
forceXIfStamp(input);

var container = Polymer.dom(input.root).querySelector('paper-input-container');
assert.ok(container, 'paper-input-container exists');
assert.isFalse(container.invalid);

var error = Polymer.dom(input.root).querySelector('paper-input-error');
assert.ok(error, 'paper-input-error exists');
assert.equal(getComputedStyle(error).visibility, 'hidden', 'error is visibility:hidden');
});

test('invalid input is not ok', function() {
var input = fixture('required');
input.value='13';
input._onInput();
forceXIfStamp(input);

var container = Polymer.dom(input.root).querySelector('paper-input-container');
assert.ok(container, 'paper-input-container exists');
assert.isTrue(container.invalid);

var error = Polymer.dom(input.root).querySelector('paper-input-error');
assert.ok(error, 'paper-input-error exists');
assert.notEqual(getComputedStyle(error).visibility, 'hidden', 'error is not visibility:hidden');
});

test('empty required input shows error', function() {
test('empty required input shows error on blur', function() {
var input = fixture('required');
forceXIfStamp(input);

var error = Polymer.dom(input.root).querySelector('paper-input-error');
assert.ok(error, 'paper-input-error exists');
assert.notEqual(getComputedStyle(error).display, 'none', 'error is not display:none');

assert.equal(getComputedStyle(error).visibility, 'hidden', 'error is visibility:hidden');
MockInteractions.focus(input);
MockInteractions.blur(input);

assert.notEqual(getComputedStyle(error).visibility, 'hidden', 'error is not visibility:hidden');
});

test('invalid input shows error message after manual validation', function() {
Expand All @@ -97,9 +112,9 @@
assert.ok(error, 'paper-input-error exists');

// The error message is only displayed after manual validation.
assert.equal(getComputedStyle(error).display, 'none', 'error is not display:none');
assert.equal(getComputedStyle(error).visibility, 'hidden', 'error is visibility:hidden');
input.validate();
assert.notEqual(getComputedStyle(error).display, 'none', 'error is not display:none');
assert.notEqual(getComputedStyle(error).visibility, 'hidden', 'error is not visibility:hidden');
});
});

Expand Down
8 changes: 4 additions & 4 deletions lib/gold-cc-expiration-input/.bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gold-cc-expiration-input",
"version": "1.0.4",
"version": "1.0.5",
"description": "A validating input for a credit card expiration date",
"authors": [
"The Polymer Authors"
Expand Down Expand Up @@ -37,11 +37,11 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.4",
"_release": "1.0.5",
"_resolution": {
"type": "version",
"tag": "v1.0.4",
"commit": "bae2611413800ca8bbc6485d8245a171b120e98f"
"tag": "v1.0.5",
"commit": "0ee43e195427f8bba4d7f5498581901a0676f5de"
},
"_source": "git://github.com/PolymerElements/gold-cc-expiration-input.git",
"_target": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion lib/gold-cc-expiration-input/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gold-cc-expiration-input",
"version": "1.0.4",
"version": "1.0.5",
"description": "A validating input for a credit card expiration date",
"authors": [
"The Polymer Authors"
Expand Down
Loading

0 comments on commit 94ae6c3

Please sign in to comment.