diff --git a/app/skill-picker/skill-picker.controller.js b/app/skill-picker/skill-picker.controller.js index ac6a9cd42..1def124b2 100644 --- a/app/skill-picker/skill-picker.controller.js +++ b/app/skill-picker/skill-picker.controller.js @@ -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']) diff --git a/app/skill-picker/skill-picker.jade b/app/skill-picker/skill-picker.jade index 2f0e42b97..343b225b6 100644 --- a/app/skill-picker/skill-picker.jade +++ b/app/skill-picker/skill-picker.jade @@ -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") diff --git a/app/skill-picker/skill-picker.spec.js b/app/skill-picker/skill-picker.spec.js index 8b35d1b35..c50a334ed 100644 --- a/app/skill-picker/skill-picker.spec.js +++ b/app/skill-picker/skill-picker.spec.js @@ -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() { @@ -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 @@ -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 }) @@ -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 }) @@ -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 }) @@ -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 }) @@ -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 }) @@ -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 @@ -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 @@ -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 })