-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added the merchant name as Suggestion in expense detail card fo…
…r CC expenses (#3369) * feat: Added the merchant name in expense detials card for CC expenses * added the merchant feature in view expense page * minor updates * test: Added unit tests for the cc merchant info (#3372)
- Loading branch information
1 parent
5dcc9f9
commit c3edb99
Showing
15 changed files
with
272 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...mponents/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<ion-header mode="md" class="header"> | ||
<ion-toolbar mode="md" class="fy-modal-toolbar"> | ||
<ion-buttons slot="start"> | ||
<ion-button | ||
(click)="closePopover()" | ||
class="cc-expense-merchant-info-popover__toolbar-close-btn" | ||
data-testid="close-btn" | ||
> | ||
<mat-icon class="fy-icon-close" svgIcon="cross"></mat-icon> | ||
</ion-button> | ||
</ion-buttons> | ||
<ion-title class="text-center cc-expense-merchant-info-popover__toolbar-title" data-testid="title" | ||
>Merchant</ion-title | ||
> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content class="cc-expense-merchant-info-popover__content"> | ||
<div class="cc-expense-merchant-info-popover__body" data-testid="content"> | ||
<ng-container>This merchant name comes from the transaction.</ng-container> | ||
</div> | ||
</ion-content> |
26 changes: 26 additions & 0 deletions
26
...mponents/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@import '../../../../theme/colors.scss'; | ||
|
||
.header { | ||
border-radius: 10px; | ||
} | ||
|
||
.cc-expense-merchant-info-popover { | ||
position: relative; | ||
|
||
&__toolbar-title { | ||
color: $black; | ||
font-size: 18px; | ||
line-height: normal; | ||
font-weight: 500; | ||
} | ||
|
||
&__toolbar-close-btn { | ||
position: absolute; | ||
} | ||
|
||
&__body { | ||
font-size: 14px; | ||
color: $black; | ||
padding: 20px 16px; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...nents/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { IonicModule, PopoverController } from '@ionic/angular'; | ||
|
||
import { CCExpenseMerchantInfoPopoverComponent } from './cc-expense-merchant-info-popover.component'; | ||
import { getElementBySelector } from 'src/app/core/dom-helpers'; | ||
|
||
describe('CCExpenseMerchantInfoComponent', () => { | ||
let component: CCExpenseMerchantInfoPopoverComponent; | ||
let popoverController: jasmine.SpyObj<PopoverController>; | ||
let fixture: ComponentFixture<CCExpenseMerchantInfoPopoverComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
const popoverControllerSpy = jasmine.createSpyObj('PopoverController', ['dismiss']); | ||
|
||
TestBed.configureTestingModule({ | ||
declarations: [CCExpenseMerchantInfoPopoverComponent], | ||
imports: [IonicModule.forRoot()], | ||
providers: [ | ||
{ | ||
provide: PopoverController, | ||
useValue: popoverControllerSpy, | ||
}, | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(CCExpenseMerchantInfoPopoverComponent); | ||
popoverController = TestBed.inject(PopoverController) as jasmine.SpyObj<PopoverController>; | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should close the popover when clicked on close button', () => { | ||
const closeBtn = getElementBySelector(fixture, '[data-testid="close-btn"') as HTMLButtonElement; | ||
closeBtn.click(); | ||
|
||
fixture.detectChanges(); | ||
|
||
expect(popoverController.dismiss).toHaveBeenCalled(); | ||
}); | ||
|
||
describe('template', () => { | ||
it('should display the correct title', () => { | ||
fixture.detectChanges(); | ||
const title = getElementBySelector(fixture, '[data-testid="title"'); | ||
expect(title.textContent).toEqual('Merchant'); | ||
}); | ||
|
||
it('should display the correct content', () => { | ||
fixture.detectChanges(); | ||
const content = getElementBySelector(fixture, '[data-testid="content"'); | ||
expect(content.textContent).toEqual('This merchant name comes from the transaction.'); | ||
}); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
...components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
import { PopoverController } from '@ionic/angular'; | ||
|
||
@Component({ | ||
selector: 'app-cc-expense-merchant-info', | ||
templateUrl: './cc-expense-merchant-info-popover.component.html', | ||
styleUrls: ['./cc-expense-merchant-info-popover.component.scss'], | ||
}) | ||
export class CCExpenseMerchantInfoPopoverComponent { | ||
constructor(private popoverController: PopoverController) {} | ||
|
||
closePopover(): void { | ||
this.popoverController.dismiss(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.