Skip to content

Commit c404ec8

Browse files
authored
FilterBuilder - The field drop-down window moves with the page scroll (T1273328) (DevExpress#28989)
1 parent 55b37ec commit c404ec8

File tree

7 files changed

+45
-7
lines changed

7 files changed

+45
-7
lines changed
15.8 KB
Loading
19 KB
Loading
13.8 KB
Loading
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import FilterBuilder from 'devextreme-testcafe-models/filterBuilder';
2+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
3+
import url from '../../helpers/getPageUrl';
4+
import { fields, filter } from './data';
5+
import { safeSizeTest } from '../../helpers/safeSizeTest';
6+
import { createWidget } from '../../helpers/createWidget';
7+
import { testScreenshot } from '../../helpers/themeUtils';
8+
import { insertStylesheetRulesToPage } from '../../helpers/domUtils';
9+
10+
fixture`Filter Builder Scrolling Test`.page(
11+
url(__dirname, '../container.html'),
12+
);
13+
14+
// T1273328
15+
safeSizeTest('FilterBuilder - The field drop-down window moves with the page scroll', async (t) => {
16+
const filterBuilder = new FilterBuilder('#container');
17+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
18+
19+
await filterBuilder.isReady();
20+
21+
await t
22+
.click(filterBuilder.getItem('operation'))
23+
.scrollIntoView(filterBuilder.getItem('operation', 4));
24+
25+
await testScreenshot(t, takeScreenshot, 'filterBuilder_scroll_with_popup.png', { element: filterBuilder.element });
26+
await t
27+
.expect(compareResults.isValid())
28+
.ok(compareResults.errorMessages());
29+
}).before(async () => {
30+
await insertStylesheetRulesToPage('#container {height: 150px; overflow: scroll;}');
31+
32+
await createWidget('dxFilterBuilder', {
33+
fields,
34+
value: filter,
35+
});
36+
});

packages/devextreme-scss/scss/widgets/base/filterBuilder/_index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ $filterbuilder-menu-icon-color: null !default;
2525
@use "./common";
2626

2727
.dx-filterbuilder {
28+
position: relative;
2829
background-color: $filterbuilder-bg;
2930

3031
@mixin button-color($color, $hover-color, $focus-color) {

packages/devextreme/js/__internal/filter_builder/m_filter_builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ class FilterBuilder extends Widget<any> {
819819
visible: true,
820820
focusStateEnabled: false,
821821
preventScrollEvents: false,
822-
hideOnParentScroll: this.option('closePopupOnTargetScroll'),
822+
container: $popup,
823823
hideOnOutsideClick: true,
824824
onShown: options.popup.onShown,
825825
shading: false,

packages/devextreme/testing/tests/DevExpress.ui.widgets/filterBuilderParts/commonTests.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ QUnit.module('Rendering', function() {
7575
});
7676

7777
container.find('.' + FILTER_BUILDER_GROUP_OPERATION_CLASS).trigger('dxclick');
78-
const popupInstance = container.find('.' + FILTER_BUILDER_OVERLAY_CLASS).dxPopup('instance');
78+
const popupInstance = container.find(`.${FILTER_BUILDER_OVERLAY_CLASS}.dx-popup`).dxPopup('instance');
7979
assert.ok(popupInstance.option('deferRendering'));
8080
});
8181

@@ -409,7 +409,7 @@ QUnit.module('Rendering', function() {
409409
$('.' + FILTER_BUILDER_GROUP_OPERATION_CLASS).trigger('dxclick');
410410

411411
// assert
412-
assert.notOk($container.find('.' + FILTER_BUILDER_OVERLAY_CLASS).dxPopup('instance').option('target'), 'popup target shoud not be set');
412+
assert.notOk($container.find(`.${FILTER_BUILDER_OVERLAY_CLASS}.dx-popup`).dxPopup('instance').option('target'), 'popup target shoud not be set');
413413
});
414414

415415
QUnit.test('Menu wrapper has filter builder overlay class', function(assert) {
@@ -1299,7 +1299,8 @@ QUnit.module('on value changed', function() {
12991299
});
13001300

13011301
// T824147
1302-
QUnit.test('Add-condition popup should be closed on scroll', function(assert) {
1302+
// T1273328 - new
1303+
QUnit.test('Add-condition popup should not be closed on scroll', function(assert) {
13031304
// arrange
13041305
const container = $('#container');
13051306
const value = [['CompanyName', 'K&S Music']];
@@ -1315,7 +1316,7 @@ QUnit.module('on value changed', function() {
13151316
const popupInstance = container.children('.dx-filterbuilder-overlay').dxPopup('instance');
13161317

13171318
// assert
1318-
assert.equal(popupInstance.option('hideOnParentScroll'), true, 'popup\'s hideOnParentScroll');
1319+
assert.equal(popupInstance.option('hideOnParentScroll'), false, 'popup\'s hideOnParentScroll');
13191320
});
13201321

13211322
// T804262
@@ -1601,7 +1602,7 @@ QUnit.module('Group operations', function() {
16011602
assert.equal(popup.length, 0);
16021603
});
16031604

1604-
QUnit.test('nested level of groups = 1', function(assert) {
1605+
QUnit.test('nested level of groups = 2', function(assert) {
16051606
const container = $('#container');
16061607
container.dxFilterBuilder({
16071608
fields: fields,
@@ -1611,7 +1612,7 @@ QUnit.module('Group operations', function() {
16111612

16121613
$('.' + FILTER_BUILDER_IMAGE_ADD_CLASS).trigger('dxclick');
16131614
let popup = container.find(`.${FILTER_BUILDER_OVERLAY_CLASS}`);
1614-
assert.equal(popup.length, 1);
1615+
assert.equal(popup.length, 2);
16151616

16161617
selectMenuItem(1);
16171618

0 commit comments

Comments
 (0)