@@ -742,7 +742,7 @@ describe("IgxCalendar - ", () => {
742742 // Select 14th
743743 const dateElement = weekDays [ 3 ] . nativeElement . firstChild ;
744744
745- dateElement . dispatchEvent ( new Event ( "mousedown" ) ) ;
745+ dateElement . click ( ) ;
746746 fixture . detectChanges ( ) ;
747747
748748 expect ( calendar . selected . emit ) . toHaveBeenCalled ( ) ;
@@ -770,9 +770,7 @@ describe("IgxCalendar - ", () => {
770770 ) ;
771771 const target = parentDates [ parentDates . length - 1 ] ;
772772
773- target . nativeElement . firstChild . dispatchEvent (
774- new Event ( "mousedown" ) ,
775- ) ;
773+ target . nativeElement . firstChild . click ( ) ;
776774 fixture . detectChanges ( ) ;
777775
778776 expect (
@@ -800,9 +798,7 @@ describe("IgxCalendar - ", () => {
800798 By . css ( HelperTestFunctions . INACTIVE_DAYS_CSSCLASS ) ,
801799 ) [ 0 ] ;
802800
803- target . nativeElement . firstChild . dispatchEvent (
804- new Event ( "mousedown" ) ,
805- ) ;
801+ target . nativeElement . firstChild . click ( ) ;
806802 fixture . detectChanges ( ) ;
807803
808804 expect (
@@ -882,7 +878,7 @@ describe("IgxCalendar - ", () => {
882878 ) . toEqual ( 0 ) ;
883879
884880 for ( const day of weekDays ) {
885- day . nativeElement . firstChild . dispatchEvent ( new Event ( 'mousedown' ) ) ;
881+ day . nativeElement . firstChild . click ( ) ;
886882 fixture . detectChanges ( ) ;
887883 }
888884
@@ -895,7 +891,7 @@ describe("IgxCalendar - ", () => {
895891 } ) ;
896892
897893 // Deselect last day
898- weekDays . at ( - 1 ) . nativeElement . firstChild . dispatchEvent ( new Event ( 'mousedown' ) ) ;
894+ weekDays . at ( - 1 ) . nativeElement . firstChild . click ( ) ;
899895 fixture . detectChanges ( ) ;
900896
901897 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 6 ) ;
@@ -976,7 +972,7 @@ describe("IgxCalendar - ", () => {
976972 const firstDay = new Date ( 2017 , 5 , 11 ) ;
977973
978974 // Start range selection...
979- weekDays [ 0 ] . nativeElement . firstChild . dispatchEvent ( new Event ( 'mousedown' ) ) ;
975+ weekDays [ 0 ] . nativeElement . firstChild . click ( ) ;
980976 fixture . detectChanges ( ) ;
981977
982978 expect (
@@ -991,7 +987,7 @@ describe("IgxCalendar - ", () => {
991987 HelperTestFunctions . verifyDateSelected ( weekDays [ 0 ] ) ;
992988
993989 // ...and cancel it
994- weekDays [ 0 ] . nativeElement . firstChild . dispatchEvent ( new Event ( 'mousedown' ) ) ;
990+ weekDays [ 0 ] . nativeElement . firstChild . click ( ) ;
995991 fixture . detectChanges ( ) ;
996992
997993 expect (
@@ -1001,11 +997,11 @@ describe("IgxCalendar - ", () => {
1001997 HelperTestFunctions . verifyDateNotSelected ( weekDays [ 0 ] ) ;
1002998
1003999 // Start range selection...
1004- weekDays . at ( 0 ) . nativeElement . firstChild . dispatchEvent ( new Event ( 'mousedown' ) ) ;
1000+ weekDays . at ( 0 ) . nativeElement . firstChild . click ( ) ;
10051001 fixture . detectChanges ( ) ;
10061002
10071003 // ...and complete it
1008- weekDays . at ( - 1 ) . nativeElement . firstChild . dispatchEvent ( new Event ( 'mousedown' ) ) ;
1004+ weekDays . at ( - 1 ) . nativeElement . firstChild . click ( ) ;
10091005 fixture . detectChanges ( ) ;
10101006
10111007
@@ -1454,15 +1450,15 @@ describe("IgxCalendar - ", () => {
14541450 ( d ) =>
14551451 getDate ( d ) . getTime ( ) === new Date ( 2017 , 5 , 5 ) . getTime ( ) ,
14561452 ) [ 0 ] ;
1457- UIInteractions . simulateMouseEvent ( 'mousedown' , fromDate . nativeElement . firstChild ) ;
1453+ UIInteractions . simulateClickAndSelectEvent ( fromDate . nativeElement . firstChild ) ;
14581454 fixture . detectChanges ( ) ;
14591455
14601456 const toDate = calendar . daysView . dates . filter (
14611457 ( d ) =>
14621458 getDate ( d ) . getTime ( ) ===
14631459 new Date ( 2017 , 5 , 20 ) . getTime ( ) ,
14641460 ) [ 0 ] ;
1465- UIInteractions . simulateMouseEvent ( 'mousedown' , toDate . nativeElement . firstChild ) ;
1461+ UIInteractions . simulateClickAndSelectEvent ( toDate . nativeElement . firstChild ) ;
14661462 fixture . detectChanges ( ) ;
14671463
14681464 // Check selection
@@ -2147,8 +2143,8 @@ describe("IgxCalendar - ", () => {
21472143 let calendarValue : Date [ ] ;
21482144
21492145 // range selection from June 13th to June 15th
2150- UIInteractions . simulateMouseDownEvent ( june13th . nativeElement . firstChild ) ;
2151- UIInteractions . simulateMouseDownEvent ( june15th . nativeElement . firstChild ) ;
2146+ UIInteractions . simulateClickAndSelectEvent ( june13th . nativeElement . firstChild ) ;
2147+ UIInteractions . simulateClickAndSelectEvent ( june15th . nativeElement . firstChild ) ;
21522148 fixture . detectChanges ( ) ;
21532149
21542150 calendarValue = calendar . value as Date [ ] ;
@@ -2161,7 +2157,7 @@ describe("IgxCalendar - ", () => {
21612157 ) . toMatch ( new Date ( 2017 , 5 , 15 ) . toDateString ( ) ) ;
21622158
21632159 // extend the range to June 17th (June 13th - June 17th)
2164- UIInteractions . simulateMouseDownEvent ( june17th . nativeElement . firstChild , true ) ;
2160+ UIInteractions . simulateClickAndSelectEvent ( june17th . nativeElement . firstChild , true ) ;
21652161 fixture . detectChanges ( ) ;
21662162
21672163 calendarValue = calendar . value as Date [ ] ;
@@ -2171,7 +2167,7 @@ describe("IgxCalendar - ", () => {
21712167 ) . toMatch ( new Date ( 2017 , 5 , 17 ) . toDateString ( ) ) ;
21722168
21732169 // extend the range to June 11th (June 11th - June 17th)
2174- UIInteractions . simulateMouseDownEvent ( june11th . nativeElement . firstChild , true ) ;
2170+ UIInteractions . simulateClickAndSelectEvent ( june11th . nativeElement . firstChild , true ) ;
21752171 fixture . detectChanges ( ) ;
21762172
21772173 calendarValue = calendar . value as Date [ ] ;
@@ -2196,8 +2192,8 @@ describe("IgxCalendar - ", () => {
21962192 let calendarValue : Date [ ] ;
21972193
21982194 // range selection from June 13th to June 17th
2199- UIInteractions . simulateMouseDownEvent ( june13th . nativeElement . firstChild ) ;
2200- UIInteractions . simulateMouseDownEvent ( june17th . nativeElement . firstChild ) ;
2195+ UIInteractions . simulateClickAndSelectEvent ( june13th . nativeElement . firstChild ) ;
2196+ UIInteractions . simulateClickAndSelectEvent ( june17th . nativeElement . firstChild ) ;
22012197 fixture . detectChanges ( ) ;
22022198
22032199 calendarValue = calendar . value as Date [ ] ;
@@ -2210,7 +2206,7 @@ describe("IgxCalendar - ", () => {
22102206 ) . toMatch ( new Date ( 2017 , 5 , 17 ) . toDateString ( ) ) ;
22112207
22122208 // shorten the range to June 15th (June 13th - June 15th)
2213- UIInteractions . simulateMouseDownEvent ( june15th . nativeElement . firstChild , true ) ;
2209+ UIInteractions . simulateClickAndSelectEvent ( june15th . nativeElement . firstChild , true ) ;
22142210 fixture . detectChanges ( ) ;
22152211
22162212 calendarValue = calendar . value as Date [ ] ;
@@ -2220,7 +2216,7 @@ describe("IgxCalendar - ", () => {
22202216 ) . toMatch ( new Date ( 2017 , 5 , 15 ) . toDateString ( ) ) ;
22212217
22222218 // extend the range to June 11th (June 11th - June 15th)
2223- UIInteractions . simulateMouseDownEvent ( june11th . nativeElement . firstChild , true ) ;
2219+ UIInteractions . simulateClickAndSelectEvent ( june11th . nativeElement . firstChild , true ) ;
22242220 fixture . detectChanges ( ) ;
22252221
22262222 calendarValue = calendar . value as Date [ ] ;
@@ -2233,7 +2229,7 @@ describe("IgxCalendar - ", () => {
22332229 ) . toMatch ( new Date ( 2017 , 5 , 15 ) . toDateString ( ) ) ;
22342230
22352231 // shorten the range to June 13th (June 13th - June 15th)
2236- UIInteractions . simulateMouseDownEvent ( june13th . nativeElement . firstChild , true ) ;
2232+ UIInteractions . simulateClickAndSelectEvent ( june13th . nativeElement . firstChild , true ) ;
22372233 fixture . detectChanges ( ) ;
22382234
22392235 calendarValue = calendar . value as Date [ ] ;
@@ -2256,13 +2252,13 @@ describe("IgxCalendar - ", () => {
22562252 const june17th = days [ 16 ] ;
22572253
22582254 // select June 13th and June 15th
2259- UIInteractions . simulateMouseDownEvent ( june13th . nativeElement . firstChild ) ;
2260- UIInteractions . simulateMouseDownEvent ( june15th . nativeElement . firstChild ) ;
2255+ UIInteractions . simulateClickAndSelectEvent ( june13th . nativeElement . firstChild ) ;
2256+ UIInteractions . simulateClickAndSelectEvent ( june15th . nativeElement . firstChild ) ;
22612257 fixture . detectChanges ( ) ;
22622258 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 2 ) ;
22632259
22642260 // select all dates from June 15th to June 17th
2265- UIInteractions . simulateMouseDownEvent ( june17th . nativeElement . firstChild , true ) ;
2261+ UIInteractions . simulateClickAndSelectEvent ( june17th . nativeElement . firstChild , true ) ;
22662262 fixture . detectChanges ( ) ;
22672263 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 4 ) ;
22682264
@@ -2278,7 +2274,7 @@ describe("IgxCalendar - ", () => {
22782274 ) ;
22792275
22802276 // select all dates from June 17th (last selected) to June 11th
2281- UIInteractions . simulateMouseDownEvent ( june11th . nativeElement . firstChild , true ) ;
2277+ UIInteractions . simulateClickAndSelectEvent ( june11th . nativeElement . firstChild , true ) ;
22822278 fixture . detectChanges ( ) ;
22832279 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 7 ) ;
22842280
@@ -2320,17 +2316,17 @@ describe("IgxCalendar - ", () => {
23202316 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 7 ) ;
23212317
23222318 // deselect all dates from June 11th (last clicked) to June 13th
2323- UIInteractions . simulateMouseDownEvent ( june11th . nativeElement . firstChild ) ;
2324- UIInteractions . simulateMouseDownEvent ( june13th . nativeElement . firstChild , true ) ;
2319+ UIInteractions . simulateClickAndSelectEvent ( june11th . nativeElement . firstChild ) ;
2320+ UIInteractions . simulateClickAndSelectEvent ( june13th . nativeElement . firstChild , true ) ;
23252321 fixture . detectChanges ( ) ;
23262322 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 5 ) ;
23272323 expect ( JSON . stringify ( calendar . value as Date [ ] ) ) . toEqual (
23282324 JSON . stringify ( dates . slice ( 2 ) ) ,
23292325 ) ;
23302326
23312327 // deselect all dates from June 17th (last clicked) to June 15th
2332- UIInteractions . simulateMouseDownEvent ( june17th . nativeElement . firstChild ) ;
2333- UIInteractions . simulateMouseDownEvent ( june15th . nativeElement . firstChild , true ) ;
2328+ UIInteractions . simulateClickAndSelectEvent ( june17th . nativeElement . firstChild ) ;
2329+ UIInteractions . simulateClickAndSelectEvent ( june15th . nativeElement . firstChild , true ) ;
23342330 fixture . detectChanges ( ) ;
23352331 expect ( ( calendar . value as Date [ ] ) . length ) . toEqual ( 3 ) ;
23362332 expect ( JSON . stringify ( calendar . value as Date [ ] ) ) . toEqual (
0 commit comments