Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commite976a2a

Browse files
committed
test(form-check-input): indeterminate coverage
1 parent38ecf8e commite976a2a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎projects/coreui-angular/src/lib/form/form-check/form-check-input.directive.spec.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import { FormCheckInputDirective } from './form-check-input.directive';
66
classMockElementRefextendsElementRef{}
77

88
@Component({
9-
template:'<input cFormCheckInput>',
9+
template:'<input cFormCheckInput [indeterminate]="indeterminate" [checked]="true">',
1010
imports:[FormCheckInputDirective]
1111
})
12-
classTestComponent{}
12+
classTestComponent{
13+
indeterminate=false;
14+
}
1315

1416
describe('FormCheckInputDirective',()=>{
1517
letcomponent:TestComponent;
@@ -21,11 +23,11 @@ describe('FormCheckInputDirective', () => {
2123
TestBed.configureTestingModule({
2224
imports:[FormCheckInputDirective,TestComponent],
2325
providers:[Renderer2,{provide:ElementRef,useClass:MockElementRef}]
24-
});
26+
}).compileComponents();
2527
fixture=TestBed.createComponent(TestComponent);
2628
component=fixture.componentInstance;
2729
inputEl=fixture.debugElement.query(By.directive(FormCheckInputDirective));
28-
// renderer =fixture.componentRef.injector.get(Renderer2 as Type<Renderer2>);
30+
fixture.detectChanges();
2931
});
3032

3133
it('should create an instance',()=>{
@@ -38,4 +40,11 @@ describe('FormCheckInputDirective', () => {
3840
it('should have css classes',()=>{
3941
expect(inputEl.nativeElement).toHaveClass('form-check-input');
4042
});
43+
44+
it('should have indeterminate state',()=>{
45+
component.indeterminate=true;
46+
fixture.detectChanges();
47+
expect(inputEl.nativeElement.checked).toBeFalse();
48+
expect(inputEl.nativeElement.indeterminate).toBeTrue();
49+
});
4150
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp