Skip to content

Commit 647241e

Browse files
authored
Scheduler - Appointment Form - Reimplement legacy tests for the new form - Part 1 (#31798)
1 parent f196391 commit 647241e

File tree

3 files changed

+363
-236
lines changed

3 files changed

+363
-236
lines changed

packages/devextreme/js/__internal/scheduler/__tests__/__mock__/model/popup.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { dxElementWrapper } from '@js/core/renderer';
12
import $ from '@js/core/renderer';
23
import type dxForm from '@js/ui/form';
34
import type dxPopup from '@js/ui/popup';
@@ -45,6 +46,10 @@ export class PopupModel {
4546
return this.element.querySelector('.dx-scheduler-form-subject-group .dx-scheduler-form-icon .dx-icon');
4647
}
4748

49+
get subjectInput(): Element | null {
50+
return this.element.querySelector('.dx-scheduler-form-text-editor .dx-textbox.dx-widget');
51+
}
52+
4853
get startDate(): Element | null {
4954
return this.element.querySelector('.dx-scheduler-form-start-date-editor .dx-datebox.dx-widget');
5055
}
@@ -73,6 +78,10 @@ export class PopupModel {
7378
return this.element.querySelector('.dx-scheduler-form-repeat-editor .dx-selectbox.dx-widget');
7479
}
7580

81+
get descriptionTextArea(): Element | null {
82+
return this.element.querySelector('.dx-scheduler-form-description-editor .dx-textarea.dx-widget');
83+
}
84+
7685
get frequencyEditor(): Element | null {
7786
return this.element.querySelector('.dx-scheduler-form-recurrence-frequency-editor .dx-selectbox.dx-widget');
7887
}
@@ -133,6 +142,18 @@ export class PopupModel {
133142
return this.element.querySelector('.dx-scheduler-form-day-of-year-group');
134143
}
135144

145+
getInput = (editorName: string): dxElementWrapper | undefined => {
146+
const editor = this.form.getEditor(editorName);
147+
return editor?.$element().find('input.dx-texteditor-input');
148+
};
149+
150+
getInputValue = (editorName: string): string | undefined => {
151+
const result = this.getInput(editorName)?.val();
152+
return result as string | undefined;
153+
};
154+
155+
isInputVisible = (editorName: string): boolean => this.getInput(editorName)?.length === 1;
156+
136157
getLabelIdByText = (labelText: string): string => {
137158
const labels = Array.from(this.element.querySelectorAll('label'));
138159

0 commit comments

Comments
 (0)