mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
rework dialogs
This commit is contained in:
parent
5a71a65637
commit
5b66bb9ecb
39 changed files with 486 additions and 121 deletions
32
dashboard-ui/bower_components/iron-input/test/disabled-input.html
vendored
Normal file
32
dashboard-ui/bower_components/iron-input/test/disabled-input.html
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!--
|
||||
@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">
|
||||
|
||||
<dom-module id="disabled-input">
|
||||
<template>
|
||||
<input is="iron-input" bind-value="{{myValue}}" invalid="{{myInvalid}}" disabled id="input">
|
||||
</template>
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'disabled-input',
|
||||
properties: {
|
||||
myValue: {
|
||||
value: 'foo'
|
||||
},
|
||||
|
||||
myInvalid: {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -8,7 +8,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
--><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>
|
||||
<title>iron-input tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -20,6 +20,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<link rel="import" href="../iron-input.html">
|
||||
<link rel="import" href="letters-only.html">
|
||||
<link rel="import" href="disabled-input.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -85,10 +86,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="native-and-custom-validator">
|
||||
<template>
|
||||
<letters-only></letters-only>
|
||||
<input is="iron-input" validator="letters-only" pattern="[a-c]*">
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<template is="dom-bind" id="bind-to-object">
|
||||
<input is="iron-input" id="input" bind-value="{{foo}}">
|
||||
</template>
|
||||
|
||||
<test-fixture id="disabled-input">
|
||||
<template>
|
||||
<disabled-input></disabled-input>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
|
||||
suite('basic', function() {
|
||||
|
@ -209,8 +223,57 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
input._onInput();
|
||||
assert.equal(input.bindValue, 'foo');
|
||||
});
|
||||
|
||||
test('disabled input doesn\'t throw on Firefox', function() {
|
||||
var el = fixture('disabled-input');
|
||||
var input = el.$.input;
|
||||
|
||||
assert.equal(input.bindValue, 'foo');
|
||||
|
||||
assert.isFalse(el.myInvalid);
|
||||
assert.isTrue(input.disabled);
|
||||
});
|
||||
|
||||
test('browser validation beats custom validation', function() {
|
||||
var input = fixture('native-and-custom-validator')[1];
|
||||
// The input allows any letters, but the browser only allows one
|
||||
// of [abc].
|
||||
input.value = 'aaaa';
|
||||
input.validate();
|
||||
assert.isFalse(input.invalid, 'input is valid');
|
||||
|
||||
// The validator allows this, but the browser doesn't.
|
||||
input.value = 'zzz';
|
||||
input.validate();
|
||||
assert.isTrue(input.invalid, 'input is invalid');
|
||||
});
|
||||
});
|
||||
|
||||
suite('a11y', function() {
|
||||
test('announces invalid characters when _onInput is called', function() {
|
||||
var input = fixture('prevent-invalid-input');
|
||||
input.addEventListener('iron-announce', function(event) {
|
||||
assert.equal(event.detail.text, 'Invalid string of characters not entered.');
|
||||
});
|
||||
input.value = 'foo';
|
||||
input._onInput();
|
||||
});
|
||||
|
||||
test('announces invalid characters on keypress', function() {
|
||||
var input = fixture('prevent-invalid-input');
|
||||
input.addEventListener('iron-announce', function(event) {
|
||||
assert.equal(event.detail.text, 'Invalid character a not entered.');
|
||||
});
|
||||
|
||||
// Simulate key press event.
|
||||
var event = new CustomEvent('keypress', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
event.charCode = 97 /* a */;
|
||||
input.dispatchEvent(event);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue