Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Provide HashService in popover #734

Merged
merged 3 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 2 additions & 14 deletions library/src/lib/popover/popover.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,16 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { PopoverComponent } from './popover.component';
import { HashService } from '../utils/hash.service';
import { PopoverDirective } from './popover-directive/popover.directive';
import { PopoverModule } from './popover.module';

describe('PopoverComponent', () => {
let component: PopoverComponent;
let fixture: ComponentFixture<PopoverComponent>;
let hashServiceSpy: jasmine.SpyObj<HashService>;

beforeEach(async(() => {
const hashSpy = jasmine.createSpyObj('HashService', {
hash: '1'
});

TestBed.configureTestingModule({
declarations: [PopoverComponent, PopoverDirective],
providers: [{ provide: HashService, useValue: hashSpy }]
imports: [PopoverModule]
}).compileComponents();

hashServiceSpy = TestBed.get(HashService);
Expand All @@ -28,13 +23,6 @@ describe('PopoverComponent', () => {
fixture.detectChanges();
});

it('should create and get an ID from the hasher', () => {
expect(component).toBeTruthy();
component.ngOnInit();
expect(hashServiceSpy.hash).toHaveBeenCalled();
expect(component.id).toBe('1');
});

it('should open', () => {
spyOn(component.isOpenChange, 'emit');
component.isOpen = false;
Expand Down
2 changes: 2 additions & 0 deletions library/src/lib/popover/popover.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import { PopoverControlComponent } from './popover-control/popover-control.compo
import { PopoverBodyComponent } from './popover-body/popover-body.component';
import { PopoverDirective } from './popover-directive/popover.directive';
import { PopoverContainer } from './popover-directive/popover-container';
import { HashService } from '../utils/hash.service';

@NgModule({
declarations: [PopoverComponent, PopoverControlComponent, PopoverBodyComponent, PopoverDirective, PopoverContainer],
imports: [CommonModule, UtilsModule],
exports: [PopoverComponent, PopoverControlComponent, PopoverBodyComponent, PopoverDirective],
providers: [HashService],
entryComponents: [PopoverContainer]
})
export class PopoverModule {}