Skip to content

Conversation

@AlisherAmonulloev
Copy link
Contributor

No description provided.

@AlisherAmonulloev AlisherAmonulloev self-assigned this Jan 26, 2026
@AlisherAmonulloev AlisherAmonulloev requested a review from a team as a code owner January 26, 2026 07:54
Copilot AI review requested due to automatic review settings January 26, 2026 07:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes PivotGrid header depth calculation in scenarios where hideEmptySummaryCells hides an entire column (e.g., when calculateSummaryValue returns null), preventing incorrect header layout/export results after expand/collapse operations.

Changes:

  • Adjusted PivotGrid header depth computation to skip fully empty header items.
  • Added PivotGrid QUnit regression tests covering expand/collapse behavior and export column stability when empty summary cells are hidden.
  • Added ExcelJS exporter regression test verifying export output when hideEmptySummaryCells is enabled and summary values can be null.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
packages/devextreme/js/__internal/grids/pivot_grid/data_controller/m_data_controller.ts Updates header depth calculation to ignore empty header items when computing depth.
packages/devextreme/testing/tests/DevExpress.ui.widgets.pivotGrid/pivotGrid.tests.js Adds UI-level regression tests around expand/collapse sequences and exported column stability with hidden empty cells.
packages/devextreme/testing/tests/DevExpress.exporter/exceljsParts/exceljs.pivotGrid.tests.js Adds exporter regression test to ensure hidden empty columns aren’t exported after expand/collapse.

Copilot AI review requested due to automatic review settings January 31, 2026 10:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

Copilot AI review requested due to automatic review settings January 31, 2026 11:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines +286 to +287
clock.restore();

Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: restoring the Sinon fake timers before exportPivotGrid(...) can leave pending PivotGrid timers to execute on real timers during the export, which is a common source of flaky tests. Align with the established pattern in this file by restoring the clock after the export promise resolves.

Suggested change
clock.restore();

Copilot uses AI. Check for mistakes.
Comment on lines +2452 to +2453
assert.ok(true, `Initial Grand Total width: ${initialGrandTotalWidth}`);
assert.ok(true, `Final Grand Total width: ${finalGrandTotalWidth}`);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two assert.ok(true, ...) calls are effectively no-ops (they always pass) and add noise to the test output. If you want diagnostics, use assert.comment(...) (or remove these lines) and keep assertions focused on verifiable conditions.

Suggested change
assert.ok(true, `Initial Grand Total width: ${initialGrandTotalWidth}`);
assert.ok(true, `Final Grand Total width: ${finalGrandTotalWidth}`);
assert.comment(`Initial Grand Total width: ${initialGrandTotalWidth}`);
assert.comment(`Final Grand Total width: ${finalGrandTotalWidth}`);

Copilot uses AI. Check for mistakes.
Comment on lines +171 to +175
dataSource.collapseHeaderItem('column', [2013]);
clock.tick(10);

clock.restore();

Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test restores fake timers before starting exportPivotGrid(...). In this file, other tests typically keep fake timers active until the export promise resolves (and restore inside the .then) to avoid pending PivotGrid timeouts running on real timers and making the test flaky. Consider moving clock.restore() into the then handler and advancing the clock as needed (similar to the existing pivot.rtlEnabled = true test).

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 31, 2026 18:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines +2455 to +2459
assert.strictEqual(
finalGrandTotalWidth,
initialGrandTotalWidth,
'Grand Total column width should remain the same after collapse sequence'
);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test asserts that the bug is fixed by comparing rendered DOM widths. DOM measurements can be environment-dependent (fonts, rounding, rendering engine) and make the test flaky. Consider asserting the underlying state instead (e.g., header items depth/colspan from the data controller, or the visible columns/header structure) rather than pixel width equality.

Copilot uses AI. Check for mistakes.
this.clock.tick(10);

const initialColumnCount = initialItems[0].length;
assert.ok(true, `Initial export column count: ${initialColumnCount}`);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert.ok(true, ...) always passes and only logs a message. Please remove this debug assertion (or replace with an assertion that can fail).

Suggested change
assert.ok(true, `Initial export column count: ${initialColumnCount}`);

Copilot uses AI. Check for mistakes.
Comment on lines +2608 to +2613
const initialDataProvider = pivotGrid.getDataProvider();
const initialColumnsInfo = $.extend(true, [], pivotGrid._dataController.getColumnsInfo(true));
const initialRowsInfo = $.extend(true, [], pivotGrid._dataController.getRowsInfo(true));
const initialCellsInfo = pivotGrid._dataController.getCellsInfo(true);
const initialItems = pivotGrid._getAllItems(initialColumnsInfo, initialRowsInfo, initialCellsInfo);
initialDataProvider.ready();
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This export-related test relies on internal/private APIs (pivotGrid._dataController and pivotGrid._getAllItems). That makes the test brittle to refactors. If possible, validate via the public export surface (e.g., exporter output / data provider public methods) rather than widget internals.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants