Refactor Manage Trigger to Single Workflow (#2577)

* Refactor Manage Trigger to Single Workflow
This commit is contained in:
Alec Merdler 2017-05-22 13:59:12 -07:00 committed by GitHub
parent d122743129
commit 97256841bd
26 changed files with 1262 additions and 1077 deletions

View file

@ -17,23 +17,13 @@ describe("LinearWorkflowComponent", () => {
newSection = new LinearWorkflowSectionComponent(component);
});
it("does not set 'sectionVisible' or 'isCurrentSection' of given section if not the first section added", () => {
component.addSection(new LinearWorkflowSectionComponent(component));
component.addSection(newSection);
expect(newSection.sectionVisible).toBe(false);
expect(newSection.isCurrentSection).toBe(false);
});
it("sets 'sectionVisible' of given section to true if it is the first section added", () => {
it("sets 'sectionVisible' and 'isCurrentSection' to first section in list that is not skipped", () => {
var skippedSection: LinearWorkflowSectionComponent = new LinearWorkflowSectionComponent(component);
skippedSection.skipSection = true;
component.addSection(skippedSection);
component.addSection(newSection);
expect(newSection.sectionVisible).toBe(true);
});
it("sets 'isCurrentSection' of given section to true if it is the first section added", () => {
component.addSection(newSection);
expect(newSection.isCurrentSection).toBe(true);
});
});
@ -71,6 +61,21 @@ describe("LinearWorkflowComponent", () => {
expect(nextSection.isCurrentSection).toBe(true);
expect(nextSection.sectionVisible).toBe(true);
});
it("does not set the current section to a skipped section", () => {
var skippedSection: LinearWorkflowSectionComponent = new LinearWorkflowSectionComponent(component);
var nextSection: LinearWorkflowSectionComponent = new LinearWorkflowSectionComponent(component);
skippedSection.skipSection = true;
component.addSection(skippedSection);
component.addSection(nextSection);
component.onNextSection();
expect(currentSection.isCurrentSection).toBe(false);
expect(skippedSection.isCurrentSection).toBe(false);
expect(skippedSection.sectionVisible).toBe(false);
expect(nextSection.isCurrentSection).toBe(true);
expect(nextSection.sectionVisible).toBe(true);
});
});
describe("onSectionInvalid", () => {