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

Moving changes, for Cognitive Community Options in skill picker, to prod #1191

Merged
merged 4 commits into from
May 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/skill-picker/skill-picker.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ import _ from 'lodash'
vm.communities['ibm_cognitive'] = {
displayName: 'Cognitive',
programId: vm.IBM_COGNITIVE_PROGRAM_ID,
status: false,
dirty: false,
status: true,
dirty: true,
display: true
}
_addWatchToCommunity(vm.communities['ios'])
Expand Down
6 changes: 3 additions & 3 deletions app/skill-picker/skill-picker.jade
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
.community(ng-repeat="(communityKey, community) in vm.communities", ng-class="{'community--disabled': !community.status}", ng-if="community.display")
.community__details
.community__icon(ng-class="{'community__icon--disabled': !community.status}")
img(ng-if="communityKey == 'ibm_cognitive' && community.status", src=require("../../assets/images/ico-ibm_cognitive-community.svg"))
img(ng-if="communityKey == 'ibm_cognitive' && !community.status", src=require("../../assets/images/ico-ibm_cognitive-community-grey.svg"))
img(ng-if="communityKey == 'ios' && community.status", src=require("../../assets/images/ico-ios-community.svg"))
img(ng-if="communityKey == 'ios' && !community.status", src=require("../../assets/images/ico-ios-community-grey.svg"))
img(ng-if="communityKey == 'predix' && community.status", src=require("../../assets/images/ico-predix-community.svg"))
img(ng-if="communityKey == 'predix' && !community.status", src=require("../../assets/images/ico-predix-community-grey.svg"))
img(ng-if="communityKey == 'ibm_cognitive' && community.status", src=require("../../assets/images/ico-ibm_cognitive-community.svg"))
img(ng-if="communityKey == 'ibm_cognitive' && !community.status", src=require("../../assets/images/ico-ibm_cognitive-community-grey.svg"))

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

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

Expand Down
34 changes: 24 additions & 10 deletions app/skill-picker/skill-picker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ describe('Skill Picker Controller', function() {
expect(vm.username).to.exist.to.equal(mockProfile.handle)
})

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

it('should be created successfully with showCommunity being true', function() {
Expand Down Expand Up @@ -159,6 +159,20 @@ describe('Skill Picker Controller', function() {
$rootScope.$digest()
expect(mockProfile.save).not.to.be.called
expect(profileService.updateUserSkills).not.to.be.called
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
// we should still go to dashboard if the function is called,
// call to the function is controlled by disabling the button
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
})

it('should not make any registerMember call with cognitive being turned off ', function() {
vm.communities['ibm_cognitive'].status = false
vm.communities['ibm_cognitive'].dirty = true
vm.submitSkills()
$rootScope.$digest()
expect(mockProfile.save).not.to.be.called
expect(profileService.updateUserSkills).not.to.be.called
// we have turned off default on community, so no registerMember call expected
expect(memberCertService.registerMember).not.to.be.called
// we should still go to dashboard if the function is called,
// call to the function is controlled by disabling the button
Expand All @@ -172,7 +186,7 @@ describe('Skill Picker Controller', function() {
$rootScope.$digest()
expect(mockProfile.save).to.be.calledOnce
expect(profileService.updateUserSkills).not.to.be.called
expect(memberCertService.registerMember).not.to.be.called
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
})

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

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

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

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

Expand All @@ -234,7 +248,7 @@ describe('Skill Picker Controller', function() {
$rootScope.$digest()
expect(mockProfile.save).not.to.be.called
expect(profileService.updateUserSkills).not.to.be.called
expect(memberCertService.registerMember).not.to.be.called
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
// we should still go to dashboard if the function is called,
// call to the function is controlled by disabling the button
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
Expand All @@ -248,7 +262,7 @@ describe('Skill Picker Controller', function() {
$rootScope.$digest()
expect(mockProfile.save).not.to.be.called
expect(profileService.updateUserSkills).not.to.be.called
expect(memberCertService.registerMember).not.to.be.called
expect(memberCertService.registerMember).to.be.calledOnce//once for cognitive which is by default on
// we should still go to dashboard if the function is called,
// call to the function is controlled by disabling the button
expect(state.go).to.have.been.calledWith('dashboard').calledOnce
Expand All @@ -262,7 +276,7 @@ describe('Skill Picker Controller', function() {
$rootScope.$digest()
expect(mockProfile.save).not.to.be.called
expect(profileService.updateUserSkills).not.to.be.called
expect(memberCertService.registerMember).to.be.calledOnce
expect(memberCertService.registerMember).to.be.calledTwice// once for cognitive (default on) and another for ios
expect(toasterSvc.pop).to.have.been.calledWith('error', 'Whoops!', sinon.match('wrong')).calledOnce
expect(state.go).not.to.be.called
})
Expand Down