paperless-ngx/src-ui/src/app/components/common/hotkey-dialog/hotkey-dialog.component.spec.ts
2025-01-01 22:26:53 -08:00

36 lines
1.1 KiB
TypeScript

import { ComponentFixture, TestBed } from '@angular/core/testing'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { HotkeyDialogComponent } from './hotkey-dialog.component'
describe('HotkeyDialogComponent', () => {
let component: HotkeyDialogComponent
let fixture: ComponentFixture<HotkeyDialogComponent>
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HotkeyDialogComponent],
providers: [NgbActiveModal],
}).compileComponents()
fixture = TestBed.createComponent(HotkeyDialogComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
it('should support close', () => {
const closeSpy = jest.spyOn(component.activeModal, 'close')
component.close()
expect(closeSpy).toHaveBeenCalled()
})
it('should format keys', () => {
expect(component.formatKey('control.a')).toEqual('&#8963; a') // ⌃ + a
expect(component.formatKey('control.a', true)).toEqual('&#8984; a') // ⌘ + a
})
})