update script loading
This commit is contained in:
parent
31b3061157
commit
22f689e089
65 changed files with 732 additions and 6138 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-input",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "Material design text fields",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -32,7 +32,8 @@
|
|||
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
|
||||
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
|
||||
"iron-input": "PolymerElements/iron-input#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0"
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
|
@ -44,11 +45,11 @@
|
|||
"web-component-tester": "Polymer/web-component-tester#^3.3.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.1.1",
|
||||
"_release": "1.1.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.1",
|
||||
"commit": "1bbce220b027dc030b294163f7da6f3e9052ab13"
|
||||
"tag": "v1.1.2",
|
||||
"commit": "6c6ba4b5e3e4b18ee387d2b922e00e3edfe0e347"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-input.git",
|
||||
"_target": "^1.0.9",
|
||||
|
|
|
@ -11,7 +11,7 @@ env:
|
|||
- secure: nh65tvhnhOrK05qKvDJKMV7Jm9yiCoG1wFkP3ZnqOHix9Ny+KmcTa41Bl6NXQdvYaMTFtzS7lMZX5cqIziyKyGWHVN30LzGMHJNz12fhcMi3nJ84trhQGcu/9qR9yDv16q9ouGlcz1VxnDOHaRAHnIKjLIbhN3aJtMtZBbnWihA=
|
||||
node_js: 4
|
||||
addons:
|
||||
firefox: '42.0'
|
||||
firefox: latest
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-input",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"description": "Material design text fields",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -32,7 +32,8 @@
|
|||
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
|
||||
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
|
||||
"iron-input": "PolymerElements/iron-input#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0"
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
|
|
|
@ -56,6 +56,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<div class="vertical center-justified layout">
|
||||
<h4>Text input</h4>
|
||||
|
||||
<div class="vertical-section">
|
||||
<paper-input label="label"></paper-input>
|
||||
|
||||
|
@ -90,7 +91,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<paper-textarea label="textarea" char-counter></paper-textarea>
|
||||
|
||||
<paper-textarea label="textarea with maxlength" char-counter maxlength="10"></paper-textarea>
|
||||
<paper-textarea label="textarea with maxlength" maxlength="10" char-counter></paper-textarea>
|
||||
|
||||
<paper-textarea label="text area with rows and max-rows" rows="3" max-rows="4"></paper-textarea>
|
||||
</div>
|
||||
|
@ -108,7 +109,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<paper-input class="short" label="icons and buttons" id="inputWithButton">
|
||||
<iron-icon icon="search" prefix></iron-icon>
|
||||
<paper-icon-button suffix onclick="clearInput()"
|
||||
icon="clear" alt="clear" title="clear" tabindex="0">
|
||||
icon="clear" alt="clear" title="clear">
|
||||
</paper-icon-button>
|
||||
</paper-input>
|
||||
</div>
|
||||
|
|
|
@ -9,6 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
-->
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-behaviors/iron-control-state.html">
|
||||
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -32,7 +33,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
*/
|
||||
|
||||
/**
|
||||
* The label for this input. Bind this to `<paper-input-container>`'s `label` property.
|
||||
* The label for this input. Bind this to `<label>`'s content and `hidden` property, e.g.
|
||||
* `<label hidden$="[[!label]]">[[label]]</label>` in your `template`
|
||||
*/
|
||||
label: {
|
||||
type: String
|
||||
|
@ -287,21 +289,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
},
|
||||
|
||||
/**
|
||||
* Bind this to the `<input is="iron-input">`'s `results` property, , used with type=search.
|
||||
* Bind this to the `<input is="iron-input">`'s `results` property, used with type=search.
|
||||
*/
|
||||
results: {
|
||||
type: Number
|
||||
},
|
||||
|
||||
/**
|
||||
* Bind this to the `<input is="iron-input">`'s `accept` property, , used with type=file.
|
||||
* Bind this to the `<input is="iron-input">`'s `accept` property, used with type=file.
|
||||
*/
|
||||
accept: {
|
||||
type: String
|
||||
},
|
||||
|
||||
/**
|
||||
* Bind this to the `<input is="iron-input">`'s `multiple` property, , used with type=file.
|
||||
* Bind this to the `<input is="iron-input">`'s `multiple` property, used with type=file.
|
||||
*/
|
||||
multiple: {
|
||||
type: Boolean
|
||||
|
@ -320,13 +322,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
},
|
||||
|
||||
listeners: {
|
||||
'addon-attached': '_onAddonAttached'
|
||||
'addon-attached': '_onAddonAttached',
|
||||
'focus': '_onFocus'
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_focusedControlStateChanged(focused)'
|
||||
],
|
||||
|
||||
keyBindings: {
|
||||
'shift+tab:keydown': '_onShiftTabDown'
|
||||
},
|
||||
|
||||
hostAttributes: {
|
||||
tabindex: 0
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a reference to the input element.
|
||||
*/
|
||||
|
@ -334,6 +345,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
return this.$.input;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a reference to the focusable element.
|
||||
*/
|
||||
get _focusableElement() {
|
||||
return this.inputElement;
|
||||
},
|
||||
|
||||
attached: function() {
|
||||
this._updateAriaLabelledBy();
|
||||
},
|
||||
|
@ -367,6 +385,29 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
return this.inputElement.validate();
|
||||
},
|
||||
|
||||
/**
|
||||
* Forward focus to inputElement
|
||||
*/
|
||||
_onFocus: function() {
|
||||
if (!this._shiftTabPressed) {
|
||||
this._focusableElement.focus();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handler that is called when a shift+tab keypress is detected by the menu.
|
||||
*
|
||||
* @param {CustomEvent} event A key combination event.
|
||||
*/
|
||||
_onShiftTabDown: function(event) {
|
||||
var oldTabIndex = this.getAttribute('tabindex');
|
||||
this._shiftTabPressed = true;
|
||||
this.setAttribute('tabindex', '-1');
|
||||
this.async(function() {
|
||||
this.setAttribute('tabindex', oldTabIndex);
|
||||
this._shiftTabPressed = false;
|
||||
}, 1);
|
||||
},
|
||||
/**
|
||||
* If `autoValidate` is true, then validates the element.
|
||||
*/
|
||||
|
@ -451,6 +492,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
};
|
||||
|
||||
/** @polymerBehavior */
|
||||
Polymer.PaperInputBehavior = [Polymer.IronControlState, Polymer.PaperInputBehaviorImpl];
|
||||
Polymer.PaperInputBehavior = [
|
||||
Polymer.IronControlState,
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.PaperInputBehaviorImpl
|
||||
];
|
||||
|
||||
</script>
|
||||
|
|
|
@ -83,7 +83,7 @@ Custom property | Description | Default
|
|||
`--paper-input-container-label-focus` | Mixin applied to the label when the input is focused | `{}`
|
||||
`--paper-input-container-input` | Mixin applied to the input | `{}`
|
||||
`--paper-input-container-underline` | Mixin applied to the underline | `{}`
|
||||
`--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focued | `{}`
|
||||
`--paper-input-container-underline-focus` | Mixin applied to the underline when the input is focused | `{}`
|
||||
`--paper-input-container-underline-disabled` | Mixin applied to the underline when the input is disabled | `{}`
|
||||
`--paper-input-prefix` | Mixin applied to the input prefix | `{}`
|
||||
`--paper-input-suffix` | Mixin applied to the input suffix | `{}`
|
||||
|
@ -179,7 +179,7 @@ This element is `display:block` by default, but you can set the `inline` attribu
|
|||
.input-content {
|
||||
position: relative;
|
||||
@apply(--layout-horizontal);
|
||||
@apply(--layout-end);
|
||||
@apply(--layout-center);
|
||||
}
|
||||
|
||||
.input-content ::content label,
|
||||
|
|
|
@ -48,11 +48,17 @@ as to not overlap the native UI (search icon, file button, etc.).
|
|||
|
||||
See `Polymer.PaperInputBehavior` for more API docs.
|
||||
|
||||
### Focus
|
||||
|
||||
To focus a paper-input, you can call the native `focus()` method as long as the
|
||||
paper input has a tab index.
|
||||
|
||||
### Styling
|
||||
|
||||
See `Polymer.PaperInputContainer` for a list of custom properties used to
|
||||
style this element.
|
||||
|
||||
|
||||
@group Paper Elements
|
||||
@element paper-input
|
||||
@hero hero.svg
|
||||
|
@ -118,6 +124,7 @@ style this element.
|
|||
autocapitalize$="[[autocapitalize]]"
|
||||
autocorrect$="[[autocorrect]]"
|
||||
on-change="_onChange"
|
||||
tabindex$="[[tabindex]]"
|
||||
autosave$="[[autosave]]"
|
||||
results$="[[results]]"
|
||||
accept$="[[accept]]"
|
||||
|
@ -144,8 +151,7 @@ style this element.
|
|||
|
||||
behaviors: [
|
||||
Polymer.IronFormElementBehavior,
|
||||
Polymer.PaperInputBehavior,
|
||||
Polymer.IronControlState
|
||||
Polymer.PaperInputBehavior
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -123,6 +123,10 @@ style this element.
|
|||
|
||||
_ariaDescribedByChanged: function(ariaDescribedBy) {
|
||||
this.$.input.textarea.setAttribute('aria-describedby', ariaDescribedBy);
|
||||
}
|
||||
},
|
||||
|
||||
get _focusableElement() {
|
||||
return this.$.input.textarea;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
<!DOCTYPE html><!--
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
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
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
--><html><head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<title>paper-input tests</title>
|
||||
|
@ -21,8 +18,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
'paper-textarea.html',
|
||||
'paper-input-container.html',
|
||||
'paper-input-error.html',
|
||||
'paper-input-char-counter.html'
|
||||
'paper-input-char-counter.html',
|
||||
'paper-input.html?dom=shadow',
|
||||
'paper-textarea.html?dom=shadow',
|
||||
'paper-input-container.html?dom=shadow',
|
||||
'paper-input-error.html?dom=shadow',
|
||||
'paper-input-char-counter.html?dom=shadow'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
</body></html>
|
||||
|
|
|
@ -37,6 +37,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="has-tabindex">
|
||||
<template>
|
||||
<paper-input tabindex="0"></paper-input>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="label">
|
||||
<template>
|
||||
<paper-input label="foo"></paper-input>
|
||||
|
@ -211,7 +217,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
});
|
||||
|
||||
|
||||
suite('validation', function() {
|
||||
|
||||
test('invalid attribute updated after calling validate()', function() {
|
||||
|
@ -255,6 +260,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.equal(input.inputElement.getAttribute('aria-describedby'), Polymer.dom(input.root).querySelector('paper-input-error').id + ' ' + Polymer.dom(input.root).querySelector('paper-input-char-counter').id, 'aria-describedby points to the error message and character counter');
|
||||
});
|
||||
|
||||
test('focus an input with tabindex', function(done) {
|
||||
var input = fixture('has-tabindex');
|
||||
flush(function() {
|
||||
MockInteractions.focus(input);
|
||||
flush(function() {
|
||||
assert.equal(input.shadowRoot ? input.shadowRoot.activeElement :
|
||||
document.activeElement, input._focusableElement);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -36,6 +36,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="has-tabindex">
|
||||
<template>
|
||||
<paper-textarea tabindex="0"></paper-input>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="label">
|
||||
<template>
|
||||
<paper-textarea label="foo"></paper-textarea>
|
||||
|
@ -128,7 +134,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
var inputContent = Polymer.dom(container.root).querySelector('.input-content');
|
||||
assert.isTrue(inputContent.classList.contains('label-is-floating'), 'label is floating');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('focus/blur events', function() {
|
||||
|
@ -155,6 +160,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.isTrue(nBlurEvents >= 1, 'blur event fired')
|
||||
});
|
||||
|
||||
test('focus a textarea with tabindex', function(done) {
|
||||
var input = fixture('has-tabindex');
|
||||
flush(function() {
|
||||
assert.notEqual(document.activeElement, input._focusableElement);
|
||||
MockInteractions.focus(input);
|
||||
setTimeout(function() {
|
||||
assert.equal(document.activeElement, input.shadowRoot ? input : input._focusableElement);
|
||||
done();
|
||||
}, 1);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
suite('a11y', function() {
|
||||
|
@ -186,7 +202,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
assert.equal(input.inputElement.textarea.getAttribute('aria-describedby'), Polymer.dom(input.root).querySelector('paper-input-error').id + ' ' + Polymer.dom(input.root).querySelector('paper-input-char-counter').id, 'aria-describedby points to the error message and character counter');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue