mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add new slider
This commit is contained in:
parent
e33e5875cf
commit
09d4af3357
133 changed files with 9418 additions and 256 deletions
45
dashboard-ui/bower_components/iron-input/.bower.json
vendored
Normal file
45
dashboard-ui/bower_components/iron-input/.bower.json
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "iron-input",
|
||||
"version": "1.0.3",
|
||||
"description": "An input element with data binding",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"input"
|
||||
],
|
||||
"main": [
|
||||
"iron-input.html"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/iron-input.git"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/iron-input",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.2",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-validator-behavior": "PolymerElements/iron-validator-behavior#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.3",
|
||||
"commit": "edb505f41d67120cb505deedb92aa69e90078d2f"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-input.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-input"
|
||||
}
|
1
dashboard-ui/bower_components/iron-input/.gitignore
vendored
Normal file
1
dashboard-ui/bower_components/iron-input/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
bower_components
|
36
dashboard-ui/bower_components/iron-input/bower.json
vendored
Normal file
36
dashboard-ui/bower_components/iron-input/bower.json
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "iron-input",
|
||||
"version": "1.0.3",
|
||||
"description": "An input element with data binding",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"input"
|
||||
],
|
||||
"main": [
|
||||
"iron-input.html"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/iron-input.git"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/iron-input",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.2",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-validator-behavior": "PolymerElements/iron-validator-behavior#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
}
|
||||
}
|
87
dashboard-ui/bower_components/iron-input/demo/index.html
vendored
Normal file
87
dashboard-ui/bower_components/iron-input/demo/index.html
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 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>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
||||
|
||||
<title>iron-input demo</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../iron-input.html">
|
||||
|
||||
<link href="../../paper-styles/paper-styles.html" rel="import">
|
||||
<link href="../../paper-styles/demo-pages.html" rel="import">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
.vertical-section {
|
||||
@apply(--paper-font-body1);
|
||||
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
code {
|
||||
color: var(--google-grey-700);
|
||||
}
|
||||
|
||||
input[is=iron-input] {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input, button {
|
||||
font-size: 20px;
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="vertical-section vertical-section-container centered">
|
||||
<template is="dom-bind">
|
||||
<p>
|
||||
<input is="iron-input" bind-value="{{bindValue}}" value="{{value::input}}">
|
||||
<br>
|
||||
bind to <code>bind-value</code>: <b>[[bindValue]]</b>
|
||||
<br>
|
||||
bind to <code>value::input</code>: <b>{{value}}</b>
|
||||
</p>
|
||||
|
||||
<p on-click="setValue">
|
||||
set bind-value to: <input> <button is="paper-button" value="bindValue">set</button>
|
||||
<br>
|
||||
set value to: <input> <button value="value">set</button>
|
||||
</p>
|
||||
</template>
|
||||
<p>only allows these characters:
|
||||
<code>!@#0123456789</code></p>
|
||||
<input is="iron-input" allowed-pattern="[!@#0-9]" prevent-invalid-input>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var scope = document.querySelector('template[is=dom-bind]');
|
||||
|
||||
scope.setValue = function(event) {
|
||||
if (!(event.target instanceof HTMLButtonElement)) {
|
||||
return;
|
||||
}
|
||||
document.querySelector('input[is=iron-input]')[event.target.value] = event.target.previousElementSibling.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
19
dashboard-ui/bower_components/iron-input/hero.svg
vendored
Normal file
19
dashboard-ui/bower_components/iron-input/hero.svg
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
||||
<g id="background" display="none">
|
||||
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
||||
</g>
|
||||
<g id="label">
|
||||
</g>
|
||||
<g id="art">
|
||||
<rect x="49" y="53" width="2" height="18"/>
|
||||
<path d="M188,78H37V44h151V78z M39,76h147V46H39V76z"/>
|
||||
<g id="ic_x5F_add_x0D_">
|
||||
</g>
|
||||
</g>
|
||||
<g id="Guides">
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 733 B |
30
dashboard-ui/bower_components/iron-input/index.html
vendored
Normal file
30
dashboard-ui/bower_components/iron-input/index.html
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 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>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
|
||||
<title>iron-input</title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-component-page/iron-component-page.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iron-component-page></iron-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
237
dashboard-ui/bower_components/iron-input/iron-input.html
vendored
Normal file
237
dashboard-ui/bower_components/iron-input/iron-input.html
vendored
Normal file
|
@ -0,0 +1,237 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 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
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
/*
|
||||
`<iron-input>` adds two-way binding and custom validators using `Polymer.IronValidatorBehavior`
|
||||
to `<input>`.
|
||||
|
||||
### Two-way binding
|
||||
|
||||
By default you can only get notified of changes to an `input`'s `value` due to user input:
|
||||
|
||||
<input value="{{myValue::input}}">
|
||||
|
||||
`iron-input` adds the `bind-value` property that mirrors the `value` property, and can be used
|
||||
for two-way data binding. `bind-value` will notify if it is changed either by user input or by script.
|
||||
|
||||
<input is="iron-input" bind-value="{{myValue}}">
|
||||
|
||||
### Custom validators
|
||||
|
||||
You can use custom validators that implement `Polymer.IronValidatorBehavior` with `<iron-input>`.
|
||||
|
||||
<input is="iron-input" validator="my-custom-validator">
|
||||
|
||||
### Stopping invalid input
|
||||
|
||||
It may be desirable to only allow users to enter certain characters. You can use the
|
||||
`prevent-invalid-input` and `allowed-pattern` attributes together to accomplish this. This feature
|
||||
is separate from validation, and `allowed-pattern` does not affect how the input is validated.
|
||||
|
||||
<!-- only allow characters that match [0-9] -->
|
||||
<input is="iron-input" prevent-invaild-input allowed-pattern="[0-9]">
|
||||
|
||||
@hero hero.svg
|
||||
@demo demo/index.html
|
||||
*/
|
||||
|
||||
Polymer({
|
||||
|
||||
is: 'iron-input',
|
||||
|
||||
extends: 'input',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronValidatableBehavior
|
||||
],
|
||||
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* Use this property instead of `value` for two-way data binding.
|
||||
*/
|
||||
bindValue: {
|
||||
observer: '_bindValueChanged',
|
||||
type: String
|
||||
},
|
||||
|
||||
/**
|
||||
* Set to true to prevent the user from entering invalid input. The new input characters are
|
||||
* matched with `allowedPattern` if it is set, otherwise it will use the `pattern` attribute if
|
||||
* set, or the `type` attribute (only supported for `type=number`).
|
||||
*/
|
||||
preventInvalidInput: {
|
||||
type: Boolean
|
||||
},
|
||||
|
||||
/**
|
||||
* Regular expression to match valid input characters.
|
||||
*/
|
||||
allowedPattern: {
|
||||
type: String
|
||||
},
|
||||
|
||||
_previousValidInput: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
|
||||
_patternAlreadyChecked: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
listeners: {
|
||||
'input': '_onInput',
|
||||
'keypress': '_onKeypress'
|
||||
},
|
||||
|
||||
get _patternRegExp() {
|
||||
var pattern;
|
||||
if (this.allowedPattern) {
|
||||
pattern = new RegExp(this.allowedPattern);
|
||||
} else if (this.pattern) {
|
||||
pattern = new RegExp(this.pattern);
|
||||
} else {
|
||||
switch (this.type) {
|
||||
case 'number':
|
||||
pattern = /[0-9.,e-]/;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pattern;
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
this.bindValue = this.value;
|
||||
},
|
||||
|
||||
_bindValueChanged: function() {
|
||||
if (this.value !== this.bindValue) {
|
||||
this.value = !this.bindValue ? '' : this.bindValue;
|
||||
}
|
||||
// manually notify because we don't want to notify until after setting value
|
||||
this.fire('bind-value-changed', {value: this.bindValue});
|
||||
},
|
||||
|
||||
_onInput: function() {
|
||||
// Need to validate each of the characters pasted if they haven't
|
||||
// been validated inside `_onKeypress` already.
|
||||
if (this.preventInvalidInput && !this._patternAlreadyChecked) {
|
||||
var valid = this._checkPatternValidity();
|
||||
if (!valid) {
|
||||
this.value = this._previousValidInput;
|
||||
}
|
||||
}
|
||||
|
||||
this.bindValue = this.value;
|
||||
this._previousValidInput = this.value;
|
||||
this._patternAlreadyChecked = false;
|
||||
},
|
||||
|
||||
_isPrintable: function(event) {
|
||||
// What a control/printable character is varies wildly based on the browser.
|
||||
// - most control characters (arrows, backspace) do not send a `keypress` event
|
||||
// in Chrome, but the *do* on Firefox
|
||||
// - in Firefox, when they do send a `keypress` event, control chars have
|
||||
// a charCode = 0, keyCode = xx (for ex. 40 for down arrow)
|
||||
// - printable characters always send a keypress event.
|
||||
// - in Firefox, printable chars always have a keyCode = 0. In Chrome, the keyCode
|
||||
// always matches the charCode.
|
||||
// None of this makes any sense.
|
||||
|
||||
var nonPrintable =
|
||||
(event.keyCode == 8) || // backspace
|
||||
(event.keyCode == 19) || // pause
|
||||
(event.keyCode == 20) || // caps lock
|
||||
(event.keyCode == 27) || // escape
|
||||
(event.keyCode == 45) || // insert
|
||||
(event.keyCode == 46) || // delete
|
||||
(event.keyCode == 144) || // num lock
|
||||
(event.keyCode == 145) || // scroll lock
|
||||
(event.keyCode > 32 && event.keyCode < 41) || // page up/down, end, home, arrows
|
||||
(event.keyCode > 111 && event.keyCode < 124); // fn keys
|
||||
|
||||
return !(event.charCode == 0 && nonPrintable);
|
||||
},
|
||||
|
||||
_onKeypress: function(event) {
|
||||
if (!this.preventInvalidInput && this.type !== 'number') {
|
||||
return;
|
||||
}
|
||||
var regexp = this._patternRegExp;
|
||||
if (!regexp) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle special keys and backspace
|
||||
if (event.metaKey || event.ctrlKey || event.altKey)
|
||||
return;
|
||||
|
||||
// Check the pattern either here or in `_onInput`, but not in both.
|
||||
this._patternAlreadyChecked = true;
|
||||
|
||||
var thisChar = String.fromCharCode(event.charCode);
|
||||
if (this._isPrintable(event) && !regexp.test(thisChar)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
_checkPatternValidity: function() {
|
||||
var regexp = this._patternRegExp;
|
||||
if (!regexp) {
|
||||
return true;
|
||||
}
|
||||
for (var i = 0; i < this.value.length; i++) {
|
||||
if (!regexp.test(this.value[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if `value` is valid. The validator provided in `validator` will be used first,
|
||||
* then any constraints.
|
||||
* @return {boolean} True if the value is valid.
|
||||
*/
|
||||
validate: function() {
|
||||
// Empty, non-required input is valid.
|
||||
if (!this.required && this.value == '') {
|
||||
this.invalid = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
var valid;
|
||||
if (this.hasValidator()) {
|
||||
valid = Polymer.IronValidatableBehavior.validate.call(this, this.value);
|
||||
} else {
|
||||
this.invalid = !this.validity.valid;
|
||||
valid = this.validity.valid;
|
||||
}
|
||||
this.fire('iron-input-validate');
|
||||
return valid;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
The `iron-input-validate` event is fired whenever `validate()` is called.
|
||||
@event iron-input-validate
|
||||
*/
|
||||
|
||||
</script>
|
24
dashboard-ui/bower_components/iron-input/test/index.html
vendored
Normal file
24
dashboard-ui/bower_components/iron-input/test/index.html
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!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>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<title>iron-input ests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'iron-input.html',
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
139
dashboard-ui/bower_components/iron-input/test/iron-input.html
vendored
Normal file
139
dashboard-ui/bower_components/iron-input/test/iron-input.html
vendored
Normal file
|
@ -0,0 +1,139 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
Copyright (c) 2015 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>
|
||||
|
||||
<title>iron-input tests</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../iron-input.html">
|
||||
<link rel="import" href="letters-only.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="basic">
|
||||
<template>
|
||||
<input is="iron-input">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="has-value">
|
||||
<template>
|
||||
<input is="iron-input" value="foobar">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="has-bind-value">
|
||||
<template>
|
||||
<input is="iron-input" bind-value="foobar">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="prevent-invalid-input">
|
||||
<template>
|
||||
<input is="iron-input" prevent-invalid-input pattern="[0-9]">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="prevent-invalid-input-has-value">
|
||||
<template>
|
||||
<input is="iron-input" prevent-invalid-input pattern="[0-9]*" value="foobar">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="prevent-invalid-input-has-bind-value">
|
||||
<template>
|
||||
<input is="iron-input" prevent-invalid-input pattern="[0-9]*" bind-value="foobar">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="has-validator">
|
||||
<template>
|
||||
<letters-only></letters-only>
|
||||
<input is="iron-input" validator="letters-only" pattern="[0-9]*">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<template is="dom-bind" id="bind-to-object">
|
||||
<input is="iron-input" id="input" bind-value="{{foo}}">
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
suite('basic', function() {
|
||||
|
||||
test('setting bindValue sets value', function() {
|
||||
var input = fixture('basic');
|
||||
input.bindValue = 'foobar';
|
||||
assert.equal(input.value, input.bindValue, 'value equals to bindValue');
|
||||
});
|
||||
|
||||
test('changing the input triggers an event', function(done) {
|
||||
var input = fixture('basic');
|
||||
|
||||
input.addEventListener('bind-value-changed', function(value) {
|
||||
assert.equal(input.value, input.bindValue, 'value equals to bindValue');
|
||||
done();
|
||||
});
|
||||
|
||||
input.value = "foo";
|
||||
input._onInput();
|
||||
});
|
||||
|
||||
test('default value sets bindValue', function() {
|
||||
var input = fixture('has-value');
|
||||
assert.equal(input.bindValue, input.value, 'bindValue equals value');
|
||||
});
|
||||
|
||||
test('default bindValue sets value', function() {
|
||||
var input = fixture('has-bind-value');
|
||||
assert.equal(input.value, input.bindValue, 'value equals to bindValue');
|
||||
});
|
||||
|
||||
test('set bindValue to undefined', function() {
|
||||
var scope = document.getElementById('bind-to-object');
|
||||
scope.foo = undefined;
|
||||
assert.ok(!scope.$.input.bindValue, 'bindValue is falsy');
|
||||
assert.ok(!scope.$.input.value, 'value is falsy');
|
||||
});
|
||||
|
||||
test('validator used instead of constraints api if provided', function() {
|
||||
var input = fixture('has-validator')[1];
|
||||
input.value = '123';
|
||||
input.validate();
|
||||
assert.isTrue(input.invalid, 'input is invalid');
|
||||
});
|
||||
|
||||
test('prevent invalid input works in _onInput', function() {
|
||||
var input = fixture('prevent-invalid-input');
|
||||
input.value = '123';
|
||||
input._onInput();
|
||||
assert.equal(input.bindValue, '123');
|
||||
|
||||
input.value = '123foo';
|
||||
input._onInput();
|
||||
assert.equal(input.bindValue, '123');
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
30
dashboard-ui/bower_components/iron-input/test/letters-only.html
vendored
Normal file
30
dashboard-ui/bower_components/iron-input/test/letters-only.html
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 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
|
||||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../iron-validator-behavior/iron-validator-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
Polymer({
|
||||
|
||||
is: 'letters-only',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronValidatorBehavior
|
||||
],
|
||||
|
||||
validate: function(value) {
|
||||
return !value || value.match(/^[a-zA-Z]*$/) !== null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue