Skip to content

Commit fb32db2

Browse files
committed
test(accordion): coverage
1 parent bf397d2 commit fb32db2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

projects/coreui-angular/src/lib/accordion/accordion-item/accordion-item.component.spec.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
33
import { AccordionButtonDirective } from '../accordion-button/accordion-button.directive';
44
import { AccordionService } from '../accordion.service';
55
import { AccordionItemComponent } from './accordion-item.component';
6+
import { ComponentRef } from '@angular/core';
67

78
describe('AccordionItemComponent', () => {
89
let component: AccordionItemComponent;
10+
let componentRef: ComponentRef<AccordionItemComponent>;
911
let fixture: ComponentFixture<AccordionItemComponent>;
1012

1113
beforeEach(async () => {
1214
await TestBed.configureTestingModule({
1315
providers: [AccordionService],
1416
imports: [NoopAnimationsModule, AccordionButtonDirective, AccordionItemComponent]
15-
})
16-
.compileComponents();
17+
}).compileComponents();
1718
});
1819

1920
beforeEach(() => {
2021
fixture = TestBed.createComponent(AccordionItemComponent);
2122
component = fixture.componentInstance;
23+
componentRef = fixture.componentRef;
2224
fixture.detectChanges();
2325
});
2426

@@ -29,4 +31,12 @@ describe('AccordionItemComponent', () => {
2931
it('should have css classes', () => {
3032
expect(fixture.nativeElement).toHaveClass('accordion-item');
3133
});
34+
35+
it('should toggle item', () => {
36+
expect(component.visible).toBeFalse();
37+
component.toggleItem();
38+
expect(component.visible).toBeTrue();
39+
component.toggleItem();
40+
expect(component.visible).toBeFalse();
41+
});
3242
});

0 commit comments

Comments
 (0)