From 94c35a4a9bd4febfe119830727a1ccc1dae73357 Mon Sep 17 00:00:00 2001 From: EugeniyKiyashko Date: Fri, 27 Dec 2024 17:25:01 +0400 Subject: [PATCH] Splitter - Panes cannot be expanded/collapsed after window resize (T1262088) --- .../js/__internal/ui/splitter/utils/layout.ts | 3 +-- .../DevExpress.ui.widgets/splitter.tests.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/devextreme/js/__internal/ui/splitter/utils/layout.ts b/packages/devextreme/js/__internal/ui/splitter/utils/layout.ts index a0d846c8b177..4a50532d8ec4 100644 --- a/packages/devextreme/js/__internal/ui/splitter/utils/layout.ts +++ b/packages/devextreme/js/__internal/ui/splitter/utils/layout.ts @@ -209,8 +209,7 @@ export function getNextLayout( } const totalSize = nextLayout.reduce((total, size) => size + total, 0); - - if (!(compareNumbersWithPrecision(totalSize, 100, 3) === 0)) { + if (!(compareNumbersWithPrecision(totalSize, 100, 2) === 0)) { return currentLayout; } diff --git a/packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js b/packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js index f5903b8cb2af..250f5f5c559f 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js @@ -1285,6 +1285,25 @@ QUnit.module('Pane sizing', moduleConfig, () => { }, 10); }); }); + + QUnit.test('The splitter pane can safely collapse if the total size layout calculation error is less than three decimal places (T1262088)', function(assert) { + this.reinit({ + width: 733.67, + height: 200, + items: [ { collapsible: true }, { collapsible: true }, { collapsible: true }], + }); + + this.assertLayout(['33.3333', '33.3333', '33.3333']); + + this.instance._layout = [33.3338502509, 33.3338502509, 33.3338502509]; + + const $resizeHandle = this.getResizeHandles().first(); + const $collapsePrevButton = this.getCollapsePrevButton($resizeHandle); + + $collapsePrevButton.trigger('dxclick'); + + this.assertLayout(['0', '66.6677', '33.3339']); + }); }); QUnit.module('Resizing', moduleConfig, () => {