mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
Upgrade typescript to 5.1 (#7917)
Co-authored-by: Cesar Gonzalez <cgonzalez@bitwarden.com>
This commit is contained in:
parent
e459e30c50
commit
566423925d
@ -15,7 +15,7 @@ class AutofillOverlayIframeService implements AutofillOverlayIframeServiceInterf
|
||||
private iframeMutationObserver: MutationObserver;
|
||||
private iframe: HTMLIFrameElement;
|
||||
private ariaAlertElement: HTMLDivElement;
|
||||
private ariaAlertTimeout: NodeJS.Timeout;
|
||||
private ariaAlertTimeout: number | NodeJS.Timeout;
|
||||
private iframeStyles: Partial<CSSStyleDeclaration> = {
|
||||
all: "initial",
|
||||
position: "fixed",
|
||||
@ -41,7 +41,7 @@ class AutofillOverlayIframeService implements AutofillOverlayIframeServiceInterf
|
||||
};
|
||||
private foreignMutationsCount = 0;
|
||||
private mutationObserverIterations = 0;
|
||||
private mutationObserverIterationsResetTimeout: NodeJS.Timeout;
|
||||
private mutationObserverIterationsResetTimeout: number | NodeJS.Timeout;
|
||||
private readonly windowMessageHandlers: AutofillOverlayIframeWindowMessageHandlers = {
|
||||
updateAutofillOverlayListHeight: (message) =>
|
||||
this.updateElementStyles(this.iframe, message.styles),
|
||||
|
@ -16,6 +16,21 @@ import {
|
||||
import { AutoFillConstants } from "./autofill-constants";
|
||||
import AutofillOverlayContentService from "./autofill-overlay-content.service";
|
||||
|
||||
function createMutationRecordMock(customFields = {}): MutationRecord {
|
||||
return {
|
||||
addedNodes: mock<NodeList>(),
|
||||
attributeName: "default-attributeName",
|
||||
attributeNamespace: "default-attributeNamespace",
|
||||
nextSibling: null,
|
||||
oldValue: "default-oldValue",
|
||||
previousSibling: null,
|
||||
removedNodes: mock<NodeList>(),
|
||||
target: null,
|
||||
type: "attributes",
|
||||
...customFields,
|
||||
};
|
||||
}
|
||||
|
||||
const defaultWindowReadyState = document.readyState;
|
||||
const defaultDocumentVisibilityState = document.visibilityState;
|
||||
describe("AutofillOverlayContentService", () => {
|
||||
@ -1304,9 +1319,7 @@ describe("AutofillOverlayContentService", () => {
|
||||
.mockReturnValue(true);
|
||||
|
||||
autofillOverlayContentService["handleOverlayElementMutationObserverUpdate"]([
|
||||
mock<MutationRecord>({
|
||||
target: usernameField,
|
||||
}),
|
||||
createMutationRecordMock({ target: usernameField }),
|
||||
]);
|
||||
|
||||
expect(usernameField.removeAttribute).not.toHaveBeenCalled();
|
||||
@ -1314,10 +1327,7 @@ describe("AutofillOverlayContentService", () => {
|
||||
|
||||
it("skips handling the mutation if the record type is not for `attributes`", () => {
|
||||
autofillOverlayContentService["handleOverlayElementMutationObserverUpdate"]([
|
||||
mock<MutationRecord>({
|
||||
target: usernameField,
|
||||
type: "childList",
|
||||
}),
|
||||
createMutationRecordMock({ target: usernameField, type: "childList" }),
|
||||
]);
|
||||
|
||||
expect(usernameField.removeAttribute).not.toHaveBeenCalled();
|
||||
@ -1325,7 +1335,7 @@ describe("AutofillOverlayContentService", () => {
|
||||
|
||||
it("removes all element attributes that are not the style attribute", () => {
|
||||
autofillOverlayContentService["handleOverlayElementMutationObserverUpdate"]([
|
||||
mock<MutationRecord>({
|
||||
createMutationRecordMock({
|
||||
target: usernameField,
|
||||
type: "attributes",
|
||||
attributeName: "placeholder",
|
||||
@ -1337,7 +1347,7 @@ describe("AutofillOverlayContentService", () => {
|
||||
|
||||
it("removes all attached style attributes and sets the default styles", () => {
|
||||
autofillOverlayContentService["handleOverlayElementMutationObserverUpdate"]([
|
||||
mock<MutationRecord>({
|
||||
createMutationRecordMock({
|
||||
target: usernameField,
|
||||
type: "attributes",
|
||||
attributeName: "style",
|
||||
|
@ -42,12 +42,12 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
||||
private overlayListElement: HTMLElement;
|
||||
private mostRecentlyFocusedField: ElementWithOpId<FormFieldElement>;
|
||||
private focusedFieldData: FocusedFieldData;
|
||||
private userInteractionEventTimeout: NodeJS.Timeout;
|
||||
private userInteractionEventTimeout: number | NodeJS.Timeout;
|
||||
private overlayElementsMutationObserver: MutationObserver;
|
||||
private bodyElementMutationObserver: MutationObserver;
|
||||
private documentElementMutationObserver: MutationObserver;
|
||||
private mutationObserverIterations = 0;
|
||||
private mutationObserverIterationsResetTimeout: NodeJS.Timeout;
|
||||
private mutationObserverIterationsResetTimeout: number | NodeJS.Timeout;
|
||||
private autofillFieldKeywordsMap: WeakMap<AutofillField, string> = new WeakMap();
|
||||
private eventHandlersMemo: { [key: string]: EventListener } = {};
|
||||
private readonly customElementDefaultStyles: Partial<CSSStyleDeclaration> = {
|
||||
@ -846,7 +846,10 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte
|
||||
|
||||
this.toggleOverlayHidden(true);
|
||||
this.clearUserInteractionEventTimeout();
|
||||
this.userInteractionEventTimeout = setTimeout(this.triggerOverlayRepositionUpdates, 750);
|
||||
this.userInteractionEventTimeout = setTimeout(
|
||||
this.triggerOverlayRepositionUpdates,
|
||||
750,
|
||||
) as unknown as number;
|
||||
};
|
||||
|
||||
/**
|
||||
|
10
package-lock.json
generated
10
package-lock.json
generated
@ -178,7 +178,7 @@
|
||||
"ts-loader": "9.5.1",
|
||||
"tsconfig-paths-webpack-plugin": "4.1.0",
|
||||
"type-fest": "2.19.0",
|
||||
"typescript": "4.9.5",
|
||||
"typescript": "5.1.6",
|
||||
"url": "0.11.3",
|
||||
"util": "0.12.5",
|
||||
"wait-on": "7.2.0",
|
||||
@ -37421,16 +37421,16 @@
|
||||
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
|
||||
"integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/uglify-js": {
|
||||
|
@ -139,7 +139,7 @@
|
||||
"ts-loader": "9.5.1",
|
||||
"tsconfig-paths-webpack-plugin": "4.1.0",
|
||||
"type-fest": "2.19.0",
|
||||
"typescript": "4.9.5",
|
||||
"typescript": "5.1.6",
|
||||
"url": "0.11.3",
|
||||
"util": "0.12.5",
|
||||
"wait-on": "7.2.0",
|
||||
|
@ -34,5 +34,6 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["apps/**/*", "libs/**/*", "bitwarden_license/**/*"]
|
||||
"include": ["apps/**/*", "libs/**/*", "bitwarden_license/**/*"],
|
||||
"exclude": ["**/build"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user