@@ -188,6 +188,80 @@ describe('igxOverlay', () => {
188188 UIInteractions . clearOverlay ( ) ;
189189 } ) ;
190190
191+ describe ( 'Pure Unit Test' , ( ) => {
192+ configureTestSuite ( ) ;
193+ const mockElement : any = {
194+ style : { visibility : '' , cursor : '' , transitionDuration : '' } ,
195+ classList : { add : ( ) => { } , remove : ( ) => { } } ,
196+ appendChild : ( ) => { } ,
197+ removeChild : ( ) => { } ,
198+ addEventListener : ( type : string , listener : ( this : HTMLElement , ev : MouseEvent ) => any ) => { } ,
199+ removeEventListener : ( type : string , listener : ( this : HTMLElement , ev : MouseEvent ) => any ) => { } ,
200+ getBoundingClientRect : ( ) => ( { width : 10 , height : 10 } ) ,
201+ insertBefore : ( newChild : HTMLDivElement , refChild : Node ) => { } ,
202+ contains : ( ) => { }
203+ } ;
204+ mockElement . parent = mockElement ;
205+ mockElement . parentElement = mockElement ;
206+ const mockElementRef : any = { nativeElement : mockElement } ;
207+ const mockFactoryResolver : any = {
208+ resolveComponentFactory : ( c : any ) => {
209+ return {
210+ create : ( i : any ) => {
211+ return {
212+ hostView : '' ,
213+ location : mockElementRef ,
214+ changeDetectorRef : { detectChanges : ( ) => { } } ,
215+ destroy : ( ) => { }
216+ } ;
217+ }
218+ } ;
219+ }
220+ } ;
221+ const mockApplicationRef : any = { attachView : ( h : any ) => { } , detachView : ( h : any ) => { } } ;
222+ const mockInjector : any = { } ;
223+ const mockAnimationBuilder : any = { } ;
224+ const mockDocument = {
225+ body : mockElement ,
226+ defaultView : mockElement ,
227+ createElement : ( ) => mockElement ,
228+ appendChild : ( ) => { } ,
229+ addEventListener : ( type : string , listener : ( this : HTMLElement , ev : MouseEvent ) => any ) => { } ,
230+ removeEventListener : ( type : string , listener : ( this : HTMLElement , ev : MouseEvent ) => any ) => { }
231+ } ;
232+ const mockNgZone : any = { } ;
233+ const mockPlatformUtil : any = { isIOS : false } ;
234+
235+ const overlay = new IgxOverlayService (
236+ mockFactoryResolver , mockApplicationRef , mockInjector , mockAnimationBuilder , mockDocument , mockNgZone , mockPlatformUtil ) ;
237+
238+ it ( 'Should set cursor to pointer on iOS' , ( ) => {
239+ mockPlatformUtil . isIOS = true ;
240+ mockDocument . body . style . cursor = 'initialCursorValue' ;
241+
242+ const mockOverlaySettings : OverlaySettings = {
243+ modal : false ,
244+ positionStrategy : new GlobalPositionStrategy ( { openAnimation : null , closeAnimation : null } )
245+ } ;
246+ let id = overlay . attach ( mockElementRef , mockOverlaySettings ) ;
247+
248+ overlay . show ( id ) ;
249+ expect ( mockDocument . body . style . cursor ) . toEqual ( 'pointer' ) ;
250+
251+ overlay . hide ( id ) ;
252+ expect ( mockDocument . body . style . cursor ) . toEqual ( 'initialCursorValue' ) ;
253+
254+ mockPlatformUtil . isIOS = false ;
255+ id = overlay . attach ( mockElementRef , mockOverlaySettings ) ;
256+
257+ overlay . show ( id ) ;
258+ expect ( mockDocument . body . style . cursor ) . toEqual ( 'initialCursorValue' ) ;
259+
260+ overlay . hide ( id ) ;
261+ expect ( mockDocument . body . style . cursor ) . toEqual ( 'initialCursorValue' ) ;
262+ } ) ;
263+ } ) ;
264+
191265 describe ( 'Unit Tests: ' , ( ) => {
192266 configureTestSuite ( ) ;
193267 beforeEach ( async ( ( ) => {
0 commit comments