@@ -51,10 +51,10 @@ describe('platform_browser/util/popup', () => {
51
51
52
52
beforeEach ( async ( ) => {
53
53
windowOpenStub = sinon . stub ( window , 'open' ) ;
54
- popupStub = sinon . stub ( ( {
54
+ popupStub = sinon . stub ( {
55
55
focus : ( ) => { } ,
56
56
close : ( ) => { }
57
- } as unknown ) as Window ) ;
57
+ } as unknown as Window ) ;
58
58
windowOpenStub . returns ( popupStub ) ;
59
59
auth = await testAuth ( ) ;
60
60
} ) ;
@@ -105,19 +105,23 @@ describe('platform_browser/util/popup', () => {
105
105
expect ( windowOptions ( ) ) . to . include ( 'scrollbars=yes' ) ;
106
106
} ) ;
107
107
108
+ it ( 'centers the popup in the screen' , ( ) => {
109
+ sinon . stub ( window . screen , 'availHeight' ) . value ( 1000 ) ;
110
+ sinon . stub ( window . screen , 'availWidth' ) . value ( 1000 ) ;
111
+ _open ( auth ) ;
112
+ expect ( windowOptions ( ) ) . to . include ( 'top=200' ) ;
113
+ expect ( windowOptions ( ) ) . to . include ( 'left=250' ) ;
114
+ } ) ;
115
+
108
116
it ( 'errors if the popup is blocked' , ( ) => {
109
117
setUA ( '' ) ;
110
118
windowOpenStub . returns ( undefined ) ;
111
119
expect ( ( ) => _open ( auth ) ) . to . throw ( FirebaseError , 'auth/popup-blocked' ) ;
112
120
} ) ;
113
121
114
122
it ( 'builds the proper options string' , ( ) => {
115
- const screen = window . screen ;
116
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
117
- ( window as any ) . sreen = {
118
- availHeight : 1000 ,
119
- availWidth : 2000
120
- } ;
123
+ sinon . stub ( window . screen , 'availHeight' ) . value ( 1000 ) ;
124
+ sinon . stub ( window . screen , 'availWidth' ) . value ( 2000 ) ;
121
125
122
126
setUA ( '' ) ;
123
127
_open ( auth ) ;
@@ -137,8 +141,8 @@ describe('platform_browser/util/popup', () => {
137
141
toolbar : 'no' ,
138
142
width : '500' ,
139
143
height : '600' ,
140
- top : '0 ' ,
141
- left : '0 '
144
+ top : '200 ' ,
145
+ left : '750 '
142
146
} ) ;
143
147
144
148
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
0 commit comments