Skip to content

Commit ff0176b

Browse files
authored
Merge pull request #4482 from easyops-cn/steve/v3-theme-get-css-property-value
fix(): resume THEME.getCssPropertyValue
2 parents d7380c7 + b1ac693 commit ff0176b

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

packages/runtime/src/internal/compute/getGeneralGlobals.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ describe("getGeneralGlobals", () => {
2222
).toEqual("light");
2323
});
2424

25-
// Todo: resume test
26-
it.skip("should get css-variable value", () => {
25+
it("should get css-variable value", () => {
2726
const attemptToVisitGlobals = new Set(["THEME"]);
2827
expect(
2928
(

packages/runtime/src/internal/compute/getGeneralGlobals.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MicroApp } from "@next-core/types";
33
import { i18n, i18nText } from "@next-core/i18n";
44
import { widgetI18nFactory } from "./WidgetI18n.js";
55
import { getReadOnlyProxy } from "../proxyFactories.js";
6-
import { getTheme } from "../../themeAndMode.js";
6+
import { getCssPropertyValue, getTheme } from "../../themeAndMode.js";
77
import { getBasePath } from "../../getBasePath.js";
88
import { getI18nNamespace } from "../registerAppI18n.js";
99
import { ImagesFactory, hooks } from "../Runtime.js";
@@ -57,23 +57,23 @@ function getIndividualGlobal(
5757
return collectCoverage
5858
? fakeImageFactory()
5959
: widgetId
60-
? hooks?.images?.widgetImagesFactory(widgetId, widgetVersion)
61-
: hooks?.images?.imagesFactory(
62-
app!.id,
63-
app!.isBuildPush,
64-
(app as { currentVersion?: string }).currentVersion
65-
);
60+
? hooks?.images?.widgetImagesFactory(widgetId, widgetVersion)
61+
: hooks?.images?.imagesFactory(
62+
app!.id,
63+
app!.isBuildPush,
64+
(app as { currentVersion?: string }).currentVersion
65+
);
6666
case "I18N":
6767
return collectCoverage
6868
? identity
6969
: widgetId
70-
? widgetI18nFactory(widgetId)
71-
: i18n.getFixedT(
72-
null,
73-
[appendI18nNamespace, getI18nNamespace("app", app!.id)].filter(
74-
Boolean
75-
) as string[]
76-
);
70+
? widgetI18nFactory(widgetId)
71+
: i18n.getFixedT(
72+
null,
73+
[appendI18nNamespace, getI18nNamespace("app", app!.id)].filter(
74+
Boolean
75+
) as string[]
76+
);
7777
case "I18N_TEXT":
7878
return collectCoverage ? fakeI18nText : i18nText;
7979
case "PERMISSIONS":
@@ -85,7 +85,7 @@ function getIndividualGlobal(
8585
case "THEME":
8686
return getReadOnlyProxy({
8787
getTheme: collectCoverage ? () => "light" : getTheme,
88-
// getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue,
88+
getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue,
8989
});
9090
case "console":
9191
return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;

0 commit comments

Comments
 (0)