Skip to content

Commit

Permalink
Scheduler - Resource colors are not updated (T1243679) (#27819)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Barbosa <[email protected]>
  • Loading branch information
tongsonbarbs authored Jul 25, 2024
1 parent 89da05b commit 3285af8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions e2e/testcafe-devextreme/tests/scheduler/workSpace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ClientFunction } from 'testcafe';
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import Button from 'devextreme-testcafe-models/button';
import Scheduler, { CLASS } from 'devextreme-testcafe-models/scheduler';
import { extend } from 'devextreme/core/utils/extend';
import { createWidget } from '../../helpers/createWidget';
Expand Down Expand Up @@ -360,3 +361,43 @@ test('[T716993]: should has horizontal scrollbar with multiple resources and fix
}).after(async () => {
await removeStylesheetRulesFromPage();
});

test('Scheduler appointments should change color on update resources', async (t) => {
const button = new Button('#container');
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);

await t.click(button.element);

await takeScreenshot('scheduler-appointments-should-update-color.png');
await t.expect(compareResults.isValid()).ok(compareResults.errorMessages());
}).before(async () => {
await createWidget('dxScheduler', {
timeZone: 'America/Los_Angeles',
dataSource: [{
text: 'Website Re-Design Plan',
startDate: new Date('2021-03-29T16:30:00.000Z'),
endDate: new Date('2021-03-29T18:30:00.000Z'),
resource: 1,
}],
views: ['week', 'month'],
currentView: 'week',
currentDate: new Date(2021, 2, 28),
startDayHour: 9,
height: 730,
resources: [{
fieldExpr: 'resource',
dataSource: [{ id: 1, text: 'res 1', color: 'red' }],
}],
}, '#otherContainer');
await createWidget('dxButton', {
text: 'Change resources',
onClick() {
const schedulerWidget = ($('#otherContainer') as any).dxScheduler('instance');
schedulerWidget.option('resources', [{
fieldExpr: 'resource',
dataSource: [{ id: 1, text: 'new res 1', color: 'pink' }],
}]);
schedulerWidget.getDataSource().reload();
},
}, '#container');
});
1 change: 1 addition & 0 deletions packages/devextreme/js/__internal/scheduler/m_scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ class Scheduler extends Widget<any> {
this._dataAccessors.resources = createExpressions(this.option('resources'));
this.agendaResourceProcessor.initializeState(this.option('resources'));
this.updateInstances();
this.option('resourceLoaderMap').clear();

this._postponeResourceLoading().done((resources) => {
this._appointments.option('items', []);
Expand Down

0 comments on commit 3285af8

Please sign in to comment.