-
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.
Merge pull request #331 from PermanentOrg/PER-8400-toggle-person-info…
…-public-archive PER-8400-toggle-person-info-public-archive
- Loading branch information
Showing
5 changed files
with
142 additions
and
55 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
82 changes: 57 additions & 25 deletions
82
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,57 @@ | ||
// 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('.archive-description').classes).toEqual({ | ||
'archive-description': true, | ||
'archive-description-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