Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/devextreme/js/__internal/core/utils/m_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export const toComparable = function (value, caseSensitive?, options: any = {})
const isCaseSensitive = caseSensitive || collatorSensitivity === 'case' || collatorSensitivity === 'variant';

if (typeof value === 'string' && !isCaseSensitive) {
value = value.normalize('NFC');
Comment thread
r-farkhutdinov marked this conversation as resolved.
const locale = options?.locale?.toLowerCase();
const useUpperCase = locale && !!['hy', 'el'].find((code) => locale === code || locale.startsWith(`${code}-`));

Comment thread
r-farkhutdinov marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3379,6 +3379,36 @@ QUnit.module('dataSource integration', {
this.clock.tick(loadDelay / 2);
assert.ok($loadPanel.is(':hidden'), 'load panel is not visible if value length less than minSearchLength)');
});

QUnit.test('search should find items when search value is in NFD Unicode form and items are in NFC form (T1326069)', function(assert) {
const NFC_CHAR = '\u1EC7'; // precomposed form (NFC)
const itemsNFC = [
`test item 1 h${NFC_CHAR}`,
`test item 2 H${NFC_CHAR}`,
'test item 3',
];

const instance = this.$element.dxLookup({
dataSource: itemsNFC,
searchEnabled: true,
searchTimeout: 0,
opened: true
}).dxLookup('instance');

const $content = $(instance.content());
const $input = $content.find(`.${LOOKUP_SEARCH_CLASS} .${TEXTEDITOR_INPUT_CLASS}`);

const searchValueNFD = 'h\u0065\u0323\u0302';

assert.notStrictEqual(searchValueNFD, searchValueNFD.normalize('NFC'),
'NFD and NFC forms are different strings');

$($input.val(searchValueNFD)).trigger('input');
Comment thread
r-farkhutdinov marked this conversation as resolved.
Comment thread
r-farkhutdinov marked this conversation as resolved.
this.clock.tick(0);

const $listItems = $content.find(`.${LIST_ITEM_CLASS}`);
assert.equal($listItems.length, 2, 'items containing the NFC character should be found when searching with its NFD equivalent');
});
});


Expand Down
Loading