Skip to content

Commit fc99a0b

Browse files
Merge branch '26_1' into 26_1_leak_test_tune_v2
2 parents 9a3cc17 + 4df9dd6 commit fc99a0b

3 files changed

Lines changed: 36 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,8 +1666,8 @@ describe('Appointment Form', () => {
16661666

16671667
scheduler.showAppointmentPopup(commonAppointment);
16681668

1669-
// @ts-expect-error POM.popup.dxForm.option('items')[1]
1670-
const recurrenceGroup = POM.popup.dxForm.option('items')[1] as GroupItem;
1669+
const formItems = POM.popup.dxForm.option('items') ?? [];
1670+
const recurrenceGroup = formItems[1] as GroupItem;
16711671
const allItems = flattenBy<SimpleItem>(
16721672
recurrenceGroup.items as SimpleItem[],
16731673
(i) => (i as unknown as GroupItem).items as SimpleItem[] | undefined,

packages/devextreme/js/__internal/ui/chat/chat.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,11 @@ class Chat extends Widget<ChatProperties> {
786786
this._createSendButtonAction();
787787
this._messageBox.option(name, this._getSendButtonOptionsWithAction());
788788
break;
789-
case 'suggestions':
790-
this._suggestions?.updateOptions(value as ChatProperties['suggestions']);
789+
case 'suggestions': {
790+
const { suggestions } = this.option();
791+
this._suggestions?.updateOptions(suggestions);
791792
break;
793+
}
792794
default:
793795
super._optionChanged(args);
794796
}

packages/devextreme/testing/tests/DevExpress.ui.widgets/chatParts/chat.tests.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,6 +2821,36 @@ QUnit.module('Chat', () => {
28212821
assert.strictEqual(this.getSuggestionsElement().length, 1, 'suggestions container remains in DOM');
28222822
assert.strictEqual(this.getSuggestionItems().length, 0, 'items are removed');
28232823
});
2824+
2825+
QUnit.test('suggestions items should be updated via nested option path', function(assert) {
2826+
this.reinit({
2827+
suggestions: { items: [{ text: 'Item 1' }] },
2828+
});
2829+
2830+
this.instance.option('suggestions.items', [{ text: 'New 1' }, { text: 'New 2' }]);
2831+
2832+
assert.strictEqual(this.getSuggestionItems().length, 2, 'items count updated via nested path');
2833+
assert.strictEqual(this.getSuggestionItems().eq(0).text(), 'New 1', 'first item text updated');
2834+
});
2835+
2836+
QUnit.test('nested option update should not drop other suggestions options', function(assert) {
2837+
assert.expect(1);
2838+
2839+
const clickedText = 'Item 1';
2840+
2841+
this.reinit({
2842+
suggestions: {
2843+
items: [{ text: clickedText }],
2844+
onItemClick: (e) => {
2845+
assert.strictEqual(e.itemData.text, clickedText, 'onItemClick preserved after nested update');
2846+
},
2847+
},
2848+
});
2849+
2850+
this.instance.option('suggestions.items', [{ text: clickedText }, { text: 'Item 2' }]);
2851+
2852+
this.getSuggestionItems().first().trigger('dxclick');
2853+
});
28242854
});
28252855

28262856
QUnit.module('Data Layer Integration', {

0 commit comments

Comments
 (0)