Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gantt: fix state of 'Show Resources' and 'Show Dependencies' buttons (T1264485) #28904

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/testcafe_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ jobs:
{ componentFolder: "pagination", name: "pagination" },
{ componentFolder: "pagination", name: "pagination - material", theme: 'material.blue.light' },
{ componentFolder: "pagination", name: "pagination - fluent", theme: 'fluent.blue.light' },
{ componentFolder: "gantt", name: "gantt" },
]
runs-on: devextreme-shr2
timeout-minutes: 90
Expand Down
2 changes: 2 additions & 0 deletions e2e/testcafe-devextreme/tests/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
<link rel="dx-theme" data-theme="fluent.saas.light" href="../../../packages/devextreme/artifacts/css/dx.fluent.saas.light.css" data-active="false">
<link rel="dx-theme" data-theme="fluent.saas.dark" href="../../../packages/devextreme/artifacts/css/dx.fluent.saas.dark.css" data-active="false">
<link rel="dx-theme" data-theme="generic.greenmist" href="../../../packages/devextreme/artifacts/css/dx.greenmist.css" data-active="false">
<link rel="stylesheet" href="../../../packages/devextreme/artifacts/css/dx-gantt.min.css" />

<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/jquery.min.js"></script>
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx-quill.min.js"></script>
<script type="text/javascript" src="../../../packages/devextreme/artifacts//js/dx-gantt.min.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script type="text/javascript" src="../../../packages/devextreme/artifacts//js/dx-gantt.min.js"></script>
<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx-gantt.min.js"></script>

<script type="text/javascript" src="../../../packages/devextreme/artifacts/js/dx.all.js"></script>
<script type="text/javascript" src="https://unpkg.com/devextreme-aspnet-data@2.8.2/js/dx.aspnet.data.js"></script>
<script type="text/javascript" src="../../../node_modules/axe-core/axe.min.js"></script>
Expand Down
159 changes: 159 additions & 0 deletions e2e/testcafe-devextreme/tests/gantt/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/* eslint-disable no-restricted-syntax */
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import Guid from 'devextreme/core/guid';
import { Selector } from 'testcafe';
import { testScreenshot } from '../../helpers/themeUtils';
import url from '../../helpers/getPageUrl';
import { createWidget } from '../../helpers/createWidget';
import { appendElementTo } from '../../helpers/domUtils';

const TOOLBAR_ITEM_BUTTON = '.dx-button';

fixture.disablePageReloads`Gantt`
.page(url(__dirname, '../container.html'));

const data = {
tasks: [{
id: 1,
parentId: 0,
title: 'Software Development',
start: new Date('2019-02-21T05:00:00.000Z'),
end: new Date('2019-07-04T12:00:00.000Z'),
progress: 31,
color: 'red',
}, {
id: 2,
parentId: 1,
title: 'Scope',
start: new Date('2019-02-21T05:00:00.000Z'),
end: new Date('2019-02-26T09:00:00.000Z'),
progress: 60,
}, {
id: 3,
parentId: 2,
title: 'Determine project scope',
start: new Date('2019-02-21T05:00:00.000Z'),
end: new Date('2019-02-21T09:00:00.000Z'),
progress: 100,
}, {
id: 4,
parentId: 2,
title: 'Secure project sponsorship',
start: new Date('2019-02-21T10:00:00.000Z'),
end: new Date('2019-02-22T09:00:00.000Z'),
progress: 100,
}, {
id: 5,
parentId: 2,
title: 'Define preliminary resources',
start: new Date('2019-02-22T10:00:00.000Z'),
end: new Date('2019-02-25T09:00:00.000Z'),
progress: 60,
}, {
id: 6,
parentId: 2,
title: 'Secure core resources',
start: new Date('2019-02-25T10:00:00.000Z'),
end: new Date('2019-02-26T09:00:00.000Z'),
progress: 0,
}, {
id: 7,
parentId: 2,
title: 'Scope complete',
start: new Date('2019-02-26T09:00:00.000Z'),
end: new Date('2019-02-26T09:00:00.000Z'),
progress: 0,
}],

dependencies: [{
id: 0,
predecessorId: 1,
successorId: 2,
type: 0,
}, {
id: 1,
predecessorId: 2,
successorId: 3,
type: 0,
}, {
id: 2,
predecessorId: 3,
successorId: 4,
type: 0,
}, {
id: 3,
predecessorId: 4,
successorId: 5,
type: 0,
}, {
id: 4,
predecessorId: 5,
successorId: 6,
type: 0,
}, {
id: 5,
predecessorId: 6,
successorId: 7,
type: 0,
}],

resources: [{
id: 1, text: 'Management',
}, {
id: 2, text: 'Project Manager',
}, {
id: 3, text: 'Deployment Team',
}],

resourceAssignments: [{
id: 0, taskId: 3, resourceId: 1,
}, {
id: 1, taskId: 4, resourceId: 1,
}, {
id: 2, taskId: 5, resourceId: 2,
}, {
id: 3, taskId: 6, resourceId: 2,
}, {
id: 4, taskId: 6, resourceId: 3,
}],
};

