-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PER-8400-toggle-person-info-public-archive
PER-8400-toggle-person-info-public-archive Added a chevron that expands the profile information on mobile devices.
- Loading branch information
1 parent
4148949
commit fe18188
Showing
5 changed files
with
160 additions
and
31 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
88 changes: 63 additions & 25 deletions
88
src/app/public/components/public-archive/public-archive.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 |
---|---|---|
@@ -1,25 +1,63 @@ | ||
// import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
// import { PublicArchiveComponent } from './public-archive.component'; | ||
|
||
// describe('PublicArchiveComponent', () => { | ||
// let component: PublicArchiveComponent; | ||
// let fixture: ComponentFixture<PublicArchiveComponent>; | ||
|
||
// beforeEach(async(() => { | ||
// TestBed.configureTestingModule({ | ||
// declarations: [ PublicArchiveComponent ] | ||
// }) | ||
// .compileComponents(); | ||
// })); | ||
|
||
// beforeEach(() => { | ||
// fixture = TestBed.createComponent(PublicArchiveComponent); | ||
// component = fixture.componentInstance; | ||
// fixture.detectChanges(); | ||
// }); | ||
|
||
// it('should create', () => { | ||
// expect(component).toBeTruthy(); | ||
// }); | ||
// }); | ||
/* @format */ | ||
import { waitForAsync } from '@angular/core/testing'; | ||
import { PublicModule } from '@public/public.module'; | ||
import { Shallow } from 'shallow-render'; | ||
import { of } from 'rxjs'; | ||
import { PublicProfileService } from '@public/services/public-profile/public-profile.service'; | ||
import { PublicArchiveComponent } from './public-archive.component'; | ||
|
||
const publicProfileServiceMock = { | ||
publicRoot$: () => of({}), | ||
archive$: () => of({}), | ||
profileItemsDictionary$: () => of({}), | ||
}; | ||
|
||
describe('PublicArchiveComponent', () => { | ||
let shallow: Shallow<PublicArchiveComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
shallow = new Shallow(PublicArchiveComponent, PublicModule).provideMock({ | ||
provide: PublicProfileService, | ||
useValue: publicProfileServiceMock, | ||
}); | ||
})); | ||
|
||
it('should create', async () => { | ||
const { instance } = await shallow.render(); | ||
expect(instance).toBeTruthy(); | ||
}); | ||
|
||
it('should have the information hidden as default', async () => { | ||
const { instance } = await shallow.render(); | ||
expect(instance.showProfileInformation).toBe(false); | ||
}); | ||
|
||
it('should have the information shown when the button is clicked', async () => { | ||
const { instance, find } = await shallow.render(); | ||
const icon = find('.icon-expand'); | ||
icon.nativeElement.click(); | ||
expect(instance.showProfileInformation).toBe(true); | ||
}); | ||
|
||
it('should give the correct classes when expanding the information', async () => { | ||
const { find, fixture, instance } = await shallow.render(); | ||
const icon = find('.icon-expand'); | ||
icon.nativeElement.click(); | ||
|
||
fixture.detectChanges(); | ||
|
||
expect(find('.profile-description').classes).toEqual({ | ||
'profile-description': true, | ||
'profile-description-show': true, | ||
}); | ||
|
||
instance.isViewingProfile$ = of(true); | ||
|
||
fixture.detectChanges(); | ||
|
||
expect(find('.profile-info').classes).toEqual({ | ||
'profile-info': true, | ||
'profile-info-show': true, | ||
}); | ||
}); | ||
}); |
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