Skip to content

Commit 5382c5a

Browse files
authored
Gantt: fix state of 'Show Resources' and 'Show Dependencies' buttons (T1264485) (#28892)
1 parent 90a235e commit 5382c5a

File tree

7 files changed

+167
-15
lines changed

7 files changed

+167
-15
lines changed

.github/workflows/testcafe_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ jobs:
149149
{ componentFolder: "pagination", name: "pagination" },
150150
{ componentFolder: "pagination", name: "pagination - material", theme: 'material.blue.light' },
151151
{ componentFolder: "pagination", name: "pagination - fluent", theme: 'fluent.blue.light' },
152+
{ componentFolder: "gantt", name: "gantt" },
152153
]
153154
runs-on: devextreme-shr2
154155
timeout-minutes: 90

e2e/testcafe-devextreme/tests/container.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
<link rel="dx-theme" data-theme="fluent.saas.light" href="../../../packages/devextreme/artifacts/css/dx.fluent.saas.light.css" data-active="false">
1717
<link rel="dx-theme" data-theme="fluent.saas.dark" href="../../../packages/devextreme/artifacts/css/dx.fluent.saas.dark.css" data-active="false">
1818
<link rel="dx-theme" data-theme="generic.greenmist" href="../../../packages/devextreme/artifacts/css/dx.greenmist.css" data-active="false">
19+
<link rel="stylesheet" href="../../../packages/devextreme/artifacts/css/dx-gantt.min.css" />
1920

2021
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/jquery.min.js"></script>
2122
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx-quill.min.js"></script>
23+
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx-gantt.min.js"></script>
2224
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx.all.js"></script>
2325
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx.aspnet.data.js"></script>
2426
<script type="text/javascript" src="../../../node_modules/axe-core/axe.min.js"></script>
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/* eslint-disable no-restricted-syntax */
2+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
3+
import Guid from 'devextreme/core/guid';
4+
import { Selector } from 'testcafe';
5+
import { testScreenshot } from '../../helpers/themeUtils';
6+
import url from '../../helpers/getPageUrl';
7+
import { createWidget } from '../../helpers/createWidget';
8+
import { appendElementTo } from '../../helpers/domUtils';
9+
10+
const TOOLBAR_ITEM_BUTTON = '.dx-button';
11+
12+
fixture.disablePageReloads`Gantt`
13+
.page(url(__dirname, '../container.html'));
14+
15+
const data = {
16+
tasks: [{
17+
id: 1,
18+
parentId: 0,
19+
title: 'Software Development',
20+
start: new Date('2019-02-21T05:00:00.000Z'),
21+
end: new Date('2019-07-04T12:00:00.000Z'),
22+
progress: 31,
23+
color: 'red',
24+
}, {
25+
id: 2,
26+
parentId: 1,
27+
title: 'Scope',
28+
start: new Date('2019-02-21T05:00:00.000Z'),
29+
end: new Date('2019-02-26T09:00:00.000Z'),
30+
progress: 60,
31+
}, {
32+
id: 3,
33+
parentId: 2,
34+
title: 'Determine project scope',
35+
start: new Date('2019-02-21T05:00:00.000Z'),
36+
end: new Date('2019-02-21T09:00:00.000Z'),
37+
progress: 100,
38+
}, {
39+
id: 4,
40+
parentId: 2,
41+
title: 'Secure project sponsorship',
42+
start: new Date('2019-02-21T10:00:00.000Z'),
43+
end: new Date('2019-02-22T09:00:00.000Z'),
44+
progress: 100,
45+
}, {
46+
id: 5,
47+
parentId: 2,
48+
title: 'Define preliminary resources',
49+
start: new Date('2019-02-22T10:00:00.000Z'),
50+
end: new Date('2019-02-25T09:00:00.000Z'),
51+
progress: 60,
52+
}, {
53+
id: 6,
54+
parentId: 2,
55+
title: 'Secure core resources',
56+
start: new Date('2019-02-25T10:00:00.000Z'),
57+
end: new Date('2019-02-26T09:00:00.000Z'),
58+
progress: 0,
59+
}, {
60+
id: 7,
61+
parentId: 2,
62+
title: 'Scope complete',
63+
start: new Date('2019-02-26T09:00:00.000Z'),
64+
end: new Date('2019-02-26T09:00:00.000Z'),
65+
progress: 0,
66+
}],
67+
68+
dependencies: [{
69+
id: 0,
70+
predecessorId: 1,
71+
successorId: 2,
72+
type: 0,
73+
}, {
74+
id: 1,
75+
predecessorId: 2,
76+
successorId: 3,
77+
type: 0,
78+
}, {
79+
id: 2,
80+
predecessorId: 3,
81+
successorId: 4,
82+
type: 0,
83+
}, {
84+
id: 3,
85+
predecessorId: 4,
86+
successorId: 5,
87+
type: 0,
88+
}, {
89+
id: 4,
90+
predecessorId: 5,
91+
successorId: 6,
92+
type: 0,
93+
}, {
94+
id: 5,
95+
predecessorId: 6,
96+
successorId: 7,
97+
type: 0,
98+
}],
99+
100+
resources: [{
101+
id: 1, text: 'Management',
102+
}, {
103+
id: 2, text: 'Project Manager',
104+
}, {
105+
id: 3, text: 'Deployment Team',
106+
}],
107+
108+
resourceAssignments: [{
109+
id: 0, taskId: 3, resourceId: 1,
110+
}, {
111+
id: 1, taskId: 4, resourceId: 1,
112+
}, {
113+
id: 2, taskId: 5, resourceId: 2,
114+
}, {
115+
id: 3, taskId: 6, resourceId: 2,
116+
}, {
117+
id: 4, taskId: 6, resourceId: 3,
118+
}],
119+
};
120+
121+
test('Gantt - show resources button should not have focus state (T1264485)', async (t) => {
122+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
123+
await t
124+
.click(Selector(TOOLBAR_ITEM_BUTTON));
125+
await testScreenshot(t, takeScreenshot, 'Gantt show resourced.png', { element: '#container' });
126+
await t
127+
.expect(compareResults.isValid())
128+
.ok(compareResults.errorMessages());
129+
}).before(async () => {
130+
const id = `${new Guid()}`;
131+
await appendElementTo('#container', 'div', id, {});
132+
await createWidget('dxGantt', {
133+
tasks: { dataSource: data.tasks },
134+
toolbar: { items: ['showResources'] },
135+
dependencies: { dataSource: data.dependencies },
136+
resources: { dataSource: data.resources },
137+
resourceAssignments: { dataSource: data.resourceAssignments },
138+
}, `#${id}`);
139+
});
140+
141+
test('Gantt - show dependencies button should not have focus state (T1264485)', async (t) => {
142+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
143+
await t
144+
.click(Selector(TOOLBAR_ITEM_BUTTON));
145+
await testScreenshot(t, takeScreenshot, 'Gantt show dependencies.png', { element: '#container' });
146+
await t
147+
.expect(compareResults.isValid())
148+
.ok(compareResults.errorMessages());
149+
}).before(async () => {
150+
const id = `${new Guid()}`;
151+
await appendElementTo('#container', 'div', id, {});
152+
await createWidget('dxGantt', {
153+
tasks: { dataSource: data.tasks },
154+
toolbar: { items: ['showDependencies'] },
155+
dependencies: { dataSource: data.dependencies },
156+
resources: { dataSource: data.resources },
157+
resourceAssignments: { dataSource: data.resourceAssignments },
158+
}, `#${id}`);
159+
});
41.2 KB
Loading
32.2 KB
Loading

