Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 99e8628

Browse files
author
Jenkins Continuous Integration Server
committed
Merge commit 'e6ccfec5b09a0b300f38aab48d82fa343999e731' into HEAD
2 parents 0648d30 + e6ccfec commit 99e8628

File tree

11 files changed

+228
-97
lines changed

11 files changed

+228
-97
lines changed

app/account/register/register.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
p.form-error(ng-message="required") Please enter an email address.
8484

8585
.validation-bar(ng-class="{ 'success-bar': (vm.registerForm.password.$valid) }")
86-
toggle-password-with-tips(ng-if="!vm.isSocialRegistration")
86+
toggle-password-with-tips(ng-if="!vm.isSocialRegistration", placeholder="Create Password")
8787

8888
.tips.password-tips(ng-show="vm.passwordFocus")
8989
.arrow

app/directives/account/toggle-password-with-tips/toggle-password-with-tips.directive.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
link: function(scope, element, attrs, formController) {
1212
var vm = scope.vm;
1313
vm.passwordField = formController.password;
14-
vm.defaultPlaceholder = attrs.placeholder || 'Pick a new password';
14+
vm.defaultPlaceholder = attrs.placeholder || 'Create new password';
1515
vm.placeholder = vm.defaultPlaceholder;
1616
vm.password = '';
1717

@@ -41,6 +41,7 @@
4141
if (relatedTarget.attr('type') === 'checkbox' && relatedTarget.attr('id') === 'passwordCheckbox') {
4242
vm.passwordFocus = true;
4343
vm.placeholder = '';
44+
passwordInput.focus();
4445
} else {
4546
// If you are blurring from the password input and clicking anywhere but the checkbox
4647
vm.passwordFocus = false;

app/directives/account/toggle-password-with-tips/toggle-password-with-tips.jade

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
input#password-input(
22
ng-model="vm.password",
33
ng-model-options="{allowInvalid: true}",
4-
5-
focus-on="focusOnInput",
4+
65
ng-focus="vm.onFocus($event)",
76
ng-blur="vm.onBlur($event)",
87

@@ -17,4 +16,4 @@ input#password-input(
1716
has-symbol-or-number,
1817
required)
1918

20-
label(ng-show="vm.passwordFocus || vm.passwordField.$dirty") #[input(type="checkbox", id="passwordCheckbox", ng-model="focusOnInput", ng-change="vm.toggleInputType()")] Show
19+
label #[input(type="checkbox", id="passwordCheckbox", ng-model="focusOnInput", ng-change="vm.toggleInputType()")] Show

app/directives/account/toggle-password-with-tips/toggle-password-with-tips.spec.js

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,145 @@ describe('Toggle Password With Tips Directive', function() {
99
bard.appModule('topcoder');
1010
bard.inject(this, '$compile', '$rootScope');
1111
scope = $rootScope.$new();
12+
scope.vm = {};
1213
});
1314

1415
bard.verifyNoOutstandingHttpRequests();
16+
17+
describe('Toggle Password Directive', function() {
18+
var togglePassword, controller, formController, passwordFormFieldSpy;
19+
20+
beforeEach(function() {
21+
var form = angular.element('<form><toggle-password-with-tips /></form>)');
22+
element = form.find('toggle-password-with-tips');
23+
var formElement = $compile(form)(scope);
24+
scope.$digest();
25+
26+
// controller = element.controller('togglePassword');
27+
formController = form.controller('form');
28+
passwordFormFieldSpy = sinon.spy(formController.password, '$setPristine');
29+
});
30+
31+
afterEach(function() {
32+
// do nohting
33+
});
34+
35+
it('should have password default placeholder', function() {
36+
expect(scope.vm.defaultPlaceholder).to.exist.to.equal('Create new password');
37+
expect(scope.vm.placeholder).to.exist.to.equal('Create new password');
38+
});
39+
40+
it('should not have focus class', function() {
41+
expect(element.hasClass('focus')).to.be.false;
42+
});
43+
44+
it('should trigger click handler ', function() {
45+
var mockFocus = sinon.spy(element.find('input')[0], 'focus');
46+
element.trigger('click');
47+
expect(mockFocus).to.be.calledOnce;
48+
});
49+
50+
it('should trigger focus handler ', function() {
51+
var pwsIntputElement = angular.element(element.find('input')[0]);
52+
pwsIntputElement.triggerHandler('focus');
53+
expect(element.hasClass('focus')).to.be.true;
54+
});
55+
56+
it('should trigger blur handler with form field pristine ', function() {
57+
var pwsIntputElement = angular.element(element.find('input')[0]);
58+
// focus it first
59+
pwsIntputElement.triggerHandler('focus');
60+
// verifies if focus class is added
61+
expect(element.hasClass('focus')).to.be.true;
62+
// now blurs from it
63+
pwsIntputElement.triggerHandler('blur');
64+
// focus class should not be there
65+
expect(element.hasClass('focus')).to.be.false;
66+
// password field's setPristine method should be called once because currentPassword is empty
67+
expect(passwordFormFieldSpy).to.be.calledOnce;
68+
});
69+
70+
it('should trigger blur handler without form field pristine ', function() {
71+
scope.vm.password = 'some-password';
72+
scope.$digest();
73+
var pwsIntputElement = angular.element(element.find('input')[0]);
74+
// focus it first
75+
pwsIntputElement.triggerHandler('focus');
76+
// verifies if focus class is added
77+
expect(element.hasClass('focus')).to.be.true;
78+
// now blurs from it
79+
pwsIntputElement.triggerHandler('blur');
80+
// focus class should not be there
81+
expect(element.hasClass('focus')).to.be.false;
82+
// password field's setPristine method should not be called because currentPassword is non-empty
83+
expect(passwordFormFieldSpy).not.to.be.called;
84+
});
85+
86+
it('should keep focus on password field on blurring to checkbox ', function() {
87+
88+
var pwsIntputElement = angular.element(element.find('input')[0]);
89+
// focus it first
90+
pwsIntputElement.triggerHandler('focus');
91+
// verifies if focus class is added
92+
expect(element.hasClass('focus')).to.be.true;
93+
// now blurs from it
94+
95+
var e = jQuery.Event("blur");
96+
e.relatedTarget = {
97+
getAttribute: function(name) {
98+
if (name === 'type') return 'checkbox';
99+
if (name === 'id') return 'passwordCheckbox';
100+
}
101+
};
102+
//mock focus event
103+
var mockFocus = sinon.spy(element.find('input')[0], 'focus');
104+
// trigger event
105+
pwsIntputElement.trigger(e);
106+
107+
// focus should be called once
108+
expect(mockFocus).to.be.calledOnce;
109+
// password field placeholde should be empty
110+
expect(scope.vm.placeholder).to.exist.to.equal('');
111+
});
112+
113+
it('should change type of input field to be text ', function() {
114+
var pwsIntputElement = angular.element(element.find('input')[0]);
115+
var checkbox = angular.element(element.find('input')[1]);
116+
// before clicking on checkbox, it should have password type
117+
expect(pwsIntputElement.attr('type')).to.equal('password');
118+
checkbox.trigger('click');
119+
// after clicking on checkbox, it should have text type
120+
expect(pwsIntputElement.attr('type')).to.equal('text');
121+
});
122+
123+
it('should change type of input field to be password ', function() {
124+
var pwsIntputElement = angular.element(element.find('input')[0]);
125+
var checkbox = angular.element(element.find('input')[1]);
126+
// before clicking on checkbox, it should have password type
127+
expect(pwsIntputElement.attr('type')).to.equal('password');
128+
checkbox.trigger('click');
129+
// after clicking on checkbox, it should have text type
130+
expect(pwsIntputElement.attr('type')).to.equal('text');
131+
// click again to uncheck the checkbox
132+
checkbox.trigger('click');
133+
// after unchecking the checkbox, it should have password type
134+
expect(pwsIntputElement.attr('type')).to.equal('password');
135+
});
136+
137+
it('should trigger keyup handler with enter/return key ', function() {
138+
var mockBlur = sinon.spy(element.find('input')[0], 'blur');
139+
var e = jQuery.Event("keyup");
140+
e.keyCode = 13;
141+
element.trigger(e);
142+
expect(mockBlur).to.be.calledOnce;
143+
});
144+
145+
it('should NOT trigger keyup handler with non enter/return key ', function() {
146+
var mockBlur = sinon.spy(element.find('input')[0], 'blur');
147+
var e = jQuery.Event("keyup");
148+
e.keyCode = 14;
149+
element.trigger(e);
150+
expect(mockBlur).not.to.be.called;
151+
});
152+
});
15153
});

