Skip to content

Commit 6558439

Browse files
committed
Formatting
1 parent 3eb667b commit 6558439

File tree

6 files changed

+49
-14
lines changed

6 files changed

+49
-14
lines changed

packages-exp/auth-exp/src/platform_browser/auth_window.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
import { Recaptcha } from './recaptcha/recaptcha';
1919

20-
/**
21-
* A specialized window type that melds the normal window type plus the
20+
/**
21+
* A specialized window type that melds the normal window type plus the
2222
* various bits we need. The three different blocks that are &'d together
2323
* cant be defined in the same block together.
2424
*/
@@ -31,7 +31,7 @@ export type AuthWindow = {
3131
} & {
3232
// A final catch-all for callbacks (which will have random names) that
3333
// we will stick on the window.
34-
[callback: string]: ((...args: unknown[]) => void);
34+
[callback: string]: (...args: unknown[]) => void;
3535
};
3636

37-
export const AUTH_WINDOW = window as unknown as AuthWindow;
37+
export const AUTH_WINDOW = (window as unknown) as AuthWindow;

packages-exp/auth-exp/src/platform_browser/recaptcha/recaptcha_loader.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import { Auth } from '../../model/auth';
2828
import { AUTH_WINDOW } from '../auth_window';
2929
import * as jsHelpers from '../load_js';
3030
import {
31-
_JSLOAD_CALLBACK, MOCK_RECAPTCHA_LOADER, ReCaptchaLoader, ReCaptchaLoaderImpl
31+
_JSLOAD_CALLBACK,
32+
MOCK_RECAPTCHA_LOADER,
33+
ReCaptchaLoader,
34+
ReCaptchaLoaderImpl
3235
} from './recaptcha_loader';
3336
import { MockReCaptcha } from './recaptcha_mock';
3437

@@ -103,7 +106,9 @@ describe('platform-browser/recaptcha/recaptcha_loader', () => {
103106
// eslint-disable-next-line @typescript-eslint/no-floating-promises
104107
loader.load(auth);
105108
spoofJsLoad();
106-
expect(AUTH_WINDOW.clearTimeout).to.have.been.calledWith(networkTimeoutId);
109+
expect(AUTH_WINDOW.clearTimeout).to.have.been.calledWith(
110+
networkTimeoutId
111+
);
107112
});
108113

109114
it('rejects if the grecaptcha object is not on the window', async () => {

packages-exp/auth-exp/src/platform_browser/recaptcha/recaptcha_loader.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ export class ReCaptchaLoaderImpl implements ReCaptchaLoader {
116116
// that are already in the page
117117
return (
118118
!!AUTH_WINDOW.grecaptcha &&
119-
(hl === this.hostLanguage || this.counter > 0 || this.librarySeparatelyLoaded)
119+
(hl === this.hostLanguage ||
120+
this.counter > 0 ||
121+
this.librarySeparatelyLoaded)
120122
);
121123
}
122124
}

packages-exp/auth-exp/src/platform_browser/recaptcha/recaptcha_mock.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ import { testAuth } from '../../../test/mock_auth';
2626
import { stubTimeouts, TimerMap } from '../../../test/timeout_stub';
2727
import { Auth } from '../../model/auth';
2828
import {
29-
_EXPIRATION_TIME_MS, _SOLVE_TIME_MS, _WIDGET_ID_START, MockReCaptcha, MockWidget, Widget
29+
_EXPIRATION_TIME_MS,
30+
_SOLVE_TIME_MS,
31+
_WIDGET_ID_START,
32+
MockReCaptcha,
33+
MockWidget,
34+
Widget
3035
} from './recaptcha_mock';
3136

3237
use(sinonChai);
@@ -157,7 +162,7 @@ describe('platform-browser/recaptcha/recaptcha_mock', () => {
157162
'expired-callback': sinon.spy()
158163
};
159164
pendingTimers = stubTimeouts();
160-
timeoutStub = window.setTimeout as unknown as sinon.SinonStub;
165+
timeoutStub = (window.setTimeout as unknown) as sinon.SinonStub;
161166
widget = new MockWidget(container, auth.name, callbacks);
162167
});
163168

packages-exp/auth-exp/src/platform_browser/recaptcha/recaptcha_verifier.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ import { _isHttpOrHttps } from '../../core/util/location';
2525
import { Auth } from '../../model/auth';
2626
import { AUTH_WINDOW } from '../auth_window';
2727
import { Parameters, Recaptcha } from './recaptcha';
28-
import { MOCK_RECAPTCHA_LOADER, RECAPTCHA_LOADER, ReCaptchaLoader } from './recaptcha_loader';
28+
import {
29+
MOCK_RECAPTCHA_LOADER,
30+
RECAPTCHA_LOADER,
31+
ReCaptchaLoader
32+
} from './recaptcha_loader';
2933

3034
const DEFAULT_PARAMS: Parameters = {
3135
theme: 'light',

packages-exp/auth-exp/test/timeout_stub.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
118
import * as sinon from 'sinon';
219

320
interface TimerTripFn {
@@ -15,7 +32,7 @@ export interface TimerMap {
1532
* duration of the timeout
1633
*/
1734
export function stubTimeouts(ids?: number[]): TimerMap {
18-
const callbacks: {[key: number]: TimerTripFn} = {};
35+
const callbacks: { [key: number]: TimerTripFn } = {};
1936
let idCounter = 0;
2037

2138
sinon.stub(window, 'setTimeout').callsFake((cb: () => void, duration) => {
@@ -36,13 +53,15 @@ export function stubTimeouts(ids?: number[]): TimerMap {
3653
* care about
3754
*/
3855
export function stubSingleTimeout(id?: number): TimerTripFn {
39-
const callbacks = stubTimeouts(id ? [id]: undefined);
56+
const callbacks = stubTimeouts(id ? [id] : undefined);
4057
return () => {
4158
const [key, ...rest] = Object.keys(callbacks).map(Number);
4259
if (rest.length) {
43-
throw new Error('stubSingleTimeout should only be used when a single timeout is set');
60+
throw new Error(
61+
'stubSingleTimeout should only be used when a single timeout is set'
62+
);
4463
}
4564

4665
callbacks[key]();
4766
};
48-
}
67+
}

0 commit comments

Comments
 (0)