Skip to content

Commit d33039b

Browse files
authored
Popup: animation position.of should be 'window' when fullScreen is enabled even if popup position.of is specified (T1292814) (DevExpress#29946)
1 parent 0f0ab74 commit d33039b

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

packages/devextreme/js/__internal/ui/popup/m_popup_position_controller.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ class PopupPositionController extends OverlayPositionController {
9999
}
100100
}
101101

102+
_normalizePosition(positionProp) {
103+
const normalizedPosition = super._normalizePosition(positionProp);
104+
105+
if (this._props.fullScreen) {
106+
normalizedPosition.of = 'window';
107+
}
108+
109+
return normalizedPosition;
110+
}
111+
102112
_updateDragResizeContainer(): void {
103113
this._$dragResizeContainer = this._getDragResizeContainer();
104114
}

packages/devextreme/testing/tests/DevExpress.ui.widgets/popup.tests.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3276,3 +3276,88 @@ QUnit.module('positioning', {
32763276
});
32773277
});
32783278
});
3279+
3280+
QUnit.module('animation', {
3281+
beforeEach: function() {
3282+
this.animateStub = sinon.stub(fx, 'animate');
3283+
this.positionOf = 'container';
3284+
this.popup = $('#popup').dxPopup({
3285+
animation: {
3286+
show: {
3287+
type: 'slide',
3288+
duration: 0,
3289+
from: {
3290+
position: {
3291+
my: 'top',
3292+
at: 'bottom',
3293+
},
3294+
},
3295+
to: {
3296+
position: {
3297+
my: 'center',
3298+
at: 'center',
3299+
},
3300+
},
3301+
},
3302+
hide: {
3303+
type: 'slide',
3304+
duration: 0,
3305+
from: {
3306+
opacity: 1,
3307+
position: {
3308+
my: 'center',
3309+
at: 'center',
3310+
},
3311+
},
3312+
to: {
3313+
opacity: 1,
3314+
position: {
3315+
my: 'top',
3316+
at: 'bottom',
3317+
},
3318+
},
3319+
}
3320+
},
3321+
position: {
3322+
of: this.positionOf
3323+
},
3324+
fullScreen: true,
3325+
}).dxPopup('instance');
3326+
},
3327+
afterEach: function() {
3328+
this.animateStub.restore();
3329+
}
3330+
}, () => {
3331+
QUnit.test('animation.show.to should have position.of=window if fullScreen=true even if popup position.of is set', function(assert) {
3332+
this.popup.show();
3333+
3334+
const showAnimationConfig = this.animateStub.getCall(0).args[1];
3335+
assert.strictEqual(showAnimationConfig.to.position.of, 'window', 'animation is relative to window');
3336+
});
3337+
3338+
QUnit.test('animation.show.to should have position.of equal to popup position.of after fullScreen runtime disable', function(assert) {
3339+
this.popup.option('fullScreen', false);
3340+
this.popup.show();
3341+
3342+
const showAnimationConfig = this.animateStub.getCall(0).args[1];
3343+
assert.strictEqual(showAnimationConfig.to.position.of, this.positionOf, 'animation is relative to position.of');
3344+
});
3345+
3346+
QUnit.test('animation.hide.from should have position.of=window if fullScreen=true even if popup position.of is set', function(assert) {
3347+
this.popup.show();
3348+
this.popup.hide();
3349+
3350+
const hideAnimationConfig = this.animateStub.getCall(1).args[1];
3351+
assert.strictEqual(hideAnimationConfig.from.position.of, 'window', 'animation is relative to window');
3352+
});
3353+
3354+
QUnit.test('animation.hide.from should have position.of equal to popup position.of after fullScreen runtime disable', function(assert) {
3355+
this.popup.option('fullScreen', false);
3356+
3357+
this.popup.show();
3358+
this.popup.hide();
3359+
3360+
const hideAnimationConfig = this.animateStub.getCall(1).args[1];
3361+
assert.strictEqual(hideAnimationConfig.from.position.of, this.positionOf, 'animation is relative to position.of');
3362+
});
3363+
});

0 commit comments

Comments
 (0)