Minor test improvements

Refs #730
This commit is contained in:
Will Abson 2016-11-08 09:27:39 +00:00
parent 962b339eba
commit 190f01783b

View File

@ -35,7 +35,7 @@ describe('ActivitiStartProcessButton', () => {
let formService: FormService; let formService: FormService;
let getDefinitionsSpy: jasmine.Spy; let getDefinitionsSpy: jasmine.Spy;
let startProcessSpy: jasmine.Spy; let startProcessSpy: jasmine.Spy;
let de: DebugElement; let debugElement: DebugElement;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@ -55,6 +55,7 @@ describe('ActivitiStartProcessButton', () => {
fixture = TestBed.createComponent(ActivitiStartProcessButton); fixture = TestBed.createComponent(ActivitiStartProcessButton);
component = fixture.componentInstance; component = fixture.componentInstance;
debugElement = fixture.debugElement;
processService = fixture.debugElement.injector.get(ActivitiProcessService); processService = fixture.debugElement.injector.get(ActivitiProcessService);
formService = fixture.debugElement.injector.get(FormService); formService = fixture.debugElement.injector.get(FormService);
@ -79,15 +80,14 @@ describe('ActivitiStartProcessButton', () => {
it('should display the correct number of processes in the select list', () => { it('should display the correct number of processes in the select list', () => {
fixture.detectChanges(); fixture.detectChanges();
de = fixture.debugElement.query(By.css('select')); let selectElement = debugElement.query(By.css('select'));
expect(de.children.length).toBe(3); expect(selectElement.children.length).toBe(3);
}); });
it('should display the correct process def details', (done) => { it('should display the correct process def details', (done) => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
de = fixture.debugElement.queryAll(By.css('select option'))[1]; let optionEl: HTMLOptionElement = debugElement.queryAll(By.css('select option'))[1].nativeElement;
let optionEl: HTMLOptionElement = de.nativeElement;
expect(optionEl.value).toBe('my:process1'); expect(optionEl.value).toBe('my:process1');
expect(optionEl.textContent.trim()).toBe('My Process 1'); expect(optionEl.textContent.trim()).toBe('My Process 1');
done(); done();