1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-02-24 00:36:48 -05:00
parent feb5e91986
commit 4da1e38cc5
26 changed files with 320 additions and 125 deletions

View file

@ -1,6 +1,6 @@
{
"name": "iron-autogrow-textarea",
"version": "1.0.11",
"version": "1.0.12",
"description": "A textarea element that automatically grows with input",
"authors": [
"The Polymer Authors"
@ -36,11 +36,11 @@
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.11",
"_release": "1.0.12",
"_resolution": {
"type": "version",
"tag": "v1.0.11",
"commit": "8fe629c9fecb14b76319ab4fbeef7f0237d93004"
"tag": "v1.0.12",
"commit": "86f8fd61b412bcea6bc7b8feaee9b24bc2ad48ea"
},
"_source": "git://github.com/PolymerElements/iron-autogrow-textarea.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "iron-autogrow-textarea",
"version": "1.0.11",
"version": "1.0.12",
"description": "A textarea element that automatically grows with input",
"authors": [
"The Polymer Authors"

View file

@ -23,9 +23,6 @@ Example:
<iron-autogrow-textarea></iron-autogrow-textarea>
Because the `textarea`'s `value` property is not observable, you should use
this element's `bind-value` instead for imperative updates.
### Styling
The following custom properties and mixins are available for styling:
@ -108,6 +105,7 @@ Custom property | Description | Default
<!-- size the input/textarea with a div, because the textarea has intrinsic size in ff -->
<div class="textarea-container fit">
<textarea id="textarea"
name$="[[name]]"
autocomplete$="[[autocomplete]]"
autofocus$="[[autofocus]]"
inputmode$="[[inputmode]]"
@ -137,6 +135,8 @@ Custom property | Description | Default
/**
* Use this property instead of `value` for two-way data binding.
* This property will be deprecated in the future. Use `value` instead.
* @type {string|number}
*/
bindValue: {
observer: '_bindValueChanged',
@ -193,23 +193,6 @@ Custom property | Description | Default
type: String
},
/**
* Bound to the textarea's `name` attribute.
*/
name: {
type: String
},
/**
* The value for this input, same as `bindValue`
*/
value: {
notify: true,
type: String,
value: '',
computed: '_computeValue(bindValue)'
},
/**
* Bound to the textarea's `placeholder` attribute.
*/
@ -244,6 +227,10 @@ Custom property | Description | Default
'input': '_onInput'
},
observers: [
'_onValueChanged(value)'
],
/**
* Returns the underlying textarea.
* @type HTMLTextAreaElement
@ -281,10 +268,6 @@ Custom property | Description | Default
set selectionEnd(value) {
this.$.textarea.selectionEnd = value;
},
ready: function() {
this.bindValue = this.value;
},
/**
* Returns true if `value` is valid. The validator provided in `validator`
@ -324,6 +307,7 @@ Custom property | Description | Default
textarea.value = !(this.bindValue || this.bindValue === 0) ? '' : this.bindValue;
}
this.value = this.bindValue;
this.$.mirror.innerHTML = this._valueForMirror();
// manually notify because we don't want to notify until after setting value
this.fire('bind-value-changed', {value: this.bindValue});
@ -362,8 +346,8 @@ Custom property | Description | Default
this.$.mirror.innerHTML = this._constrain(this.tokens);
},
_computeValue: function() {
return this.bindValue;
_onValueChanged: function() {
this.bindValue = this.value;
}
});
</script>

View file

@ -38,6 +38,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="has-value">
<template>
<iron-autogrow-textarea value="foobar"></iron-autogrow-textarea>
</template>
</test-fixture>
<test-fixture id="rows">
<template>
<iron-autogrow-textarea rows="3"></iron-autogrow-textarea>
@ -59,6 +65,31 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('can set an initial bindValue', function() {
var autogrow = fixture('has-bindValue');
assert.equal(autogrow.textarea.value, 'foobar', 'textarea value equals to initial bindValue');
assert.equal(autogrow.value, 'foobar', 'value equals to initial bindValue');
});
test('can set an initial value', function() {
var autogrow = fixture('has-value');
assert.equal(autogrow.textarea.value, 'foobar', 'textarea value equals to initial bindValue');
assert.equal(autogrow.bindValue, 'foobar', 'textarea bindValue equals to initial value');
});
test('can update the value', function() {
var autogrow = fixture('has-bindValue');
assert.equal(autogrow.textarea.value, 'foobar', 'textarea value equals to initial bindValue');
autogrow.value = 'batman';
assert.equal(autogrow.textarea.value, 'batman', 'textarea value is updated');
assert.equal(autogrow.bindValue, 'batman', 'bindValue is updated');
assert.equal(autogrow.value, 'batman', 'value is updated');
});
test('can update the bindValue', function() {
var autogrow = fixture('has-bindValue');
assert.equal(autogrow.textarea.value, 'foobar', 'textarea value equals to initial bindValue');
autogrow.bindValue = 'batman';
assert.equal(autogrow.textarea.value, 'batman', 'textarea value is updated');
assert.equal(autogrow.bindValue, 'batman', 'bindValue is updated');
assert.equal(autogrow.value, 'batman', 'value is updated');
});
test('can set an initial number of rows', function() {