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
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ test('Basic drag-n-drop movements from tooltip in month view', async (t) => {
.ok();

await t
.click(scheduler.collectors.find('1').element)
.click(scheduler.collectors.find('1', 1).element)
.expect(scheduler.appointmentTooltip.isVisible()).ok()
.drag(scheduler.appointmentTooltip.getListItem('Appointment 4').element, 320, 150)
.expect(await takeScreenshot('drag-n-drop-\'Appointment 4\'-from-tooltip-in-month.png', scheduler.workSpace))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ fixture.disablePageReloads`Re-render on resize`
.page(url(__dirname, '../../container.html'));

const createScheduler = async (container, options?): Promise<void> => createWidget('dxScheduler', {
...options,
currentDate: new Date(2020, 8, 7),
startDayHour: 8,
endDayHour: 20,
Expand All @@ -27,24 +26,34 @@ const createScheduler = async (container, options?): Promise<void> => createWidg
endDate: new Date(2020, 8, 7, 9),
text: 'test',
}],
...options,
}, container);

safeSizeTest('Appointment should re-rendered on window resize when width and height not set (T1139566)', async (t) => {
safeSizeTest('Appointment should re-rendered on window resize-up (T1139566)', async (t) => {
const scheduler = new Scheduler('#container');
const { element } = scheduler.getAppointment('test');

await setStyleAttribute(element, 'background-color: red;');
await t.resizeWindow(800, 400);
await t.expect(await getStyleAttribute(element)).match(/transform: translate\(0px, 0px\); width: 10\d\.\d\d\dpx; height: 50px;/);
}, [400, 400]).before(async () => createScheduler('#container', { currentView: 'workWeek' }));

safeSizeTest('Appointment should not re-rendered on window resize when width and height not set (T1139566)', async (t) => {
const scheduler = new Scheduler('#container');
const { element } = scheduler.getAppointment('test');

await setStyleAttribute(element, 'background-color: red;');
await t.resizeWindow(300, 300);
await t.expect(await getStyleAttribute(element)).eql('transform: translate(0px, 26px); width: 200px; height: 74px;');
await t.expect(await getStyleAttribute(element)).eql('transform: translate(0px, 26px); width: 200px; height: 74px; background-color: red;');
}).before(async () => createScheduler('#container'));

safeSizeTest('Appointment should re-rendered on window resize when width and height have percent value (T1139566)', async (t) => {
safeSizeTest('Appointment should not re-rendered on window resize when width and height have percent value (T1139566)', async (t) => {
const scheduler = new Scheduler('#container');
const { element } = scheduler.getAppointment('test');

await setStyleAttribute(element, 'background-color: red;');
await t.resizeWindow(300, 400);
await t.expect(await getStyleAttribute(element)).eql('transform: translate(0px, 26px); width: 200px; height: 74px;');
await t.expect(await getStyleAttribute(element)).eql('transform: translate(0px, 26px); width: 200px; height: 74px; background-color: red;');
}).before(async () => createScheduler('#container', { width: '100%', height: '100%' }));

safeSizeTest('Appointment should not re-rendered on window resize when width and height have static value (T1139566)', async (t) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {
describe, expect, it,
} from '@jest/globals';

import { createScheduler } from './__mock__/create_scheduler';
import { setupSchedulerTestEnvironment } from './__mock__/m_mock_scheduler';

describe('Appointments', () => {
it('All-day appointment should not be resizable if current view is "day"', async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you clarify? appointment should not be resizable but in assertion block appointment.classList.contains('dx-resizable') should be resizeble.
Same in test name - Appointment should **not** re-rendered on window resize when width and height have percent value (T1139566) but in the assertion block we are not checking whether it was re-rendered or not. Why was the test renamed this way

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The condition is correct !appointment.classList.contains('dx-resizable'). if appointment resizable it has dx-resizable class. Otherwise no class.

According to Appointment should **not** re-rendered on window resize when width and height have percent value (T1139566). Because new change detection mechanism is better track changes, this cases not trigger rerender anymore. In the ticket user complained to often rerender. S it's become better.

setupSchedulerTestEnvironment();
const { container } = await createScheduler({
dataSource: [{
text: 'Appointment 1',
startDate: new Date(2015, 1, 9, 8),
endDate: new Date(2015, 1, 9, 9),
allDay: true,
}],
currentView: 'day',
currentDate: new Date(2015, 1, 9, 8),
});

const appointment = container.querySelector('.dx-scheduler-appointment');
expect(appointment && !appointment.classList.contains('dx-resizable')).toBe(true);
});
});
Loading
Loading