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

Commit 61770d3

Browse files
author
vikasrohit
committed
Merge pull request #624 from appirio-tech/feature/sup-2728-skill-picker-ios-community
SUP-2728, Add iOS community to Onboarding page (Skill picker)
2 parents b5193b3 + 5230dfc commit 61770d3

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

app/skill-picker/skill-picker.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
vm.saving = false;
176176
toaster.pop('success', "Success!", "Your skills have been updated.");
177177
vm.disableDoneButton = true;
178-
//$state.go('dashboard');
178+
$state.go('dashboard');
179179
})
180180
.catch(function(resp) {
181181
vm.saving = false;

app/skill-picker/skill-picker.spec.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* jshint -W117, -W030 */
22
describe('Skill Picker Controller', function() {
33
var vm;
4-
var toasterSvc, memberCertService, profileService;
4+
var toasterSvc, memberCertService, profileService, state;
55
var mockProfile = mockData.getMockProfile();
66

77
beforeEach(function() {
@@ -57,11 +57,16 @@ describe('Skill Picker Controller', function() {
5757
default: $q.when(true)
5858
});
5959

60+
// mocked $state object
61+
state = { go: sinon.spy()};
62+
6063
var scope = $rootScope.$new();
6164
vm = $controller('SkillPickerController', {
6265
$scope: scope,
6366
userProfile: mockProfile,
64-
featuredSkills: []
67+
featuredSkills: [],
68+
$state: state
69+
6570
});
6671
$rootScope.$digest();
6772
});
@@ -129,6 +134,9 @@ describe('Skill Picker Controller', function() {
129134
expect(mockProfile.save).not.to.be.called;
130135
expect(profileService.updateUserSkills).not.to.be.called;
131136
expect(memberCertService.registerMember).not.to.be.called;
137+
// we should still go to dashboard if the function is called,
138+
// call to the function is controlled by disabling the button
139+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce;
132140
});
133141

134142
it('should update tracks for the member ', function() {
@@ -139,6 +147,7 @@ describe('Skill Picker Controller', function() {
139147
expect(mockProfile.save).to.be.calledOnce;
140148
expect(profileService.updateUserSkills).not.to.be.called;
141149
expect(memberCertService.registerMember).not.to.be.called;
150+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce;
142151
});
143152

144153
it('should show error popup for updating tracks ', function() {
@@ -156,6 +165,7 @@ describe('Skill Picker Controller', function() {
156165
expect(toasterSvc.pop).to.have.been.calledWith('error', "Whoops!", sinon.match('wrong')).calledOnce;
157166
expect(profileService.updateUserSkills).not.to.be.called;
158167
expect(memberCertService.registerMember).not.to.be.called;
168+
expect(state.go).not.to.be.called;
159169
});
160170

161171
it('should update skills for the member ', function() {
@@ -165,6 +175,7 @@ describe('Skill Picker Controller', function() {
165175
expect(mockProfile.save).not.to.be.called;
166176
expect(profileService.updateUserSkills).to.be.calledOnce;
167177
expect(memberCertService.registerMember).not.to.be.called;
178+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce;
168179
});
169180

170181
it('should show error popup for error in updating skills ', function() {
@@ -175,6 +186,7 @@ describe('Skill Picker Controller', function() {
175186
expect(profileService.updateUserSkills).to.be.calledOnce;
176187
expect(toasterSvc.pop).to.have.been.calledWith('error', "Whoops!", sinon.match('wrong')).calledOnce;
177188
expect(memberCertService.registerMember).not.to.be.called;
189+
expect(state.go).not.to.be.called;
178190
});
179191

180192
it('should update communities for the member ', function() {
@@ -185,6 +197,7 @@ describe('Skill Picker Controller', function() {
185197
expect(mockProfile.save).not.to.be.called;
186198
expect(profileService.updateUserSkills).not.to.be.called;
187199
expect(memberCertService.registerMember).to.be.calledOnce;
200+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce;
188201
});
189202

190203
// we may need to update this test case when we want to call unregister endpoint
@@ -196,6 +209,9 @@ describe('Skill Picker Controller', function() {
196209
expect(mockProfile.save).not.to.be.called;
197210
expect(profileService.updateUserSkills).not.to.be.called;
198211
expect(memberCertService.registerMember).not.to.be.called;
212+
// we should still go to dashboard if the function is called,
213+
// call to the function is controlled by disabling the button
214+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce;
199215
});
200216

201217
it('should NOT update communities for the member for enabled but non dirty community ', function() {
@@ -207,6 +223,9 @@ describe('Skill Picker Controller', function() {
207223
expect(mockProfile.save).not.to.be.called;
208224
expect(profileService.updateUserSkills).not.to.be.called;
209225
expect(memberCertService.registerMember).not.to.be.called;
226+
// we should still go to dashboard if the function is called,
227+
// call to the function is controlled by disabling the button
228+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce;
210229
});
211230

212231
it('should show error popup for error in updating communities ', function() {
@@ -219,6 +238,7 @@ describe('Skill Picker Controller', function() {
219238
expect(profileService.updateUserSkills).not.to.be.called;
220239
expect(memberCertService.registerMember).to.be.calledOnce;
221240
expect(toasterSvc.pop).to.have.been.calledWith('error', "Whoops!", sinon.match('wrong')).calledOnce;
241+
expect(state.go).not.to.be.called;
222242
});
223243

224244
});

0 commit comments

Comments
 (0)