Skip to content

Commit 089fb52

Browse files
authored
Lookup and FileUploader: custom class added via inputWrapper should not remove default class (T1319976) (#32304)
1 parent db38784 commit 089fb52

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,11 +1101,11 @@ class FileUploader extends Editor<FileUploaderProperties> {
11011101
.addClass(FILEUPLOADER_INPUT_CONTAINER_CLASS)
11021102
.appendTo(this._$inputWrapper);
11031103

1104+
this._renderInput();
1105+
11041106
this._$fileInput
11051107
.addClass(FILEUPLOADER_INPUT_CLASS);
11061108

1107-
this._renderInput();
1108-
11091109
const labelId = `dx-fileuploader-input-label-${new Guid()}`;
11101110

11111111
this._$inputLabel

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ class Lookup extends DropDownList<LookupProperties> {
301301
}
302302

303303
_renderInput() {
304-
this._$field = $('<div>').addClass(LOOKUP_FIELD_CLASS);
305-
this._applyInputAttributes(this.option('inputAttr'));
304+
const { inputAttr } = this.option();
305+
this._$field = $('<div>');
306+
this._applyInputAttributes(inputAttr);
307+
this._$field.addClass(LOOKUP_FIELD_CLASS);
306308

307309
const $arrow = $('<div>').addClass(LOOKUP_ARROW_CLASS);
308310

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/fileUploader.markup.tests.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,18 @@ QUnit.module('fileUploader markup', () => {
189189
assert.strictEqual($fileInput.attr('autocomplete'), 'on', '"autocomplete" attribute has the same value');
190190
});
191191

192+
QUnit.test('Default input class should not be removed when a custom class added via inputAttr', function(assert) {
193+
const $fileUploader = $('#fileuploader').dxFileUploader({
194+
uploadMode: 'useButtons',
195+
inputAttr: {
196+
class: 'custom',
197+
}
198+
});
199+
200+
const $field = $fileUploader.find(`.${FILEUPLOADER_INPUT_CONTAINER_CLASS}`).find('input');
201+
202+
assert.strictEqual($field.attr('class'), `custom ${FILEUPLOADER_INPUT_CLASS}`, 'custom class is added and default class remains');
203+
});
192204
});
193205

194206
QUnit.module('multiple option', () => {

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,16 @@ QUnit.module('options', {
20782078
assert.strictEqual($field.attr('custom'), undefined, 'custom attribute is set correctly');
20792079
});
20802080

2081+
QUnit.test('Default input class should not be removed when a custom class added via inputAttr (T1319976)', function(assert) {
2082+
const lookup = $('#lookup').dxLookup({
2083+
inputAttr: { class: 'custom' },
2084+
}).dxLookup('instance');
2085+
2086+
const $field = $(lookup.field());
2087+
2088+
assert.strictEqual($field.attr('class'), `custom ${LOOKUP_FIELD_CLASS}`, 'custom class is added and default class remains');
2089+
});
2090+
20812091
QUnit.test('Displayed text should be correct when items have nested items field and grouping is disabled (T1292151)', function(assert) {
20822092
const $lookup = $('#lookup').dxLookup({
20832093
items: [

0 commit comments

Comments
 (0)