• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!doctype html>
2<!--
3Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
4This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7Code distributed by Google as part of the polymer project is also
8subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9-->
10<html>
11<head>
12  <meta charset="UTF-8">
13  <title>paper-input tests</title>
14  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
15
16  <script src="../../webcomponentsjs/webcomponents.js"></script>
17  <script src="../../web-component-tester/browser.js"></script>
18  <script src="../../polymer-gestures/test/js/fake.js"></script>
19
20  <script src="util.js"></script>
21
22  <link href="../paper-input.html" rel="import">
23
24  <style>
25    paper-input {
26      width: 400px;
27    }
28  </style>
29
30</head>
31<body>
32
33  <paper-input id="default"></paper-input>
34
35  <paper-input id="disabled" disabled label="disabled"></paper-input>
36
37  <script>
38
39  var fake = new Fake();
40
41  test('change event bubbles', function(done) {
42    var node = document.getElementById('default');
43    var changeAction = function() {
44      done();
45      node.removeEventListener('change', changeAction);
46    };
47    node.addEventListener('change', changeAction);
48    var input = node.shadowRoot.querySelector('input');
49    var e = new Event('change', {
50      bubbles: true
51    });
52    input.dispatchEvent(e);
53  });
54
55  test('cannot tap on disabled input', function(done) {
56    var node = document.getElementById('disabled');
57    fake.downOnNode(node);
58    fake.upOnNode(node);
59    setTimeout(function() {
60      assert.notStrictEqual(activeElement(), node.shadowRoot.querySelector('input'));
61      done();
62    }, 10);
63  });
64
65  </script>
66
67</body>
68</html>