test('Gantt - show resources button should not have focus state (T1264485)', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
await t
.click(Selector(TOOLBAR_ITEM_BUTTON));
await testScreenshot(t, takeScreenshot, 'Gantt show resourced.png', { element: '#container' });
await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => {
const id = `${new Guid()}`;
await appendElementTo('#container', 'div', id, {});
await createWidget('dxGantt', {
tasks: { dataSource: data.tasks },
toolbar: { items: ['showResources'] },
dependencies: { dataSource: data.dependencies },
resources: { dataSource: data.resources },
resourceAssignments: { dataSource: data.resourceAssignments },
}, `#${id}`);
});

test('Gantt - show dependencies button should not have focus state (T1264485)', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
await t
.click(Selector(TOOLBAR_ITEM_BUTTON));
await testScreenshot(t, takeScreenshot, 'Gantt show dependencies.png', { element: '#container' });
await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => {
const id = `${new Guid()}`;
await appendElementTo('#container', 'div', id, {});
await createWidget('dxGantt', {
tasks: { dataSource: data.tasks },
toolbar: { items: ['showDependencies'] },
dependencies: { dataSource: data.dependencies },
resources: { dataSource: data.resources },
resourceAssignments: { dataSource: data.resourceAssignments },
}, `#${id}`);
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 1 addition & 14 deletions packages/devextreme/js/ui/gantt/ui.gantt.bars.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,25 +144,12 @@ export class GanttToolbar extends Bar {
onItemClick: (e) => {
const commandId = e.itemData.commandId;
if(commandId !== undefined) {
this._executeCommand(e.itemData.commandId);
this._owner._executeCoreCommand(commandId);
}
}
});
}

_executeCommand(commandId) {
switch(commandId) {
case COMMANDS.toggleResources:
this._owner.option('showResources', !this._owner.option('showResources'));
break;
case COMMANDS.toggleDependencies:
this._owner.option('showDependencies', !this._owner.option('showDependencies'));
break;
default:
this._owner._executeCoreCommand(commandId);
}
}

_createDefaultItem(commandId, hint, icon) {
return {
commandId: commandId,
Expand Down
7 changes: 7 additions & 0 deletions packages/testcafe-models/gantt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { WidgetName } from './types';
import Widget from './internal/widget';

export default class Gantt extends Widget {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this class is not used. Let's delete it

// eslint-disable-next-line class-methods-use-this
getName(): WidgetName { return 'dxGantt'; }
}
3 changes: 2 additions & 1 deletion packages/testcafe-models/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export type WidgetName =
| 'dxTreeList'
| 'dxTreeView'
| 'dxValidationSummary'
| 'dxValidator';
| 'dxValidator'
| 'dxGantt';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add gantt to WidgetOptions below


export interface WidgetOptions {
dxDataGrid: DataGridProperties;
Expand Down
Loading