Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb32db2

Browse filesBrowse files
committed
test(accordion): coverage
1 parent bf397d2 commit fb32db2
Copy full SHA for fb32db2

File tree

Expand file treeCollapse file tree

1 file changed

+12
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-2
lines changed

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

Copy file name to clipboardExpand all lines: projects/coreui-angular/src/lib/accordion/accordion-item/accordion-item.component.spec.ts
+12-2Lines changed: 12 additions & 2 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.