From 79c50db00993a97a0b6b8c3df02b8eec4e6cb21a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 20 Mar 2024 01:34:11 +0200 Subject: [PATCH] Use data-mx-color for rainbows (#12325) * Use data-mx-color for rainbows The font tag may be deprecated soon (https://github.com/matrix-org/matrix-spec/pull/1739) Signed-off-by: Tulir Asokan * Update tests Signed-off-by: Tulir Asokan --------- Signed-off-by: Tulir Asokan --- src/utils/colour.ts | 4 ++-- test/__snapshots__/SlashCommands-test.tsx.snap | 4 ++-- test/utils/colour-test.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/utils/colour.ts b/src/utils/colour.ts index 518b11f835..8262718a39 100644 --- a/src/utils/colour.ts +++ b/src/utils/colour.ts @@ -27,13 +27,13 @@ export function textToHtmlRainbow(str: string): string { const [a, b] = generateAB(i * frequency, 1); const [red, green, blue] = labToRGB(75, a, b); return ( - '' + c + - "" + "" ); }) .join(""); diff --git a/test/__snapshots__/SlashCommands-test.tsx.snap b/test/__snapshots__/SlashCommands-test.tsx.snap index 08d3bdcc47..fdffb74ac3 100644 --- a/test/__snapshots__/SlashCommands-test.tsx.snap +++ b/test/__snapshots__/SlashCommands-test.tsx.snap @@ -18,7 +18,7 @@ exports[`SlashCommands /rainbow should make things rainbowy 1`] = ` { "body": "this is a test message", "format": "org.matrix.custom.html", - "formatted_body": "this is a test message", + "formatted_body": "this is a test message", "msgtype": "m.text", } `; @@ -27,7 +27,7 @@ exports[`SlashCommands /rainbowme should make things rainbowy 1`] = ` { "body": "this is a test message", "format": "org.matrix.custom.html", - "formatted_body": "this is a test message", + "formatted_body": "this is a test message", "msgtype": "m.emote", } `; diff --git a/test/utils/colour-test.ts b/test/utils/colour-test.ts index 02a559447a..2e533d0aa9 100644 --- a/test/utils/colour-test.ts +++ b/test/utils/colour-test.ts @@ -18,7 +18,7 @@ import { textToHtmlRainbow } from "../../src/utils/colour"; describe("textToHtmlRainbow", () => { it("correctly transform text to html without splitting the emoji in two", () => { - expect(textToHtmlRainbow("🐻")).toBe('🐻'); - expect(textToHtmlRainbow("🐕‍🦺")).toBe('🐕‍🦺'); + expect(textToHtmlRainbow("🐻")).toBe('🐻'); + expect(textToHtmlRainbow("🐕‍🦺")).toBe('🐕‍🦺'); }); });