Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: polymer_0.5.0/bower_components/paper-input/test/decorator.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_0.5.0/bower_components/paper-input/test/decorator.html
diff --git a/polymer_0.5.0/bower_components/paper-input/test/decorator.html b/polymer_0.5.0/bower_components/paper-input/test/decorator.html
new file mode 100644
index 0000000000000000000000000000000000000000..766fe5d1b5fda07ff26960d7f222390622aa6a4a
--- /dev/null
+++ b/polymer_0.5.0/bower_components/paper-input/test/decorator.html
@@ -0,0 +1,150 @@
+<!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">
+ <title>paper-input-decorator tests</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+ <script src="../../polymer-gestures/test/js/fake.js"></script>
+
+ <link href="../../core-input/core-input.html" rel="import">
+
+ <link href="../paper-input-decorator.html" rel="import">
+ <link href="../paper-autogrow-textarea.html" rel="import">
+
+ <style>
+ paper-input-decorator {
+ width: 400px;
+ }
+ </style>
+
+</head>
+<body>
+
+ <paper-input-decorator id="decorator1" label="input">
+ <input id="input1" is="core-input">
+ </paper-input-decorator>
+
+ <br>
+
+ <paper-input-decorator id="decorator2" label="input">
+ </paper-input-decorator>
+
+ <br>
+
+ <paper-input-decorator id="decorator3" label="input" floatingLabel>
+ <input id="input3" is="core-input">
+ </paper-input-decorator>
+
+ <paper-input-decorator id="decorator4" label="input" floatingLabel isInvalid error="error message">
+ <input id="input4" is="core-input" value="something">
+ </paper-input-decorator>
+
+ <br>
+
+ <paper-input-decorator id="decorator5" label="input" labelVisible="false">
+ <input>
+ </paper-input-decorator>
+
+ <br>
+
+ <script>
+
+ var fake = new Fake();
+
+ var d1 = document.getElementById('decorator1');
+ var i1 = document.getElementById('input1');
+ var d2 = document.getElementById('decorator2');
+ var d3 = document.getElementById('decorator3');
+ var i3 = document.getElementById('input3');
+ var d4 = document.getElementById('decorator4');
+ var i4 = document.getElementById('input4');
+ var d5 = document.getElementById('decorator5');
+
+ function reset(d, i) {
+ d.labelVisible = null;
+ i.value = null;
+ d.updateLabelVisibility(i.value);
+ }
+
+ suite('basic', function() {
+
+ teardown(function() {
+ reset(d1, i1);
+ reset(d3, i3);
+ });
+
+ test('label is invisible if value is not null', function() {
+ assert.ok(d1._labelVisible);
+ i1.value = 'foobar';
+ d1.updateLabelVisibility(i1.value);
+ assert.ok(!d1._labelVisible);
+ });
+
+ test('label is invisible if floating label and focused', function(done) {
+ assert.ok(d3._labelVisible);
+ d3.focusAction();
+ flush(function() {
+ assert.ok(!d3._labelVisible);
+ done();
+ });
+ });
+
+ test('label is invisible if value = 0', function() {
+ assert.ok(d1._labelVisible);
+ i1.value = 0;
+ d1.updateLabelVisibility(i1.value);
+ assert.ok(!d1._labelVisible);
+ });
+
+ test('labelVisible overrides label visibility', function() {
+ d1.labelVisible = false;
+ assert.ok(!i1.value);
+ assert.ok(!d1._labelVisible);
+ });
+
+ test('labelVisible works in an attribute', function() {
+ assert.ok(!d5._labelVisible);
+ });
+
+ test('can create inputs lazily', function() {
+ var input = document.createElement('input');
+ input.value = 'foobar';
+ d2.appendChild(input);
+ assert.ok(!d2._labelVisible);
+ });
+
+ test('tapping on floating label focuses input', function(done) {
+ i3.value = 'foobar';
+ flush(function() {
+ assert.ok(!d3._labelVisible);
+ fake.downOnNode(d1.shadowRoot.querySelector('.floated-label'));
+ flush(function() {
+ assert.strictEqual(window.ShadowDOMPolyfill ? wrap(document.activeElement) : document.activeElement, i1);
+ done();
+ })
+ });
+ });
+
+ test('floating label and the error message are the same color', function() {
+ var s1 = getComputedStyle(d4.$.floatedLabelText);
+ var s2 = getComputedStyle(d4.shadowRoot.querySelector('.error-text'));
+ assert.strictEqual(s1.color, s2.color);
+ });
+
+ });
+
+ </script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698