Skip to content

Commit 3f89208

Browse files
Scheduler - Add labelMode hidden to recurrence editor options (T1318550)
1 parent 0752d12 commit 3f89208

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
afterEach, beforeEach, describe, expect, it, jest,
33
} from '@jest/globals';
4+
import $ from '@js/core/renderer';
45

56
import fx from '../../../common/core/animation/fx';
67
import { createScheduler } from '../__tests__/__mock__/create_scheduler';
@@ -757,6 +758,34 @@ describe('Appointment popup form', () => {
757758
it.todo('Popup should not contain recurrence editor, if recurrenceRuleExpr is \'\'');
758759
it.todo('Multiple showing appointment popup for recurrence appointments and after update options should work correct');
759760
});
761+
762+
it('recurrence editors with hidden outer label must have editorOptions.labelMode set to hidden (T1318550)', () => {
763+
const $container = $('<div>').appendTo(document.body);
764+
const editor = ($container as any).dxRecurrenceEditor({
765+
value: 'FREQ=DAILY;COUNT=5',
766+
}).dxRecurrenceEditor('instance');
767+
768+
const recurrenceForm = editor.getRecurrenceForm();
769+
const formItems = recurrenceForm.option('items');
770+
771+
const collectItems = (items: any[]): any[] => items.flatMap(
772+
(i: any) => (i.items ? collectItems(i.items) : [i]),
773+
);
774+
const allItems = collectItems(formItems);
775+
const hiddenLabelEditors = allItems.filter(
776+
(i: any) => i.label?.visible === false && i.editorOptions,
777+
);
778+
779+
expect(hiddenLabelEditors.length).toBeGreaterThan(0);
780+
781+
const failing = hiddenLabelEditors
782+
.filter((i: any) => i.editorOptions.labelMode !== 'hidden')
783+
.map((i: any) => ({ dataField: i.dataField, labelMode: i.editorOptions.labelMode }));
784+
expect(failing).toEqual([]);
785+
786+
editor.dispose();
787+
$container.remove();
788+
});
760789
});
761790

762791
describe('Appointment Popup Content', () => {

packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ class RecurrenceEditor extends Editor {
365365
dataField: 'bymonth',
366366
editorType: 'dxSelectBox',
367367
editorOptions: {
368+
labelMode: 'hidden',
368369
stylingMode: getStylingModeFunc(),
369370
field: 'bymonth',
370371
items: months,
@@ -389,6 +390,7 @@ class RecurrenceEditor extends Editor {
389390
dataField: 'bymonthday',
390391
editorType: 'dxNumberBox',
391392
editorOptions: {
393+
labelMode: 'hidden',
392394
stylingMode: getStylingModeFunc(),
393395
min: 1,
394396
max: 31,
@@ -422,6 +424,7 @@ class RecurrenceEditor extends Editor {
422424
dataField: 'repeatEnd',
423425
editorType: 'dxRadioGroup',
424426
editorOptions: {
427+
labelMode: 'hidden',
425428
items: repeatEndTypes,
426429
value: repeatType,
427430
valueExpr: 'type',
@@ -565,6 +568,7 @@ class RecurrenceEditor extends Editor {
565568
label: { visible: false },
566569
editorType: 'dxNumberBox',
567570
editorOptions: {
571+
labelMode: 'hidden',
568572
stylingMode: getStylingModeFunc(),
569573
field: 'count',
570574
format: `# ${messageLocalization.format('dxScheduler-recurrenceRepeatCount')}`,
@@ -613,6 +617,7 @@ class RecurrenceEditor extends Editor {
613617
cssClass: REPEAT_UNTIL_DATE_EDITOR,
614618
editorType: 'dxDateBox',
615619
editorOptions: {
620+
labelMode: 'hidden',
616621
stylingMode: getStylingModeFunc(),
617622
field: 'until',
618623
value: until,

0 commit comments

Comments
 (0)