This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch template_less
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/template_less by this push:
new 501874980e fix cypress test
501874980e is described below
commit 501874980eb9fbfa6fc5cebb6fba7d9450dd47cc
Author: Maxime Beauchemin <[email protected]>
AuthorDate: Thu Mar 27 14:26:41 2025 -0700
fix cypress test
---
.../cypress-base/cypress/e2e/dashboard/actions.test.js | 2 +-
.../packages/superset-ui-core/src/theme/Theme.test.tsx | 17 +++++++++++++++++
.../packages/superset-ui-core/src/theme/utils.ts | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git
a/superset-frontend/cypress-base/cypress/e2e/dashboard/actions.test.js
b/superset-frontend/cypress-base/cypress/e2e/dashboard/actions.test.js
index 13c925ede5..307f3ad47b 100644
--- a/superset-frontend/cypress-base/cypress/e2e/dashboard/actions.test.js
+++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/actions.test.js
@@ -46,7 +46,7 @@ describe('Dashboard actions', () => {
// Verify the color of the filled star (gold)
cy.get('@starIconFilled')
.should('have.css', 'color')
- .and('eq', 'rgb(252, 199, 0)');
+ .and('eq', 'rgb(217, 172, 3)');
// Click on StarFilled (removes from favorites)
cy.get('@starIconFilled').click();
diff --git
a/superset-frontend/packages/superset-ui-core/src/theme/Theme.test.tsx
b/superset-frontend/packages/superset-ui-core/src/theme/Theme.test.tsx
index 2a103ae23d..a8ea167489 100644
--- a/superset-frontend/packages/superset-ui-core/src/theme/Theme.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/theme/Theme.test.tsx
@@ -31,6 +31,23 @@ describe('Theme', () => {
jest.clearAllMocks();
});
+ describe('json', () => {
+ it('serializes the theme configuration to a JSON string', () => {
+ const theme = Theme.fromConfig({
+ token: {
+ colorPrimary: '#ff0000',
+ },
+ algorithm: antdThemeImport.darkAlgorithm,
+ });
+
+ const jsonString = theme.json();
+ const parsedJson = JSON.parse(jsonString);
+
+ expect(parsedJson.token?.colorPrimary).toBe('#ff0000');
+ expect(parsedJson.algorithm).toBe('dark');
+ });
+ });
+
describe('fromConfig', () => {
it('creates a theme with default tokens when no config is provided', () =>
{
const theme = Theme.fromConfig();
diff --git a/superset-frontend/packages/superset-ui-core/src/theme/utils.ts
b/superset-frontend/packages/superset-ui-core/src/theme/utils.ts
index b2710eaa96..fbb3990908 100644
--- a/superset-frontend/packages/superset-ui-core/src/theme/utils.ts
+++ b/superset-frontend/packages/superset-ui-core/src/theme/utils.ts
@@ -34,7 +34,7 @@ import {
export function isSerializableConfig(
config: AnyThemeConfig,
): config is SerializableThemeConfig {
- const { algorithm } = config || {};
+ const { algorithm } = config;
if (algorithm === undefined) return true;