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

Side by Side Diff: polymer_1.0.4/bower_components/gold-cc-cvc-input/test/basic.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!doctype html>
2 <!--
3 @license
4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
8 Code distributed by Google as part of the polymer project is also
9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
10 -->
11 <html>
12 <head>
13
14 <title>gold-cc-cvc-input tests</title>
15
16 <meta charset="utf-8">
17 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
18 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial- scale=1, user-scalable=yes">
19
20 <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
21
22 <script src="../../web-component-tester/browser.js"></script>
23 <script src="../../test-fixture/test-fixture-mocha.js"></script>
24
25 <script src="../../iron-test-helpers/test-helpers.js"></script>
26
27 <link rel="import" href="../../test-fixture/test-fixture.html">
28 <link rel="import" href="../gold-cc-cvc-input.html">
29
30 </head>
31 <body>
32
33 <test-fixture id="basic">
34 <template>
35 <gold-cc-cvc-input></gold-cc-cvc-input>
36 </template>
37 </test-fixture>
38
39 <test-fixture id="amex">
40 <template>
41 <gold-cc-cvc-input card-type="amex" required error-message="error"></gold- cc-cvc-input>
42 </template>
43 </test-fixture>
44
45 <test-fixture id="required">
46 <template>
47 <gold-cc-cvc-input auto-validate required error-message="error"></gold-cc- cvc-input>
48 </template>
49 </test-fixture>
50
51 <script>
52
53 suite('basic', function() {
54
55 test('max length for a non-amex cc is 3', function() {
56 var input = fixture('basic');
57 assert.equal(input.inputElement.maxLength, 3);
58 });
59
60 test('max length for an amex cc is 4', function() {
61 var input = fixture('amex');
62 assert.equal(input.inputElement.maxLength, 4);
63 });
64
65 test('valid input is ok', function() {
66 var input = fixture('required');
67 input.value='123';
68 input._onInput();
69 forceXIfStamp(input);
70 var container = Polymer.dom(input.root).querySelector('paper-input-conta iner');
71 assert.ok(container, 'paper-input-container exists');
72 assert.isFalse(container.invalid);
73 });
74
75 test('invalid input is not ok', function() {
76 var input = fixture('required');
77 input.value='13';
78 input._onInput();
79 forceXIfStamp(input);
80 var container = Polymer.dom(input.root).querySelector('paper-input-conta iner');
81 assert.ok(container, 'paper-input-container exists');
82 assert.isTrue(container.invalid);
83 });
84
85 test('empty required input shows error', function() {
86 var input = fixture('required');
87 forceXIfStamp(input);
88 var error = Polymer.dom(input.root).querySelector('paper-input-error');
89 assert.ok(error, 'paper-input-error exists');
90 assert.notEqual(getComputedStyle(error).display, 'none', 'error is not d isplay:none');
91 });
92
93 test('invalid input shows error message after manual validation', function () {
94 var input = fixture('amex');
95 forceXIfStamp(input);
96 var error = Polymer.dom(input.root).querySelector('paper-input-error');
97 assert.ok(error, 'paper-input-error exists');
98
99 // The error message is only displayed after manual validation.
100 assert.equal(getComputedStyle(error).display, 'none', 'error is not disp lay:none');
101 input.validate();
102 assert.notEqual(getComputedStyle(error).display, 'none', 'error is not d isplay:none');
103 });
104 });
105
106 suite('a11y', function() {
107
108 test('has aria-labelledby', function() {
109 var input = fixture('basic');
110 assert.isTrue(input.inputElement.hasAttribute('aria-labelledby'))
111 assert.equal(input.inputElement.getAttribute('aria-labelledby'), Polymer .dom(input.root).querySelector('label').id, 'aria-labelledby points to the label ');
112 });
113
114 test('required and error has aria-labelledby', function() {
115 var input = fixture('required');
116 assert.isTrue(input.inputElement.hasAttribute('aria-labelledby'))
117 assert.equal(input.inputElement.getAttribute('aria-labelledby'), Polymer .dom(input.root).querySelector('label').id, 'aria-labelledby points to the label ');
118 });
119
120 });
121
122 </script>
123
124 </body>
125 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698