app/directives/account/toggle-password/toggle-password.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* jshint -W117, -W030 */
2-
xdescribe('Toggle Password Directive', function() {
2+
describe('Toggle Password Directive', function() {
33
var scope;
44
var element;
55

app/services/userStats.service.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -165,42 +165,42 @@
165165
function mapReliability(subTrack) {
166166
var reliabilityMapping = {
167167
'DESIGN': 1,
168-
'DEVELOPMENT': 1,
169-
'TESTING_COMPETITION': 1,
170-
'SPECIFICATION': 2,
171-
'ARCHITECTURE': 2,
172-
'COMPONENT_PRODUCTION': 2,
173-
'BUG_HUNT': 2,
174-
'DEPLOYMENT': 2,
175-
'SECURITY': 2,
176-
'PROCESS': 2,
177-
'TEST_SUITES': 2,
178-
'ASSEMBLY_COMPETITION': 2,
179-
'LEGACY': 2,
180-
'BANNERS_OR_ICONS': 3,
181-
'WEB_DESIGN': 3,
182-
'WIREFRAMES': 3,
183-
'UI_PROTOTYPE_COMPETITION': 2,
184-
'LOGO_DESIGN': 3,
185-
'PRINT_OR_PRESENTATION': 3,
186-
'CONCEPTUALIZATION': 2,
187-
'RIA_BUILD_COMPETITION': 2,
188-
'RIA_COMPONENT_COMPETITION': 2,
189-
'TEST_SCENARIOS': 2,
190-
'SPEC_REVIEW': 2,
191-
'GENERIC_SCORECARDS': 4,
192-
'COPILOT_POSTING': 2,
193-
'CONTENT_CREATION': 2,
194-
'WIDGET_OR_MOBILE_SCREEN_DESIGN': 3,
195-
'FRONT_END_FLASH': 3,
196-
'APPLICATION_FRONT_END_DESIGN': 3,
197-
'STUDIO_OTHER': 3,
198-
'IDEA_GENERATION': 3,
199-
'REPORTING': 2,
200-
'MARATHON_MATCH': 2,
201-
'FIRST_2_FINISH': 2,
202-
'CODE': 2,
203-
'DESIGN_FIRST_2_FINISH': 3
168+
'DEVELOPMENT': 2,
169+
'TESTING_COMPETITION': 5,
170+
'SPECIFICATION': 6,
171+
'ARCHITECTURE': 7,
172+
'COMPONENT_PRODUCTION': 8,
173+
'BUG_HUNT': 9,
174+
'DEPLOYMENT': 10,
175+
'SECURITY': 11,
176+
'PROCESS': 12,
177+
'TEST_SUITES': 13,
178+
'ASSEMBLY_COMPETITION': 14,
179+
'LEGACY': 15,
180+
'BANNERS_OR_ICONS': 16,
181+
'WEB_DESIGN': 17,
182+
'WIREFRAMES': 18,
183+
'UI_PROTOTYPE_COMPETITION': 19,
184+
'LOGO_DESIGN': 20,
185+
'PRINT_OR_PRESENTATION': 21,
186+
'CONCEPTUALIZATION': 23,
187+
'RIA_BUILD_COMPETITION': 24,
188+
'RIA_COMPONENT_COMPETITION': 25,
189+
'TEST_SCENARIOS': 26,
190+
'SPEC_REVIEW': 27,
191+
'GENERIC_SCORECARDS': 28,
192+
'COPILOT_POSTING': 29,
193+
'CONTENT_CREATION': 35,
194+
'WIDGET_OR_MOBILE_SCREEN_DESIGN': 30,
195+
'FRONT_END_FLASH': 31,
196+
'APPLICATION_FRONT_END_DESIGN': 32,
197+
'STUDIO_OTHER': 34,
198+
'IDEA_GENERATION': 22,
199+
'REPORTING': 36,
200+
'MARATHON_MATCH': 37,
201+
'FIRST_2_FINISH': 38,
202+
'CODE': 39,
203+
'DESIGN_FIRST_2_FINISH': 40
204204
};
205205

206206
return reliabilityMapping[subTrack] || 2;

app/services/userStats.service.spec.js

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -384,54 +384,44 @@ describe('User Stats Service', function() {
384384

385385
describe('mapReliability ', function() {
386386
it('should map each subtrack to correct project type ', function() {
387-
var pt1 = ['DESIGN', 'DEVELOPMENT', 'TESTING_COMPETITION'];
388-
var pt2 = [
389-
'SPECIFICATION',
390-
'ARCHITECTURE',
391-
'COMPONENT_PRODUCTION',
392-
'BUG_HUNT', 'DEPLOYMENT',
393-
'SECURITY', 'PROCESS',
394-
'TEST_SUITES',
395-
'ASSEMBLY_COMPETITION',
396-
'LEGACY',
397-
'UI_PROTOTYPE_COMPETITION',
398-
'CONCEPTUALIZATION',
399-
'RIA_BUILD_COMPETITION',
400-
'RIA_COMPONENT_COMPETITION',
401-
'TEST_SCENARIOS',
402-
'SPEC_REVIEW',
403-
'COPILOT_POSTING',
404-
'CONTENT_CREATION',
405-
'REPORTING',
406-
'MARATHON_MATCH',
407-
'FIRST_2_FINISH',
408-
'CODE'
409-
];
410-
var pt3 = [
411-
'BANNERS_OR_ICONS',
412-
'WEB_DESIGN',
413-
'WIREFRAMES',
414-
'LOGO_DESIGN',
415-
'PRINT_OR_PRESENTATION',
416-
'DESIGN_FIRST_2_FINISH',
417-
'WIDGET_OR_MOBILE_SCREEN_DESIGN',
418-
'FRONT_END_FLASH',
419-
'APPLICATION_FRONT_END_DESIGN',
420-
'STUDIO_OTHER',
421-
'IDEA_GENERATION'];
422-
var pt4 = ['GENERIC_SCORECARDS'];
423-
pt1.forEach(function(subTrack) {
424-
expect(UserStatsService.mapReliability(subTrack)).to.equal(1);
425-
});
426-
pt2.forEach(function(subTrack) {
427-
expect(UserStatsService.mapReliability(subTrack)).to.equal(2);
428-
});
429-
pt3.forEach(function(subTrack) {
430-
expect(UserStatsService.mapReliability(subTrack)).to.equal(3);
431-
});
432-
pt4.forEach(function(subTrack) {
433-
expect(UserStatsService.mapReliability(subTrack)).to.equal(4);
434-
});
387+
expect(UserStatsService.mapReliability('DESIGN')).to.equal(1);
388+
expect(UserStatsService.mapReliability('DEVELOPMENT')).to.equal(2);
389+
expect(UserStatsService.mapReliability('TESTING_COMPETITION')).to.equal(5);
390+
expect(UserStatsService.mapReliability('SPECIFICATION')).to.equal(6);
391+
expect(UserStatsService.mapReliability('ARCHITECTURE')).to.equal(7);
392+
expect(UserStatsService.mapReliability('COMPONENT_PRODUCTION')).to.equal(8);
393+
expect(UserStatsService.mapReliability('BUG_HUNT')).to.equal(9);
394+
expect(UserStatsService.mapReliability('DEPLOYMENT')).to.equal(10);
395+
expect(UserStatsService.mapReliability('SECURITY')).to.equal(11);
396+
expect(UserStatsService.mapReliability('PROCESS')).to.equal(12);
397+
expect(UserStatsService.mapReliability('TEST_SUITES')).to.equal(13);
398+
expect(UserStatsService.mapReliability('ASSEMBLY_COMPETITION')).to.equal(14);
399+
expect(UserStatsService.mapReliability('LEGACY')).to.equal(15);
400+
expect(UserStatsService.mapReliability('BANNERS_OR_ICONS')).to.equal(16);
401+
expect(UserStatsService.mapReliability('WEB_DESIGN')).to.equal(17);
402+
expect(UserStatsService.mapReliability('WIREFRAMES')).to.equal(18);
403+
expect(UserStatsService.mapReliability('UI_PROTOTYPE_COMPETITION')).to.equal(19);
404+
expect(UserStatsService.mapReliability('LOGO_DESIGN')).to.equal(20);
405+
expect(UserStatsService.mapReliability('PRINT_OR_PRESENTATION')).to.equal(21);
406+
expect(UserStatsService.mapReliability('IDEA_GENERATION')).to.equal(22);
407+
expect(UserStatsService.mapReliability('CONCEPTUALIZATION')).to.equal(23);
408+
expect(UserStatsService.mapReliability('RIA_BUILD_COMPETITION')).to.equal(24);
409+
expect(UserStatsService.mapReliability('RIA_COMPONENT_COMPETITION')).to.equal(25);
410+
expect(UserStatsService.mapReliability('TEST_SCENARIOS')).to.equal(26);
411+
expect(UserStatsService.mapReliability('SPEC_REVIEW')).to.equal(27);
412+
expect(UserStatsService.mapReliability('GENERIC_SCORECARDS')).to.equal(28);
413+
expect(UserStatsService.mapReliability('COPILOT_POSTING')).to.equal(29);
414+
expect(UserStatsService.mapReliability('WIDGET_OR_MOBILE_SCREEN_DESIGN')).to.equal(30);
415+
expect(UserStatsService.mapReliability('FRONT_END_FLASH')).to.equal(31);
416+
expect(UserStatsService.mapReliability('APPLICATION_FRONT_END_DESIGN')).to.equal(32);
417+
expect(UserStatsService.mapReliability('STUDIO_OTHER')).to.equal(34);
418+
expect(UserStatsService.mapReliability('CONTENT_CREATION')).to.equal(35);
419+
expect(UserStatsService.mapReliability('REPORTING')).to.equal(36);
420+
expect(UserStatsService.mapReliability('MARATHON_MATCH')).to.equal(37);
421+
expect(UserStatsService.mapReliability('FIRST_2_FINISH')).to.equal(38);
422+
expect(UserStatsService.mapReliability('CODE')).to.equal(39);
423+
expect(UserStatsService.mapReliability('DESIGN_FIRST_2_FINISH')).to.equal(40);
424+
435425
// for any other subtrack it should return 2
436426
expect(UserStatsService.mapReliability('unkown')).to.equal(2);
437427

app/settings/account-info/account-info.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
.form-label New Password
2727

2828
.validation-bar
29-
toggle-password-with-tips.topcoder-input.password(placeholder="Pick a new password")
29+
toggle-password-with-tips.topcoder-input.password(placeholder="Create new password")
3030

3131
.tips.password-tips(ng-show="vm.passwordFocus")
3232
.arrow
3333

34-
h3 Password Tips:
34+
//- h3 Password Tips:
3535
36-
p Your password must have:
36+
H3 Your password must have:
3737

3838
p(ng-class="{ 'has-length-between-range': (vm.newPasswordForm.password.$dirty && !vm.newPasswordForm.password.$error.minlength && !vm.newPasswordForm.password.$error.maxlength && !vm.newPasswordForm.password.$error.required) }") At least 8 characters
3939

assets/css/directives/external-account.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
display: flex;
55
flex-direction: column;
66
align-items: center;
7-
margin: 5px 0px 15px 0;
7+
margin: 5px 20px 15px 0;
88
cursor: pointer;
99

1010
&.connected {

0 commit comments

Comments
 (0)