mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-03 21:39:22 +00:00
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
|
|
|
import { NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'
|
|
import { ConfirmButtonComponent } from './confirm-button.component'
|
|
|
|
describe('ConfirmButtonComponent', () => {
|
|
let component: ConfirmButtonComponent
|
|
let fixture: ComponentFixture<ConfirmButtonComponent>
|
|
|
|
beforeEach(async () => {
|
|
await TestBed.configureTestingModule({
|
|
imports: [NgbPopoverModule, ConfirmButtonComponent],
|
|
}).compileComponents()
|
|
|
|
fixture = TestBed.createComponent(ConfirmButtonComponent)
|
|
component = fixture.componentInstance
|
|
fixture.detectChanges()
|
|
})
|
|
|
|
it('should show confirm on click', () => {
|
|
expect(component.popover.isOpen()).toBeFalsy()
|
|
expect(component.confirming).toBeFalsy()
|
|
component.onClick(new MouseEvent('click'))
|
|
expect(component.popover.isOpen()).toBeTruthy()
|
|
expect(component.confirming).toBeTruthy()
|
|
})
|
|
|
|
it('should emit confirm on confirm', () => {
|
|
const confirmSpy = jest.spyOn(component.confirm, 'emit')
|
|
component.onConfirm(new MouseEvent('click'))
|
|
expect(confirmSpy).toHaveBeenCalled()
|
|
expect(component.popover.isOpen()).toBeFalsy()
|
|
expect(component.confirming).toBeFalsy()
|
|
})
|
|
})
|