Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add survey.getProgressTypeComponent to remove code duplication in Cre… #6601

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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