11import Scheduler from 'devextreme-testcafe-models/scheduler' ;
2- import { simpleData , allDayData } from './init/widget.data' ;
3- import createScheduler from './init/widget.setup' ;
42import url from '../../../../helpers/getPageUrl' ;
3+ import { createWidget } from '../../../../helpers/createWidget' ;
54
65fixture . disablePageReloads `Appointment overlapping in Scheduler`
76 . page ( url ( __dirname , '../../../container.html' ) ) ;
87
8+ export const SIMPLE_DATA = [
9+ {
10+ text : 'Appointment 1' ,
11+ startDate : new Date ( 2017 , 4 , 24 , 13 , 0 ) ,
12+ endDate : new Date ( 2017 , 4 , 25 , 12 , 30 ) ,
13+ } ,
14+ {
15+ text : 'Appointment 2' ,
16+ startDate : new Date ( 2017 , 4 , 24 , 15 , 0 ) ,
17+ endDate : new Date ( 2017 , 4 , 24 , 16 , 30 ) ,
18+ } ,
19+ {
20+ text : 'Appointment 3' ,
21+ startDate : new Date ( 2017 , 4 , 25 , 9 , 0 ) ,
22+ endDate : new Date ( 2017 , 4 , 25 , 10 , 30 ) ,
23+ } ,
24+ {
25+ text : 'Appointment 4' ,
26+ startDate : new Date ( 2017 , 4 , 25 , 11 , 0 ) ,
27+ endDate : new Date ( 2017 , 4 , 25 , 12 , 30 ) ,
28+ } ,
29+ {
30+ text : 'Appointment 5' ,
31+ startDate : new Date ( 2017 , 4 , 25 , 11 , 0 ) ,
32+ endDate : new Date ( 2017 , 4 , 25 , 12 , 0 ) ,
33+ allDay : true ,
34+ } ,
35+ ] ;
36+
37+ export const ALL_DAY_DATA = [
38+ {
39+ text : 'Appointment 1' ,
40+ startDate : new Date ( 2017 , 4 , 21 , 9 , 0 ) ,
41+ endDate : new Date ( 2017 , 4 , 24 , 10 , 30 ) ,
42+ allDay : true ,
43+ } ,
44+ {
45+ text : 'Appointment 2' ,
46+ startDate : new Date ( 2017 , 4 , 22 , 11 , 0 ) ,
47+ endDate : new Date ( 2017 , 4 , 22 , 12 , 0 ) ,
48+ allDay : true ,
49+ } ,
50+ {
51+ text : 'Appointment 3' ,
52+ startDate : new Date ( 2017 , 4 , 25 , 9 , 0 ) ,
53+ endDate : new Date ( 2017 , 4 , 25 , 10 , 30 ) ,
54+ } ,
55+ {
56+ text : 'Appointment 4' ,
57+ startDate : new Date ( 2017 , 4 , 25 , 11 , 0 ) ,
58+ endDate : new Date ( 2017 , 4 , 25 , 12 , 0 ) ,
59+ allDay : true ,
60+ } ,
61+ ] ;
62+
63+ const SCHEDULER_DEFAULT_OPTIONS = {
64+ views : [ 'week' ] ,
65+ width : 940 ,
66+ currentView : 'week' ,
67+ currentDate : new Date ( 2017 , 4 , 25 ) ,
68+ startDayHour : 9 ,
69+ height : 900 ,
70+ } ;
71+
972test ( 'Multi-day appointment should not overlap other appointments when specific width is set, \'auto\' mode (T864456)' , async ( t ) => {
1073 const scheduler = new Scheduler ( '#container' ) ;
1174 const appointment = scheduler . getAppointment ( 'Appointment 1' , 1 ) ;
@@ -18,8 +81,9 @@ test('Multi-day appointment should not overlap other appointments when specific
1881
1982 . expect ( parseInt ( await appointment . size . width , 10 ) )
2083 . eql ( 93 ) ;
21- } ) . before ( async ( ) => createScheduler ( {
22- dataSource : simpleData ,
84+ } ) . before ( async ( ) => createWidget ( 'dxScheduler' , {
85+ ...SCHEDULER_DEFAULT_OPTIONS ,
86+ dataSource : SIMPLE_DATA ,
2387} ) ) ;
2488
2589test ( 'Simple appointment should not overlap allDay appointment when specific width is set, \'auto\' mode (T864456)' , async ( t ) => {
@@ -29,8 +93,9 @@ test('Simple appointment should not overlap allDay appointment when specific wid
2993 await t
3094 . expect ( scheduler . collectors . count ) . eql ( 0 )
3195 . expect ( await element . getBoundingClientRectProperty ( 'top' ) ) . eql ( 114 ) ;
32- } ) . before ( async ( ) => createScheduler ( {
33- dataSource : allDayData ,
96+ } ) . before ( async ( ) => createWidget ( 'dxScheduler' , {
97+ ...SCHEDULER_DEFAULT_OPTIONS ,
98+ dataSource : ALL_DAY_DATA ,
3499} ) ) ;
35100
36101test ( 'Crossing allDay appointments should not overlap each other (T893674)' , async ( t ) => {
@@ -40,6 +105,7 @@ test('Crossing allDay appointments should not overlap each other (T893674)', asy
40105
41106 await t
42107 . expect ( await firstAppointment . element . getBoundingClientRectProperty ( 'top' ) ) . notEql ( await secondAppointment . element . getBoundingClientRectProperty ( 'top' ) ) ;
43- } ) . before ( async ( ) => createScheduler ( {
44- dataSource : allDayData ,
108+ } ) . before ( async ( ) => createWidget ( 'dxScheduler' , {
109+ ...SCHEDULER_DEFAULT_OPTIONS ,
110+ dataSource : ALL_DAY_DATA ,
45111} ) ) ;
0 commit comments