Skip to content

Commit

Permalink
work for #8568 fix markup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OlgaLarina committed Jul 19, 2024
1 parent d5e89e5 commit a7d9bab
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/dropdownListModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export class DropdownListModel extends Base {
this.resetItemsSettings();
}
}
this.question.ariaExpanded = option.isVisible ? "true" : "false";
this.question.processPopupVisiblilityChanged(this.popupModel, option.isVisible);
});
}
Expand Down Expand Up @@ -374,6 +375,7 @@ export class DropdownListModel extends Base {
constructor(protected question: Question, protected onSelectionChanged?: (item: IAction, ...params: any[]) => void) {
super();
this.htmlCleanerElement = DomDocumentHelper.createElement("div") as HTMLDivElement;
this.question.ariaExpanded = "false";
question.onPropertyChanged.add(this.questionPropertyChangedHandler);
this.showInputFieldComponent = this.question.showInputFieldComponent;

Expand Down
5 changes: 2 additions & 3 deletions src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class Question extends SurveyElement<Question>
public themeChanged(theme: ITheme): void { }
@property({ defaultValue: false }) isMobile: boolean;
@property() forceIsInputReadOnly: boolean;
@property() ariaExpanded: "true" | "false";

constructor(name: string) {
super(name);
Expand Down Expand Up @@ -2680,9 +2681,7 @@ export class Question extends SurveyElement<Question>
return null;
}
}
public get ariaExpanded(): string {
return null;
}

public get ariaErrormessage(): string {
if (this.isNewA11yStructure) return null;

Expand Down
4 changes: 0 additions & 4 deletions src/question_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ export class QuestionDropdownModel extends QuestionSelectBase {
public get popupModel(): PopupModel {
return this.dropdownListModel?.popupModel;
}
public get ariaExpanded(): string {
const popupModel = this.popupModel;
return !!popupModel && popupModel.isVisible ? "true" : "false";
}

public onOpened: EventBase<QuestionDropdownModel> = this.addEvent<QuestionDropdownModel>();
public onOpenedCallBack(): void {
Expand Down
6 changes: 1 addition & 5 deletions src/question_rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,11 +867,7 @@ export class QuestionRatingModel extends Question {
protected getDesktopRenderAs(): string {
return (this.displayMode == "dropdown") ? "dropdown" : "default";
}
public get ariaExpanded(): string {
const popupModel = this.dropdownListModel?.popupModel;
if (!popupModel) return null;
return popupModel.isVisible ? "true" : "false";
}

private dropdownListModelValue: DropdownListModel;
public set dropdownListModel(val: DropdownListModel) {
this.dropdownListModelValue = val;
Expand Down
4 changes: 0 additions & 4 deletions src/question_tagbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ export class QuestionTagboxModel extends QuestionCheckboxModel {
public get popupModel(): PopupModel {
return this.dropdownListModel?.popupModel;
}
public get ariaExpanded(): string {
const popupModel = this.popupModel;
return !!popupModel && popupModel.isVisible ? "true" : "false";
}

public getControlClass(): string {
return new CssClassBuilder()
Expand Down
20 changes: 16 additions & 4 deletions tests/markup/etalon_dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,14 @@ registerMarkupTests(
},
initSurvey: (survey) => {
survey.focusFirstQuestionAutomatic = false;
survey.getQuestionByName("name")["popupModel"];
survey.getQuestionByName("name")["dropdownListModel"].inputStringRendered = "o";
survey.onAfterRenderQuestion.add((target, options) => {
options.question["popupModel"];
options.question["dropdownListModel"].inputStringRendered = "o";
});
},
event: "onAfterRenderSurvey",
getElement: el => {
return <HTMLElement>el?.querySelector(".sv_q.sv_qstn > div") as HTMLElement;
},
timeout: 300,
removeIds: true,
Expand All @@ -355,8 +361,14 @@ registerMarkupTests(
},
initSurvey: (survey) => {
survey.focusFirstQuestionAutomatic = false;
survey.getQuestionByName("name")["popupModel"];
survey.getQuestionByName("name")["dropdownListModel"].inputStringRendered = "o";
survey.onAfterRenderQuestion.add((target, options) => {
options.question["popupModel"];
options.question["dropdownListModel"].inputStringRendered = "o";
});
},
event: "onAfterRenderSurvey",
getElement: el => {
return <HTMLElement>el?.querySelector(".sv_q.sv_qstn > div") as HTMLElement;
},
timeout: 300,
removeIds: true,
Expand Down

0 comments on commit a7d9bab

Please sign in to comment.