Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alyar committed Oct 2, 2024
1 parent dfe2ee9 commit ab1f9c4
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,68 +11,68 @@ fixture.disablePageReloads`Sticky columns - Adaptability`
.page(url(__dirname, '../../container.html'));

[false, true].forEach((rtlEnabled) => {
safeSizeTest(`Sticky columns with adaptive detail row (rtlEnabled = ${rtlEnabled})`, async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
const scrollLeft = rtlEnabled ? -10000 : 10000;

await dataGrid.apiExpandAdaptiveDetailRow(1);

await takeScreenshot(`sticky_columns_with_adaptive_detail_row_1_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await dataGrid.scrollTo(t, { x: scrollLeft });

await takeScreenshot(`sticky_columns_with_adaptive_detail_row_2_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}, [900, 800]).before(async () => createWidget('dxDataGrid', {
...defaultConfig,
width: 800,
rtlEnabled,
columns: defaultConfig.columns.map((column, index) => {
if (index < 3) {
column.hidingPriority = index;
}

column.width = 200;

return column;
}),
columnHidingEnabled: true,
}));

safeSizeTest(`Sticky columns with sticky positions (rtlEnabled = ${rtlEnabled})`, async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);

await takeScreenshot(`sticky_columns_with_sticky_positions_1_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await dataGrid.scrollTo(t, { x: 10000 });

await takeScreenshot(`sticky_columns_with_sticky_positions_2_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}, [900, 800]).before(async () => createWidget('dxDataGrid', {
...defaultConfig,
width: 800,
rtlEnabled,
columns: defaultConfig.columns.map((column, index) => {
if (index === 1 || index === 4) {
column.fixed = true;
column.fixedPosition = 'sticky';
} else {
column.fixed = false;
}
safeSizeTest(`Sticky columns with adaptive detail row (rtlEnabled = ${rtlEnabled})`, async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
const scrollLeft = rtlEnabled ? -10000 : 10000;

await dataGrid.apiExpandAdaptiveDetailRow(1);

await takeScreenshot(`sticky_columns_with_adaptive_detail_row_1_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await dataGrid.scrollTo(t, { x: scrollLeft });

await takeScreenshot(`sticky_columns_with_adaptive_detail_row_2_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}, [900, 800]).before(async () => createWidget('dxDataGrid', {
...defaultConfig,
width: 800,
rtlEnabled,
columns: defaultConfig.columns.map((column, index) => {
if (index < 3) {
column.hidingPriority = index;
column.width = 200;
}

column.width = 200;

return column;
}),
columnHidingEnabled: true,
}));

safeSizeTest(`Sticky columns with sticky positions (rtlEnabled = ${rtlEnabled})`, async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);

await takeScreenshot(`sticky_columns_with_sticky_positions_1_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await dataGrid.scrollTo(t, { x: 10000 });

await takeScreenshot(`sticky_columns_with_sticky_positions_2_(rtlEnabled_=_${rtlEnabled}).png`, dataGrid.element);

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}, [900, 800]).before(async () => createWidget('dxDataGrid', {
...defaultConfig,
width: 800,
rtlEnabled,
columns: defaultConfig.columns.map((column, index) => {
if (index === 1 || index === 4) {
column.fixed = true;
column.fixedPosition = 'sticky';
} else {
column.fixed = false;
}

column.hidingPriority = index;
column.width = 200;

return column;
}),
columnHidingEnabled: true,
}));
return column;
}),
columnHidingEnabled: true,
}));
});
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export class ColumnsController extends modules.Controller {
column.fixedPosition = parentBandColumns[0]?.fixedPosition ?? column.fixedPosition;

if (column.fixed && column.fixedPosition !== StickyPosition.Sticky) {
const isDefaultCommandColumn = !!column.command && !gridCoreUtils.isCustomCommandColumn(this, column);
const isDefaultCommandColumn = !!column.command && !gridCoreUtils.isCustomCommandColumn(this._columns, column);

let isFixedToEnd = column.fixedPosition === 'right';

Expand Down Expand Up @@ -1839,7 +1839,7 @@ export class ColumnsController extends modules.Controller {

public getColumnId(column) {
if (column.command && column.type === GROUP_COMMAND_COLUMN_NAME) {
if (gridCoreUtils.isCustomCommandColumn(this, column)) {
if (gridCoreUtils.isCustomCommandColumn(this._columns, column)) {
return `type:${column.type}`;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ export const getRowCount = function (that: ColumnsController) {
export const getFixedPosition = function (that: ColumnsController, column) {
const rtlEnabled = that.option('rtlEnabled');

if (column.command && !gridCoreUtils.isCustomCommandColumn(that, column) || !column.fixedPosition) {
if (column.command && !gridCoreUtils.isCustomCommandColumn(that._columns, column) || !column.fixedPosition) {
return rtlEnabled ? 'right' : 'left';
}

Expand Down

0 comments on commit ab1f9c4

Please sign in to comment.