-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathinput-group-sample-7.component.spec.ts
More file actions
51 lines (41 loc) · 1.79 KB
/
input-group-sample-7.component.spec.ts
File metadata and controls
51 lines (41 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { InputGroupSample7Component } from './input-group-sample-7.component';
describe('InputGroupSample7Component', () => {
let component: InputGroupSample7Component;
let fixture: ComponentFixture<InputGroupSample7Component>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [InputGroupSample7Component]
})
.compileComponents();
fixture = TestBed.createComponent(InputGroupSample7Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should have inputs with matching id and for attributes', () => {
const compiled = fixture.nativeElement;
// Check fullName input and label
const fullNameInput = compiled.querySelector('#fullName');
const fullNameLabel = compiled.querySelector('label[for="fullName"]');
expect(fullNameInput).toBeTruthy();
expect(fullNameLabel).toBeTruthy();
// Check emailAddress input and label
const emailInput = compiled.querySelector('#emailAddress');
const emailLabel = compiled.querySelector('label[for="emailAddress"]');
expect(emailInput).toBeTruthy();
expect(emailLabel).toBeTruthy();
// Check phoneNumber input and label
const phoneInput = compiled.querySelector('#phoneNumber');
const phoneLabel = compiled.querySelector('label[for="phoneNumber"]');
expect(phoneInput).toBeTruthy();
expect(phoneLabel).toBeTruthy();
// Check userName input and label
const userNameInput = compiled.querySelector('#userName');
const userNameLabel = compiled.querySelector('label[for="userName"]');
expect(userNameInput).toBeTruthy();
expect(userNameLabel).toBeTruthy();
});
});