-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #985 from aneoconsulting/show-component-better-ref…
…resh chore: show component is now refreshed with subjects
- Loading branch information
Showing
17 changed files
with
210 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { Subject } from 'rxjs'; | ||
import { ShowActionButton } from '@app/types/components/show'; | ||
import { ShowActionAreaComponent } from './show-action-area.component'; | ||
|
||
describe('ShowActionAreaComponent', () => { | ||
let component: ShowActionAreaComponent; | ||
|
||
const disableCancel = new Subject<boolean>(); | ||
const disableClose = new Subject<boolean>(); | ||
|
||
const actions: ShowActionButton[] = [ | ||
{ | ||
id: 'tasks', | ||
name: 'See tasks', | ||
icon: 'tasks', | ||
link: '/tasks', | ||
queryParams: {}, | ||
}, | ||
{ | ||
id: 'results', | ||
name: 'See results', | ||
icon: 'results', | ||
link: '/results', | ||
queryParams: {}, | ||
}, | ||
{ | ||
id: 'partitions', | ||
name: 'See partitions', | ||
icon: 'partitions', | ||
link: '/partitions', | ||
queryParams: {}, | ||
}, | ||
{ | ||
id: 'cancel', | ||
name: 'Cancel Session', | ||
icon: 'cancel', | ||
action$: new Subject(), | ||
disabled: disableCancel, | ||
color: 'accent', | ||
area: 'right' | ||
}, | ||
{ | ||
id: 'close', | ||
name: 'Close Session', | ||
icon: 'close', | ||
action$: new Subject(), | ||
disabled: disableClose, | ||
color: 'accent', | ||
area: 'right' | ||
}, | ||
{ | ||
id: 'delete', | ||
name: 'Delete Session', | ||
icon: 'delete', | ||
action$: new Subject(), | ||
color: 'accent', | ||
area: 'right' | ||
} | ||
]; | ||
|
||
beforeEach(() => { | ||
component = new ShowActionAreaComponent(); | ||
component.actions = actions; | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should set actions', () => { | ||
expect(component.actions).toEqual(actions); | ||
}); | ||
|
||
it('should set isDisabled', () => { | ||
disableCancel.next(true); | ||
expect(component.isDisabled).toEqual({ | ||
cancel: true, | ||
close: false | ||
}); | ||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<mat-card> | ||
<mat-card-content> | ||
<mat-spinner *ngIf="!data" strokeWidth="4" diameter="40"/> | ||
<ng-container *ngIf="data"> | ||
<app-show-card-content [data]="data" [statuses]="statuses"/> | ||
</ng-container> | ||
</mat-card-content> | ||
</mat-card> |
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,27 @@ | ||
import { Subject } from 'rxjs'; | ||
import { ResultRaw } from '@app/results/types'; | ||
import { ShowCardComponent } from './show-card.component'; | ||
|
||
describe('ShowCardComponent', () => { | ||
|
||
let component: ShowCardComponent<ResultRaw>; | ||
|
||
const spy = { | ||
subscribe: jest.fn() | ||
} as unknown as Subject<ResultRaw>; | ||
|
||
beforeEach(() => { | ||
component = new ShowCardComponent(); | ||
component.data$ = spy; | ||
component.ngOnInit(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should subscribe to data$', () => { | ||
expect(spy.subscribe).toHaveBeenCalled(); | ||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<app-page-header [sharableURL]="sharableURL"> | ||
<ng-content></ng-content> | ||
<span>{{ id }}</span> | ||
<button mat-icon-button [cdkCopyToClipboard]="id ?? ''" (cdkCopyToClipboardCopied)="onCopiedTaskId()"> | ||
<mat-icon aria-hidden="true" fontIcon="content_copy" /> | ||
</button> | ||
</app-page-header> | ||
|
||
<app-show-actions [actionsButton]="actionsButton" (refresh)="onRefresh()" /> | ||
|
||
<app-show-card [data$]="data$" [statuses]="statuses" /> |
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
Oops, something went wrong.
03e999a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUnit
Files coverage (90%)