Skip to content

Commit

Permalink
Merge pull request #115 from shikshalokam/SB-26013
Browse files Browse the repository at this point in the history
Issue #SB:26013 : pill click event issue fixed
  • Loading branch information
kiranharidas187 authored Aug 19, 2021
2 parents 64779dc + 5a69e9b commit 04c6d8a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ <h4 class="sb-categories-title text-left mt-16" *ngIf="apiContentList.length">
[title]="getSectionCategoryTitle('frmelmnts.lbl.targetCategory')"
[minDisplayCount]="4"
[pillSize]="'medium'" [platform]="'portal'"
[pillBorder]="'semi_round'" [pillsMultiRow]="'auto_responsive'" [pillTextElipsis]="'two_line'">
[pillBorder]="'semi_round'" [pillsMultiRow]="'auto_responsive'" [pillTextElipsis]="'two_line'" (select)="handleTargetedpillSelected($event)">
<sb-pill-item *ngFor="let pillData of targetedCategory" [name]="pillData?.name | titlecase"
[icon]="pillData?.icon?.web" [value]="pillData" (click)="handleTargetedpillSelected(pillData)"
[icon]="pillData?.icon?.web" [value]="pillData"
[theme]="targetedCategorytheme" ></sb-pill-item>
</sb-pills-grid>
<hr class="section-hr my-32" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3198,4 +3198,22 @@ export const categoryData = {
}
}]
}
};

export const EventPillData={
event: {
"isTrusted": true
},
data: [
{
name: "Observation",
value: {
name: "observation",
icon: {
web: "assets/images/mask-image/observation_category.png",
app: "assets/imgs/ic_observation_category.png"
}
}
}
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PublicPlayerService } from '@sunbird/public';
import { SuiModule } from 'ng2-semantic-ui-v9';
import * as _ from 'lodash-es';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { RESPONSE,categoryData } from './explore-page.component.spec.data';
import { RESPONSE,categoryData, EventPillData } from './explore-page.component.spec.data';
import { ActivatedRoute, Router } from '@angular/router';
import { TelemetryModule, IImpressionEventInput, TelemetryService } from '@sunbird/telemetry';
import { ExplorePageComponent } from './explore-page.component';
Expand Down Expand Up @@ -1011,7 +1011,7 @@ describe('ExplorePageComponent', () => {
spyOn(component, 'isUserLoggedIn').and.returnValue(true);
spyOn(component,"handleTargetedpillSelected").and.callThrough();
const router = TestBed.get(Router);
component.handleTargetedpillSelected({name:"observation"});
component.handleTargetedpillSelected(EventPillData);
router.url = '/observation';
expect(component.handleTargetedpillSelected).toHaveBeenCalled();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,8 @@ export class ExplorePageComponent implements OnInit, OnDestroy, AfterViewInit {
}
}

handleTargetedpillSelected(pillData){
handleTargetedpillSelected(event){
let pillData = event.data[0].value;
if(this.isUserLoggedIn()) {
if(pillData.name === 'observation'){
this.router.navigate(['observation']);
Expand Down

0 comments on commit 04c6d8a

Please sign in to comment.