|
82 | 82 | assert.isTrue(input.invalid, 'invalid is true');
|
83 | 83 | });
|
84 | 84 |
|
85 |
| - test('default properties', function() { |
86 |
| - assert(!basic.visible); |
87 |
| - }); |
88 |
| - |
89 | 85 | test('error message is displayed', function() {
|
90 | 86 | var input = fixture('error');
|
91 | 87 | forceXIfStamp(input);
|
92 | 88 | var error = Polymer.dom(input.root).querySelector('paper-input-error');
|
93 | 89 | assert.ok(error, 'paper-input-error exists');
|
94 | 90 | assert.notEqual(getComputedStyle(error).display, 'none', 'error is not display:none');
|
| 91 | + assert.equal(input.errorMessage, 'error message'); |
95 | 92 | });
|
96 | 93 |
|
97 | 94 | test('empty required input shows error', function() {
|
|
112 | 109 | });
|
113 | 110 |
|
114 | 111 | suite('validate the password', function() {
|
115 |
| - test('sets invalid to False if password is valid', function() { |
| 112 | + test('sets invalid to false if password is valid', function() { |
116 | 113 | var input = fixture('pattern-validator');
|
117 | 114 | input.value = 'passdS345#$%^6';
|
118 | 115 | input.validate();
|
|
133 | 130 |
|
134 | 131 | });
|
135 | 132 |
|
136 |
| - suite('password input field to test', function() { |
137 |
| - test('show type default password **** for first time', function() { |
| 133 | + suite('password input field', function() { |
| 134 | + test('should set default input type to password', function() { |
138 | 135 | var input = fixture('show-password');
|
139 | 136 | forceXIfStamp(input);
|
140 |
| - var showPasswordIcon = Polymer.dom(input.root).querySelector('paper-icon-button'); |
141 |
| - assert.equal(input.type, 'password', 'Before show password click, type equals password'); |
142 |
| - }); |
| 137 | + assert.equal(input.type, 'password', 'input type should be password'); |
143 | 138 | });
|
| 139 | + }); |
144 | 140 |
|
145 |
| - suite('password icon test when clicks', function() { |
| 141 | + suite('toggle password visibility icon', function() { |
146 | 142 |
|
147 |
| - test('show the text if visibility icon is click', function() { |
| 143 | + test('unmask the password when toggle icon is on', function() { |
148 | 144 | var input = fixture('show-password');
|
149 | 145 | forceXIfStamp(input);
|
150 | 146 | var showPasswordIcon = Polymer.dom(input.root).querySelector('paper-icon-button');
|
| 147 | + assert.equal(input.type, 'password', 'password is starred'); |
| 148 | + assert.equal(showPasswordIcon.icon, 'hipaa-password-icons:visibility-off', 'visibility icon should be set to off'); |
151 | 149 | showPasswordIcon.click();
|
152 |
| - assert.equal(input.type, 'text', 'clicking on show password icon iconchanges type to text'); |
153 |
| - assert.equal(showPasswordIcon.icon, 'visibility', 'After show password click, show password icon equals visibility'); |
154 |
| - |
| 150 | + assert.equal(input.type, 'text', 'password is visible'); |
| 151 | + assert.equal(showPasswordIcon.icon, 'hipaa-password-icons:visibility', 'visibility icon should be set to on'); |
155 | 152 | });
|
156 | 153 |
|
157 |
| - test('hide the text if visibility-off icon is click', function() { |
| 154 | + test('mask the password when toggle icon is off', function() { |
158 | 155 | var input = fixture('show-password');
|
159 | 156 | forceXIfStamp(input);
|
160 | 157 | var showPasswordIcon = Polymer.dom(input.root).querySelector('paper-icon-button');
|
| 158 | + assert.equal(input.type, 'password', 'password is hidden'); |
| 159 | + assert.equal(showPasswordIcon.icon, 'hipaa-password-icons:visibility-off', 'visibility icon should be set to off'); |
161 | 160 | showPasswordIcon.click();
|
162 | 161 | showPasswordIcon.click();
|
163 |
| - assert.equal(input.type, 'password', 'clicking on show password icon iconchanges type to password'); |
164 |
| - assert.equal(showPasswordIcon.icon, 'visibility-off', 'After show password click, show password icon equals visibility-off'); |
165 |
| - |
| 162 | + assert.equal(input.type, 'password', 'password is hidden'); |
| 163 | + assert.equal(showPasswordIcon.icon, 'hipaa-password-icons:visibility-off', 'visibility icon should be set to off'); |
166 | 164 | });
|
167 | 165 | });
|
168 | 166 |
|
169 | 167 | suite('validation', function() {
|
170 |
| - |
171 | 168 | test('invalid attribute updated after calling validate()', function() {
|
172 | 169 | var input = fixture('required-no-auto-validate');
|
173 | 170 | forceXIfStamp(input);
|
|
0 commit comments