Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
105 changes: 105 additions & 0 deletions apps/demos/Demos/Scheduler/ToolbarCustomization/jQuery/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
const data = [
{
text: 'Website Re-Design Plan',
assigneeId: [4],
startDate: new Date('2021-04-26T16:30:00.000Z'),
endDate: new Date('2021-04-26T18:30:00.000Z'),
}, {
text: 'Book Flights to San Fran for Sales Trip',
assigneeId: [2],
startDate: new Date('2021-04-26T19:00:00.000Z'),
endDate: new Date('2021-04-26T20:00:00.000Z'),
allDay: true,
}, {
text: 'Install New Router in Dev Room',
assigneeId: [1],
startDate: new Date('2021-04-26T21:30:00.000Z'),
endDate: new Date('2021-04-26T22:30:00.000Z'),
}, {
text: 'Approve Personal Computer Upgrade Plan',
assigneeId: [3],
startDate: new Date('2021-04-27T17:00:00.000Z'),
endDate: new Date('2021-04-27T18:00:00.000Z'),
}, {
text: 'Final Budget Review',
assigneeId: [1],
startDate: new Date('2021-04-27T19:00:00.000Z'),
endDate: new Date('2021-04-27T20:35:00.000Z'),
}, {
text: 'New Brochures',
assigneeId: [4],
startDate: new Date('2021-04-27T21:30:00.000Z'),
endDate: new Date('2021-04-27T22:45:00.000Z'),
}, {
text: 'Install New Database',
assigneeId: [2],
startDate: new Date('2021-04-28T16:45:00.000Z'),
endDate: new Date('2021-04-28T18:15:00.000Z'),
}, {
text: 'Approve New Online Marketing Strategy',
assigneeId: [4],
startDate: new Date('2021-04-28T19:00:00.000Z'),
endDate: new Date('2021-04-28T21:00:00.000Z'),
}, {
text: 'Upgrade Personal Computers',
assigneeId: [2],
startDate: new Date('2021-04-28T22:15:00.000Z'),
endDate: new Date('2021-04-28T23:30:00.000Z'),
}, {
text: 'Customer Workshop',
assigneeId: [3],
startDate: new Date('2021-04-29T18:00:00.000Z'),
endDate: new Date('2021-04-29T19:00:00.000Z'),
allDay: true,
}, {
text: 'Prepare 2021 Marketing Plan',
assigneeId: [1],
startDate: new Date('2021-04-29T18:00:00.000Z'),
endDate: new Date('2021-04-29T20:30:00.000Z'),
}, {
text: 'Brochure Design Review',
assigneeId: [4],
startDate: new Date('2021-04-29T21:00:00.000Z'),
endDate: new Date('2021-04-29T22:30:00.000Z'),
}, {
text: 'Create Icons for Website',
assigneeId: [3],
startDate: new Date('2021-04-30T17:00:00.000Z'),
endDate: new Date('2021-04-30T18:30:00.000Z'),
}, {
text: 'Upgrade Server Hardware',
assigneeId: [4],
startDate: new Date('2021-04-30T21:30:00.000Z'),
endDate: new Date('2021-04-30T23:00:00.000Z'),
}, {
text: 'Submit New Website Design',
assigneeId: [1],
startDate: new Date('2021-04-30T23:30:00.000Z'),
endDate: new Date('2021-05-01T01:00:00.000Z'),
}, {
text: 'Launch New Website',
assigneeId: [2],
startDate: new Date('2021-04-30T19:20:00.000Z'),
endDate: new Date('2021-04-30T21:00:00.000Z'),
},
];

