Skip to content

Commit b10adcf

Browse files
authored
DataGrid - AI Column: Support cssClass (#31164)
Co-authored-by: Alyar <>
1 parent 2eb2598 commit b10adcf

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

packages/devextreme/js/__internal/grids/grid_core/ai_column/ai_column.integration.test.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,29 @@ describe('GridCore AI Column', () => {
4343
jest.clearAllMocks();
4444
});
4545

46+
describe('when the cssClass is set', () => {
47+
it('should have class', async () => {
48+
const { instance } = await createDataGrid({
49+
dataSource: [
50+
{ id: 1, name: 'Name 1', value: 10 },
51+
],
52+
columns: [
53+
{ dataField: 'id', caption: 'ID' },
54+
{ dataField: 'name', caption: 'Name' },
55+
{ dataField: 'value', caption: 'Value' },
56+
{
57+
type: 'ai',
58+
caption: 'AI Column',
59+
name: 'myColumn',
60+
cssClass: 'custom-class',
61+
},
62+
],
63+
});
64+
65+
expect($(instance.getCellElement(0, 3)).hasClass('custom-class')).toBe(true);
66+
});
67+
});
68+
4669
describe('when the name is not set', () => {
4770
it('should throw E1066', async () => {
4871
await createDataGrid({
@@ -166,5 +189,29 @@ describe('GridCore AI Column', () => {
166189
expect(errors.log).toHaveBeenCalledWith('E1059', '"myColumn1"');
167190
});
168191
});
192+
193+
it('should apply cssClass to AI column', async () => {
194+
const { instance } = await createDataGrid({
195+
dataSource: [
196+
{ id: 1, name: 'Name 1', value: 10 },
197+
],
198+
columns: [
199+
{ dataField: 'id', caption: 'ID' },
200+
{ dataField: 'name', caption: 'Name' },
201+
{ dataField: 'value', caption: 'Value' },
202+
{
203+
type: 'ai',
204+
caption: 'AI Column',
205+
name: 'myColumn',
206+
},
207+
],
208+
});
209+
210+
expect($(instance.getCellElement(0, 3)).hasClass('custom-class')).toBe(false);
211+
212+
instance.columnOption('myColumn', 'cssClass', 'custom-class');
213+
214+
expect($(instance.getCellElement(0, 3)).hasClass('custom-class')).toBe(true);
215+
});
169216
});
170217
});

0 commit comments

Comments
 (0)