Skip to content

Commit 0f210ad

Browse files
authored
Scheduler - Appointment Form - Reimplement legacy tests for the new form - Part 3 (#31833)
1 parent 2f72e76 commit 0f210ad

4 files changed

Lines changed: 423 additions & 101 deletions

File tree

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,27 +145,33 @@ export class PopupModel {
145145
getInput = (editorName: string): dxElementWrapper => {
146146
const editor = this.form.getEditor(editorName);
147147

148-
const textInput = editor?.$element().find('.dx-texteditor-input');
148+
let $input: dxElementWrapper | undefined | null = null;
149149

150-
if (textInput?.length) {
151-
return textInput;
150+
if (editorName === 'startDateTimeZoneEditor' || editorName === 'endDateTimeZoneEditor') {
151+
$input = editor?.$element().find('input[type="hidden"]');
152152
}
153153

154-
const input = editor?.$element().find('input');
154+
if (!$input?.length) {
155+
$input = editor?.$element().find('.dx-texteditor-input');
156+
}
157+
158+
if (!$input?.length) {
159+
$input = editor?.$element().find('input');
160+
}
155161

156-
if (input?.length) {
157-
return input;
162+
if (!$input?.length) {
163+
throw new Error(`Input element of editor with name "${editorName}" not found`);
158164
}
159165

160-
throw new Error(`Input element of editor with name "${editorName}" not found`);
166+
return $input;
161167
};
162168

163169
getInputValue = (editorName: string): string => {
164170
const $input = this.getInput(editorName);
165171
return $input.val() as unknown as string;
166172
};
167173

168-
setInputValue = (editorName: string, value: string | Date | boolean | null): void => {
174+
setInputValue = (editorName: string, value: string | number | Date | boolean | null): void => {
169175
this.form.getEditor(editorName)?.option('value', value);
170176
};
171177

0 commit comments

Comments
 (0)