1
+ import Calendar from "../../src/Calendar.js" ;
2
+ import "@ui5/webcomponents-localization/dist/features/calendar/Islamic.js" ;
3
+ import "@ui5/webcomponents-localization/dist/features/calendar/Gregorian.js" ;
4
+ import { resetConfiguration } from "@ui5/webcomponents-base/dist/InitialConfiguration.js" ;
5
+
6
+
7
+ describe ( "Calendar general interaction" , ( ) => {
8
+ before ( ( ) => {
9
+ cy . window ( )
10
+ . then ( $el => {
11
+ const scriptElement = document . createElement ( "script" ) ;
12
+ scriptElement . type = "application/json" ;
13
+ scriptElement . setAttribute ( "data-ui5-config" , "true" ) ;
14
+ scriptElement . innerHTML = JSON . stringify ( {
15
+ "calendarType" : "Islamic" ,
16
+ "secondaryCalendarType" : "Gregorian"
17
+ } ) ;
18
+
19
+ return $el . document . head . append ( scriptElement ) ;
20
+ } )
21
+
22
+ cy . wrap ( { resetConfiguration } )
23
+ . invoke ( "resetConfiguration" , true ) ;
24
+ } ) ;
25
+
26
+ after ( ( ) => {
27
+ cy . window ( )
28
+ . then ( $el => {
29
+ const scriptElement = $el . document . head . querySelector ( "script[data-ui5-config]" ) ;
30
+
31
+ scriptElement ?. remove ( ) ;
32
+ } )
33
+ } )
34
+
35
+ it ( "Calendar type configured" , ( ) => {
36
+ cy . mount ( < Calendar > </ Calendar > ) ;
37
+
38
+ cy . get ( "[ui5-calendar]" )
39
+ . should ( "not.have.prop" , "primaryCalendarType" ) ;
40
+
41
+ cy . get ( "[ui5-calendar]" )
42
+ . should ( "not.have.prop" , "secondaryCalendarType" ) ;
43
+
44
+ cy . get ( "[ui5-calendar]" )
45
+ . should ( "have.prop" , "_primaryCalendarType" , "Islamic" )
46
+
47
+ cy . get ( "[ui5-calendar]" )
48
+ . should ( "have.prop" , "_secondaryCalendarType" , "Gregorian" ) ;
49
+ } ) ;
50
+ } ) ;
0 commit comments