added tests for linear workflow components

This commit is contained in:
alecmerdler 2017-02-22 15:44:20 -08:00 committed by Joseph Schorr
parent b0cc8d0f19
commit ff07533d80
8 changed files with 198 additions and 86 deletions

View file

@ -10,7 +10,7 @@ import { LinearWorkflowComponent } from './linear-workflow.component';
templateUrl: '/static/js/directives/ui/linear-workflow/linear-workflow-section.component.html',
transclude: true,
require: {
parent: '^linearWorkflow'
parent: '^^linearWorkflow'
}
})
export class LinearWorkflowSectionComponent implements ng.IComponentController {
@ -22,11 +22,19 @@ export class LinearWorkflowSectionComponent implements ng.IComponentController {
public isCurrentSection: boolean = false;
public parent: LinearWorkflowComponent;
constructor() {
}
public $onInit(): void {
this.parent.addSection(this);
}
public $onChanges(changes: ng.IOnChangesObject): void {
if (changes['sectionValid'] !== undefined && !changes['sectionValid'].currentValue) {
this.parent.onSectionInvalid(this.sectionId);
}
}
public onSubmitSection(): void {
if (this.sectionValid) {
this.parent.onNextSection();
}
}
}