mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { ComponentFixture, TestBed } from '@angular/core/testing'
|
|
import { ClearableBadgeComponent } from './clearable-badge.component'
|
|
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
|
|
|
describe('ClearableBadgeComponent', () => {
|
|
let component: ClearableBadgeComponent
|
|
let fixture: ComponentFixture<ClearableBadgeComponent>
|
|
|
|
beforeEach(async () => {
|
|
TestBed.configureTestingModule({
|
|
declarations: [ClearableBadgeComponent],
|
|
imports: [NgxBootstrapIconsModule.pick(allIcons)],
|
|
}).compileComponents()
|
|
|
|
fixture = TestBed.createComponent(ClearableBadgeComponent)
|
|
component = fixture.componentInstance
|
|
|
|
fixture.detectChanges()
|
|
})
|
|
|
|
it('should support selected', () => {
|
|
component.selected = true
|
|
expect(component.active).toBeTruthy()
|
|
})
|
|
|
|
it('should support numbered', () => {
|
|
component.number = 3
|
|
fixture.detectChanges()
|
|
expect(component.active).toBeTruthy()
|
|
expect((fixture.nativeElement as HTMLDivElement).textContent).toContain('3')
|
|
})
|
|
|
|
it('should support selected', () => {
|
|
let clearedResult
|
|
component.selected = true
|
|
fixture.detectChanges()
|
|
component.cleared.subscribe((clear) => {
|
|
clearedResult = clear
|
|
})
|
|
fixture.nativeElement
|
|
.querySelectorAll('button')[0]
|
|
.dispatchEvent(new MouseEvent('click'))
|
|
expect(clearedResult).toBeTruthy()
|
|
})
|
|
})
|