mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-16 18:06:17 +02:00
Merge remote-tracking branch 'origin/develop' into hs/refactor-upload-logic
This commit is contained in:
commit
83239b2d36
@ -125,7 +125,8 @@ Please see LICENSE files in the repository root for full details.
|
||||
align-items: center;
|
||||
padding: 4px 4px 4px 0;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
/* Override the unlayered cursor: grab; rule from react-beautiful-dnd */
|
||||
cursor: pointer !important;
|
||||
|
||||
&.mx_SpaceButton_active {
|
||||
&:not(.mx_SpaceButton_narrow) .mx_SpaceButton_selectionWrapper {
|
||||
|
||||
@ -86,7 +86,7 @@ type CompleteOidcLoginResponse = {
|
||||
// refreshToken gained from OIDC token issuer, when falsy token cannot be refreshed
|
||||
refreshToken?: string;
|
||||
// idToken gained from OIDC token issuer
|
||||
idToken: string;
|
||||
idToken?: string;
|
||||
// this client's id as registered with the OIDC issuer
|
||||
clientId: string;
|
||||
// issuer used during authentication
|
||||
|
||||
@ -25,10 +25,16 @@ const idTokenClaimsStorageKey = "mx_oidc_id_token_claims";
|
||||
* @param idToken
|
||||
* @param idTokenClaims
|
||||
*/
|
||||
export const persistOidcAuthenticatedSettings = (clientId: string, issuer: string, idToken: string): void => {
|
||||
export const persistOidcAuthenticatedSettings = (
|
||||
clientId: string,
|
||||
issuer: string,
|
||||
idToken: string | undefined,
|
||||
): void => {
|
||||
localStorage.setItem(clientIdStorageKey, clientId);
|
||||
localStorage.setItem(tokenIssuerStorageKey, issuer);
|
||||
localStorage.setItem(idTokenStorageKey, idToken);
|
||||
if (idToken) {
|
||||
localStorage.setItem(idTokenStorageKey, idToken);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -48,6 +48,13 @@ describe("persist OIDC settings", () => {
|
||||
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_token_issuer", issuer);
|
||||
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_id_token", idToken);
|
||||
});
|
||||
|
||||
it("should not set idToken in localStorage when idToken is undefined", () => {
|
||||
persistOidcAuthenticatedSettings(clientId, issuer, undefined);
|
||||
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_client_id", clientId);
|
||||
expect(localStorage.setItem).toHaveBeenCalledWith("mx_oidc_token_issuer", issuer);
|
||||
expect(localStorage.getItem("mx_oidc_id_token")).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("getStoredOidcTokenIssuer()", () => {
|
||||
|
||||
@ -9,6 +9,13 @@ import { describe, it, expect } from "vitest";
|
||||
|
||||
import { formatSeconds, formatDateForInput } from "./DateUtils";
|
||||
|
||||
function makeDate(year: number, month: number, day: number): Date {
|
||||
const date = new Date(0);
|
||||
date.setFullYear(year, month - 1, day);
|
||||
date.setHours(0, 0, 0, 0);
|
||||
return date;
|
||||
}
|
||||
|
||||
describe("formatSeconds", () => {
|
||||
it("correctly formats time with hours", () => {
|
||||
expect(formatSeconds(60 * 60 * 3 + 60 * 31 + 55)).toBe("03:31:55");
|
||||
@ -26,10 +33,12 @@ describe("formatSeconds", () => {
|
||||
});
|
||||
|
||||
describe("formatDateForInput", () => {
|
||||
it.each([["1993-11-01"], ["1066-10-14"], ["0571-04-22"], ["0062-02-05"]])(
|
||||
"should format %s",
|
||||
(dateString: string) => {
|
||||
expect(formatDateForInput(new Date(dateString))).toBe(dateString);
|
||||
},
|
||||
);
|
||||
it.each([
|
||||
["1993-11-01", makeDate(1993, 11, 1)],
|
||||
["1066-10-14", makeDate(1066, 10, 14)],
|
||||
["0571-04-22", makeDate(571, 4, 22)],
|
||||
["0062-02-05", makeDate(62, 2, 5)],
|
||||
])("should format %s", (dateString: string, date: Date) => {
|
||||
expect(formatDateForInput(date)).toBe(dateString);
|
||||
});
|
||||
});
|
||||
|
||||
@ -110,6 +110,7 @@ export default mergeConfig(
|
||||
"vite-plugin-node-polyfills/shims/buffer",
|
||||
"vite-plugin-node-polyfills/shims/process",
|
||||
"@vector-im/compound-design-tokens/assets/web/icons",
|
||||
"storybook/preview-api",
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
|
||||
@ -56,6 +56,6 @@ export default defineConfig({
|
||||
reporters,
|
||||
pool: "threads",
|
||||
globals: false,
|
||||
include: ["src/**/*.test.ts"],
|
||||
include: ["src/**/*.test.{ts,tsx}"],
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user