Skip to content

Commit

Permalink
Add survey.getProgressTypeComponent to remove code duplication in Cre…
Browse files Browse the repository at this point in the history
…ator (#6601)
  • Loading branch information
andrewtelnov authored Jul 27, 2023
1 parent 9ab6056 commit 2c21bca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,9 @@ export class SurveyModel extends SurveyElementCore
if (!this.canShowProresBar()) return false;
return this.showProgressBar === "bottom" || this.showProgressBar === "both";
}
public getProgressTypeComponent(): string {
return "sv-progress-" + this.progressBarType.toLowerCase();
}
public getProgressCssClasses(): string {
return new CssClassBuilder()
.append(this.css.progress)
Expand Down
2 changes: 2 additions & 0 deletions tests/surveytests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,9 @@ QUnit.test("progressText, 'requiredQuestions' type and design mode", function (
assert.equal(survey.progressText, "Page 1 of 4");
survey.progressBarType = "questions";
assert.equal(survey.progressText, "Answered 0/4 questions");
assert.equal(survey.getProgressTypeComponent(), "sv-progress-questions", "questions component");
survey.progressBarType = "requiredQuestions";
assert.equal(survey.getProgressTypeComponent(), "sv-progress-requiredquestions", "requiredQuestions component");
assert.equal(survey.progressText, "Answered 0/2 questions");
});
QUnit.test("progressText, 'requiredQuestions' type and required matrix dropdown, bug#5375", function (
Expand Down

0 comments on commit 2c21bca

Please sign in to comment.