@@ -4,24 +4,8 @@ import {
44import $ from '@js/core/renderer' ;
55
66import fx from '../../../common/core/animation/fx' ;
7- import { getBaseAppointmentProperties } from '../__mock__/appointment_properties ' ;
7+ import { createBaseAppointment , getBaseAppointmentViewProperties as getProperties } from '../__mock__/base_appointment_view ' ;
88import { APPOINTMENT_CLASSES , APPOINTMENT_TYPE_CLASSES } from '../const' ;
9- import type { BaseAppointmentViewProperties } from './base_appointment' ;
10- import { BaseAppointmentView } from './base_appointment' ;
11-
12- const createBaseAppointment = async (
13- properties : BaseAppointmentViewProperties ,
14- ) : Promise < BaseAppointmentView > => {
15- const $element = $ ( '.root' ) ;
16-
17- // @ts -expect-error
18- const instance = new BaseAppointmentView ( $element , properties ) ;
19-
20- // Await for resources
21- await new Promise ( process . nextTick ) ;
22-
23- return instance ;
24- } ;
259
2610const defaultAppointmentData = {
2711 title : 'Test appointment' ,
@@ -51,7 +35,7 @@ describe('BaseAppointment', () => {
5135 describe ( 'Classes' , ( ) => {
5236 it ( 'should have container class' , async ( ) => {
5337 const instance = await createBaseAppointment (
54- getBaseAppointmentProperties ( defaultAppointmentData ) ,
38+ getProperties ( defaultAppointmentData ) ,
5539 ) ;
5640
5741 expect ( instance . $element ( ) . hasClass ( APPOINTMENT_CLASSES . CONTAINER ) ) . toBe ( true ) ;
@@ -61,7 +45,7 @@ describe('BaseAppointment', () => {
6145 true , false ,
6246 ] ) ( 'should have correct class for isRecurring = %o' , async ( isRecurring ) => {
6347 const instance = await createBaseAppointment (
64- getBaseAppointmentProperties ( {
48+ getProperties ( {
6549 ...defaultAppointmentData ,
6650 recurrenceRule : isRecurring ? 'FREQ=DAILY;COUNT=5' : undefined ,
6751 } ) ,
@@ -76,7 +60,7 @@ describe('BaseAppointment', () => {
7660 true , false ,
7761 ] ) ( 'should have correct class for allDay = %o' , async ( allDay ) => {
7862 const instance = await createBaseAppointment (
79- getBaseAppointmentProperties ( {
63+ getProperties ( {
8064 ...defaultAppointmentData ,
8165 allDay,
8266 } ) ,
@@ -91,7 +75,7 @@ describe('BaseAppointment', () => {
9175 describe ( 'Aria' , ( ) => {
9276 it ( 'should have role button' , async ( ) => {
9377 const instance = await createBaseAppointment (
94- getBaseAppointmentProperties ( defaultAppointmentData ) ,
78+ getProperties ( defaultAppointmentData ) ,
9579 ) ;
9680
9781 expect ( instance . $element ( ) . attr ( 'role' ) ) . toBe ( 'button' ) ;
0 commit comments