const assignees = [
{
text: 'Samantha Bright',
id: 1,
color: '#727bd2',
}, {
text: 'John Heart',
id: 2,
color: '#32c9ed',
}, {
text: 'Todd Hoffman',
id: 3,
color: '#2a7ee4',
}, {
text: 'Sandra Johnson',
id: 4,
color: '#7b49d3',
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<script src="../../../../node_modules/jquery/dist/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../../../../node_modules/devextreme-dist/css/dx.light.css" />
<script src="../../../../node_modules/devextreme-dist/js/dx.all.js"></script>
<script src="data.js"></script>
<script src="index.js"></script>
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="scheduler"></div>
</div>
</body>
</html>
79 changes: 79 additions & 0 deletions apps/demos/Demos/Scheduler/ToolbarCustomization/jQuery/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
$(() => {
const scheduler = $('#scheduler').dxScheduler({
timeZone: 'America/Los_Angeles',
dataSource: data,
views: ['day', 'week', 'workWeek', 'month'],
currentView: 'workWeek',
currentDate: new Date(2021, 3, 27),
startDayHour: 9,
endDayHour: 19,
resources: [{
fieldExpr: 'assigneeId',
allowMultiple: true,
dataSource: assignees,
label: 'Assignee',
}],
toolbar: {
items: [
{
location: 'before',
locateInMenu: 'auto',
widget: 'dxButton',
options: {
text: 'Today',
onClick() {
scheduler.option('currentDate', new Date());
},
},
},
'dateNavigator',
{
location: 'before',
locateInMenu: 'auto',
widget: 'dxButton',
options: {
icon: 'plus',
text: 'New Event',
onClick() {
scheduler.showAppointmentPopup({
startDate: new Date().setUTCHours(17, 0, 0, 0),
endDate: new Date().setUTCHours(17, 30, 0, 0),
}, true);
},
},
},
{
location: 'center',
locateInMenu: 'auto',
widget: 'dxTagBox',
options: {
items: assignees,
displayExpr: 'text',
valueExpr: 'id',
searchEnabled: true,
showSelectionControls: true,
maxDisplayedTags: 1,
inputAttr: {
'aria-label': 'Assignees',
},
width: 200,
onValueChanged({ value }) {
scheduler.option(
'dataSource',
value.length
? data.filter((item) => value.some((id) => item.assigneeId.includes(id)))
: data
);
},
},
},
{
location: 'after',
locateInMenu: 'auto',
name: 'viewSwitcher',
}
]
},
height: 600,
}).dxScheduler('instance');
});
12 changes: 12 additions & 0 deletions apps/demos/menuMeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,18 @@
"/Models/SampleData/RecurringAppointmentsResources.cs"
],
"DemoType": "Web"
},
{
"Title": "Toolbar Customization",
"Name": "ToolbarCustomization",
"Widget": "Scheduler",
"MvcAdditionalFiles": [
"/Models/AppointmentWithResources.cs",
"/Models/AssigneeResource.cs",
"/Models/SampleData/AppointmentsWithResources.cs",
"/Models/SampleData/AssigneeResources.cs"
],
"DemoType": "Web"
}
]
},
Expand Down
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
import { Selector as $ } from 'testcafe';
import { runManualTest } from '../../../utils/visual-tests/matrix-test-helper';
import { testScreenshot } from '../../../utils/visual-tests/helpers/theme-utils';

const SCREEN_SIZES = {
wide: [900, 600],
medium: [490, 600],
thin: [320, 600],
};

fixture('Scheduler.ToolbarCustomization')
.page('http://localhost:8080/')
.before(async (ctx) => {
ctx.initialWindowSize = SCREEN_SIZES.wide;
});

runManualTest('Scheduler', 'ToolbarCustomization', ['jQuery'], (test) => {
test('ToolbarCustomization', async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const scheduler = $('#scheduler');
const menuButtonSelector = $('.dx-toolbar').find('.dx-toolbar-menu-container').find('.dx-button');

await testScreenshot(t, takeScreenshot, 'scheduler_toolbar_customization_wide.png', scheduler);

await t
.resizeWindow(...SCREEN_SIZES.medium)
.click(menuButtonSelector);

await testScreenshot(t, takeScreenshot, 'scheduler_toolbar_customization_medium.png', scheduler);

await t
.click($('body'), { offsetX: 0, offsetY: 0 }) // close menu by clicking outside
.resizeWindow(...SCREEN_SIZES.thin)
.click(menuButtonSelector); // open menu with additional items and updated dimensions

await testScreenshot(t, takeScreenshot, 'scheduler_toolbar_customization_thin.png', scheduler);

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
});
});
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.
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.
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.
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.
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.
Loading