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

Commit 03e0530

Browse files
author
vikasrohit
authored
Merge pull request #1191 from appirio-tech/dev
Moving changes, for Cognitive Community Options in skill picker, to prod
2 parents a801248 + 40f2989 commit 03e0530

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ import _ from 'lodash'
8181
vm.communities['ibm_cognitive'] = {
8282
displayName: 'Cognitive',
8383
programId: vm.IBM_COGNITIVE_PROGRAM_ID,
84-
status: false,
85-
dirty: false,
84+
status: true,
85+
dirty: true,
8686
display: true
8787
}
8888
_addWatchToCommunity(vm.communities['ios'])

app/skill-picker/skill-picker.jade

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
.community(ng-repeat="(communityKey, community) in vm.communities", ng-class="{'community--disabled': !community.status}", ng-if="community.display")
1111
.community__details
1212
.community__icon(ng-class="{'community__icon--disabled': !community.status}")
13+
img(ng-if="communityKey == 'ibm_cognitive' && community.status", src=require("../../assets/images/ico-ibm_cognitive-community.svg"))
14+
img(ng-if="communityKey == 'ibm_cognitive' && !community.status", src=require("../../assets/images/ico-ibm_cognitive-community-grey.svg"))
1315
img(ng-if="communityKey == 'ios' && community.status", src=require("../../assets/images/ico-ios-community.svg"))
1416
img(ng-if="communityKey == 'ios' && !community.status", src=require("../../assets/images/ico-ios-community-grey.svg"))
1517
img(ng-if="communityKey == 'predix' && community.status", src=require("../../assets/images/ico-predix-community.svg"))
1618
img(ng-if="communityKey == 'predix' && !community.status", src=require("../../assets/images/ico-predix-community-grey.svg"))
17-
img(ng-if="communityKey == 'ibm_cognitive' && community.status", src=require("../../assets/images/ico-ibm_cognitive-community.svg"))
18-
img(ng-if="communityKey == 'ibm_cognitive' && !community.status", src=require("../../assets/images/ico-ibm_cognitive-community-grey.svg"))
1919

2020
.community__text
2121
span.community__title(class="{{!community.status && 'disabled'}}") {{community.displayName}}
2222
.community__description
23+
span(ng-if="communityKey == 'ibm_cognitive'") Cognitive Community
2324
span(ng-if="communityKey == 'ios'") Mobile app design and development for iOS, with Swift emphasis
2425
span(ng-if="communityKey == 'predix'") Design and development on GE’s platform for the Industrial Internet of Things
25-
span(ng-if="communityKey == 'ibm_cognitive'") Cognitive Community
2626

2727
onoff-switch(model="community.status", unique-id="'community-' + communityKey")
2828

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

+24-10
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ describe('Skill Picker Controller', function() {
116116
expect(vm.username).to.exist.to.equal(mockProfile.handle)
117117
})
118118

119-
it('should not have page dirty ', function() {
119+
it('should have page dirty for default cognitive being on ', function() {
120120
var dirty = vm.isPageDirty()
121-
expect(dirty).to.equal(false)
121+
expect(dirty).to.equal(true)
122122
})
123123

124124
it('should be created successfully with showCommunity being true', function() {
@@ -159,6 +159,20 @@ describe('Skill Picker Controller', function() {
159159
$rootScope.$digest()
160160
expect(mockProfile.save).not.to.be.called
161161
expect(profileService.updateUserSkills).not.to.be.called
162+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
163+
// we should still go to dashboard if the function is called,
164+
// call to the function is controlled by disabling the button
165+
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
166+
})
167+
168+
it('should not make any registerMember call with cognitive being turned off ', function() {
169+
vm.communities['ibm_cognitive'].status = false
170+
vm.communities['ibm_cognitive'].dirty = true
171+
vm.submitSkills()
172+
$rootScope.$digest()
173+
expect(mockProfile.save).not.to.be.called
174+
expect(profileService.updateUserSkills).not.to.be.called
175+
// we have turned off default on community, so no registerMember call expected
162176
expect(memberCertService.registerMember).not.to.be.called
163177
// we should still go to dashboard if the function is called,
164178
// call to the function is controlled by disabling the button
@@ -172,7 +186,7 @@ describe('Skill Picker Controller', function() {
172186
$rootScope.$digest()
173187
expect(mockProfile.save).to.be.calledOnce
174188
expect(profileService.updateUserSkills).not.to.be.called
175-
expect(memberCertService.registerMember).not.to.be.called
189+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
176190
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
177191
})
178192

@@ -190,7 +204,7 @@ describe('Skill Picker Controller', function() {
190204
expect(mockProfile.save).to.be.calledOnce
191205
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
192206
expect(profileService.updateUserSkills).not.to.be.called
193-
expect(memberCertService.registerMember).not.to.be.called
207+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
194208
expect(state.go).not.to.be.called
195209
})
196210

@@ -200,7 +214,7 @@ describe('Skill Picker Controller', function() {
200214
$rootScope.$digest()
201215
expect(mockProfile.save).not.to.be.called
202216
expect(profileService.updateUserSkills).to.be.calledOnce
203-
expect(memberCertService.registerMember).not.to.be.called
217+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
204218
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
205219
})
206220

@@ -211,7 +225,7 @@ describe('Skill Picker Controller', function() {
211225
expect(mockProfile.save).not.to.be.called
212226
expect(profileService.updateUserSkills).to.be.calledOnce
213227
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
214-
expect(memberCertService.registerMember).not.to.be.called
228+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
215229
expect(state.go).not.to.be.called
216230
})
217231

@@ -222,7 +236,7 @@ describe('Skill Picker Controller', function() {
222236
$rootScope.$digest()
223237
expect(mockProfile.save).not.to.be.called
224238
expect(profileService.updateUserSkills).not.to.be.called
225-
expect(memberCertService.registerMember).to.be.calledOnce
239+
expect(memberCertService.registerMember).to.be.calledTwice// once for cognitive (default on) and another for ios
226240
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
227241
})
228242

@@ -234,7 +248,7 @@ describe('Skill Picker Controller', function() {
234248
$rootScope.$digest()
235249
expect(mockProfile.save).not.to.be.called
236250
expect(profileService.updateUserSkills).not.to.be.called
237-
expect(memberCertService.registerMember).not.to.be.called
251+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
238252
// we should still go to dashboard if the function is called,
239253
// call to the function is controlled by disabling the button
240254
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
@@ -248,7 +262,7 @@ describe('Skill Picker Controller', function() {
248262
$rootScope.$digest()
249263
expect(mockProfile.save).not.to.be.called
250264
expect(profileService.updateUserSkills).not.to.be.called
251-
expect(memberCertService.registerMember).not.to.be.called
265+
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
252266
// we should still go to dashboard if the function is called,
253267
// call to the function is controlled by disabling the button
254268
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
@@ -262,7 +276,7 @@ describe('Skill Picker Controller', function() {
262276
$rootScope.$digest()
263277
expect(mockProfile.save).not.to.be.called
264278
expect(profileService.updateUserSkills).not.to.be.called
265-
expect(memberCertService.registerMember).to.be.calledOnce
279+
expect(memberCertService.registerMember).to.be.calledTwice// once for cognitive (default on) and another for ios
266280
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
267281
expect(state.go).not.to.be.called
268282
})

0 commit comments

Comments
 (0)