forked from madoar/angular-archwizard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wizard-step-symbol.directive.spec.ts
54 lines (45 loc) · 1.64 KB
/
wizard-step-symbol.directive.spec.ts
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
52
53
54
import {ViewChild, Component} from '@angular/core';
import {TestBed, async, ComponentFixture} from '@angular/core/testing';
import {By} from '@angular/platform-browser';
import {WizardComponent} from '../components/wizard.component';
import {ArchwizardModule} from '../archwizard.module';
@Component({
selector: 'aw-test-wizard',
template: `
<aw-wizard>
<aw-wizard-step stepTitle='Step A'>
<ng-template awWizardStepSymbol>A</ng-template>
Step A content
</aw-wizard-step>
<aw-wizard-completion-step stepTitle='Step B'>
<ng-template awWizardStepSymbol>B</ng-template>
Step B content
</aw-wizard-completion-step>
</aw-wizard>
`
})
class WizardTestComponent {
@ViewChild(WizardComponent)
public wizard: WizardComponent;
}
describe('WizardStepSymbolDirective', () => {
let wizardTest: WizardTestComponent;
let wizardTestFixture: ComponentFixture<WizardTestComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [WizardTestComponent],
imports: [ArchwizardModule]
}).compileComponents();
}));
beforeEach(() => {
wizardTestFixture = TestBed.createComponent(WizardTestComponent);
wizardTestFixture.detectChanges();
wizardTest = wizardTestFixture.componentInstance;
});
it('should create an instance', () => {
let navigationSymbols = wizardTestFixture.debugElement.queryAll(By.css('aw-wizard-navigation-bar ul li .step-indicator'));
expect(navigationSymbols.length).toBe(2);
expect(navigationSymbols[0].nativeElement.innerText).toBe('A');
expect(navigationSymbols[1].nativeElement.innerText).toBe('B');
});
});