packages/devextreme/js/ui/gantt/ui.gantt.bars.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,12 @@ export class GanttToolbar extends Bar {
144144
onItemClick: (e) => {
145145
const commandId = e.itemData.commandId;
146146
if(commandId !== undefined) {
147-
this._executeCommand(e.itemData.commandId);
147+
this._owner._executeCoreCommand(commandId);
148148
}
149149
}
150150
});
151151
}
152152

153-
_executeCommand(commandId) {
154-
switch(commandId) {
155-
case COMMANDS.toggleResources:
156-
this._owner.option('showResources', !this._owner.option('showResources'));
157-
break;
158-
case COMMANDS.toggleDependencies:
159-
this._owner.option('showDependencies', !this._owner.option('showDependencies'));
160-
break;
161-
default:
162-
this._owner._executeCoreCommand(commandId);
163-
}
164-
}
165-
166153
_createDefaultItem(commandId, hint, icon) {
167154
return {
168155
commandId: commandId,

packages/testcafe-models/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Properties as DataGridProperties } from 'devextreme/ui/data_grid';
22
import type { Properties as FilterBuilderProperties } from 'devextreme/ui/filter_builder';
3+
import type { Properties as GanttProperties } from 'devextreme/ui/gantt';
34

45
export type WidgetName =
56
'dxAccordion'
@@ -66,10 +67,12 @@ export type WidgetName =
6667
| 'dxTreeList'
6768
| 'dxTreeView'
6869
| 'dxValidationSummary'
69-
| 'dxValidator';
70+
| 'dxValidator'
71+
| 'dxGantt';
7072

7173
export interface WidgetOptions {
7274
dxDataGrid: DataGridProperties;
7375
dxFilterBuilder: FilterBuilderProperties;
76+
dxGantt: GanttProperties;
7477
// TODO: write other widgets
7578
}

0 commit comments

Comments
 (0)