Skip to content

Commit 9db9b67

Browse files
Merge branch '25_1' into 25_1_ng_leak_click
2 parents 3d07c63 + c062914 commit 9db9b67

File tree

105 files changed

+150
-467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+150
-467
lines changed

e2e/testcafe-devextreme/tests/navigation/drawer/common.ts

Lines changed: 94 additions & 435 deletions
Large diffs are not rendered by default.
Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,78 @@
1-
export function createDrawer({
2-
openedStateMode, shading, createOuterContent, createDrawerContent, createInnerContent,
3-
}: { [key: string]: any }): void {
4-
function createDrawerInt($container: any): void {
1+
import { ClientFunction } from 'testcafe';
2+
import { Properties } from 'devextreme/ui/drawer';
3+
4+
interface CreateDrawerConfig {
5+
options?: Properties;
6+
createDrawerContent?: ($drawerContent: JQuery) => void;
7+
createOuterContent?: ($container: JQuery) => void;
8+
testInPopup?: boolean;
9+
}
10+
11+
export const createDrawer = ClientFunction(({
12+
options = {},
13+
createDrawerContent,
14+
createOuterContent,
15+
testInPopup = false,
16+
}: CreateDrawerConfig) => {
17+
const createDrawerInt = ($container: JQuery) => {
518
if (createOuterContent) {
619
createOuterContent($container);
720
}
821

9-
const $drawer = $('<div id=\'drawer1\'>');
10-
const $templateView = $('<div style=\'background-color: aquamarine; height: 100%;\'>').appendTo($drawer);
11-
if (openedStateMode === 'overlap') {
12-
$templateView.css('padding-left', '200px');
13-
}
14-
if (openedStateMode === 'push') {
15-
$templateView.css('padding-right', '200px');
16-
}
22+
const $drawer = $('<div id="drawer">');
23+
const $templateView = $('<div style="background-color: aquamarine; height: 100%;">').appendTo($drawer);
1724

18-
if (createInnerContent) {
19-
createInnerContent($templateView);
20-
}
25+
$('<div id="inner">')
26+
.text('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Penatibus et magnis dis parturient. Eget dolor morbi non arcu risus. Tristique magna sit amet purus gravida quis blandit. Auctor urna nunc id cursus metus aliquam eleifend mi in.')
27+
.appendTo($templateView);
2128

2229
($drawer.appendTo($container) as any).dxDrawer({
23-
openedStateMode,
24-
shading,
2530
opened: true,
31+
shading: true,
2632
height: 400,
2733
template: () => {
28-
const $result = $('<div>').width('200px').css('background-color', 'aqua').css('height', '100%');
34+
const isTopOrBottom = options.position === 'top' || options.position === 'bottom';
35+
const cssSizeProperty = isTopOrBottom ? 'width' : 'height';
36+
37+
const $result = $('<div>')
38+
.css('background-color', 'aqua')
39+
.css(cssSizeProperty, '100%');
40+
41+
if (isTopOrBottom) {
42+
$result.height('100px');
43+
} else {
44+
$result.width('200px');
45+
}
46+
2947
if (createDrawerContent) {
3048
createDrawerContent($result);
49+
} else {
50+
$('<div>').text('Drawer Content').appendTo($result);
3151
}
52+
3253
return $result;
3354
},
55+
...options,
3456
});
35-
}
57+
};
3658

37-
($('<div id="showPopupBtn">').appendTo($('#container')) as any)
38-
.dxButton({
59+
if (testInPopup) {
60+
($('<div id="showPopupBtn">').appendTo($('#container')) as any).dxButton({
3961
text: 'Show Popup',
4062
onClick: () => ($('#popup1') as any).dxPopup('instance').show(),
4163
});
42-
($('<div id=\'popup1\'>').appendTo($('#container')) as any).dxPopup({
43-
position: 'top',
44-
height: 600,
45-
showTitle: false,
46-
contentTemplate: () => {
47-
const $popupTemplate = $('<div id="popup1_template">').css('background-color', 'blanchedalmond').css('height', '100%');
48-
createDrawerInt($popupTemplate);
49-
return $popupTemplate;
50-
},
51-
});
64+
65+
($('<div id="popup1">').appendTo($('#container')) as any).dxPopup({
66+
position: 'top',
67+
height: 600,
68+
showTitle: false,
69+
contentTemplate: () => {
70+
const $popupTemplate = $('<div id="popup1_template">').css('background-color', 'blanchedalmond').css('height', '100%');
71+
createDrawerInt($popupTemplate);
72+
return $popupTemplate;
73+
},
74+
});
75+
}
5276

5377
createDrawerInt($('#container'));
54-
}
78+
});
34.9 KB

0 commit comments

Comments
 (0)