From 7db1651295e222e24e78073989a1dd6cfa6ab5ce Mon Sep 17 00:00:00 2001 From: EugeniyKiyashko Date: Fri, 27 Dec 2024 18:23:07 +0400 Subject: [PATCH] Splitter - Panes cannot be expanded/collapsed after window resize (T1262088) (#28648) --- .../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 3793a47714c..20c9a39cefd 100644 --- a/packages/devextreme/js/__internal/ui/splitter/utils/layout.ts +++ b/packages/devextreme/js/__internal/ui/splitter/utils/layout.ts @@ -220,8 +220,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 318e1b0dd58..8f1e107d0d2 100644 --- a/packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js +++ b/packages/devextreme/testing/tests/DevExpress.ui.widgets/splitter.tests.js @@ -1307,6 +1307,25 @@ QUnit.module('Pane sizing', moduleConfig, () => { }, resizeObserverTimeout); }); }); + + 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, () => {