Skip to content

Commit 892f3cd

Browse files
anushagadepallicherukumilli
authored andcommitted
Fixes #7 fixes password visibility icon test cases. (#9)
* Fixes #7 updates password visibility test cases * fixes test cases
1 parent c59d716 commit 892f3cd

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

test/basic-test.html

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,13 @@
8282
assert.isTrue(input.invalid, 'invalid is true');
8383
});
8484

85-
test('default properties', function() {
86-
assert(!basic.visible);
87-
});
88-
8985
test('error message is displayed', function() {
9086
var input = fixture('error');
9187
forceXIfStamp(input);
9288
var error = Polymer.dom(input.root).querySelector('paper-input-error');
9389
assert.ok(error, 'paper-input-error exists');
9490
assert.notEqual(getComputedStyle(error).display, 'none', 'error is not display:none');
91+
assert.equal(input.errorMessage, 'error message');
9592
});
9693

9794
test('empty required input shows error', function() {
@@ -112,7 +109,7 @@
112109
});
113110

114111
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() {
116113
var input = fixture('pattern-validator');
117114
input.value = 'passdS345#$%^6';
118115
input.validate();
@@ -133,41 +130,41 @@
133130

134131
});
135132

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() {
138135
var input = fixture('show-password');
139136
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');
143138
});
139+
});
144140

145-
suite('password icon test when clicks', function() {
141+
suite('toggle password visibility icon', function() {
146142

147-
test('show the text if visibility icon is click', function() {
143+
test('unmask the password when toggle icon is on', function() {
148144
var input = fixture('show-password');
149145
forceXIfStamp(input);
150146
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');
151149
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');
155152
});
156153

157-
test('hide the text if visibility-off icon is click', function() {
154+
test('mask the password when toggle icon is off', function() {
158155
var input = fixture('show-password');
159156
forceXIfStamp(input);
160157
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');
161160
showPasswordIcon.click();
162161
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');
166164
});
167165
});
168166

169167
suite('validation', function() {
170-
171168
test('invalid attribute updated after calling validate()', function() {
172169
var input = fixture('required-no-auto-validate');
173170
forceXIfStamp(input);

0 commit comments

Comments
 (0)