Skip to content

Commit 80e28cf

Browse files
committed
chore: Added missing automated test
1 parent 25ed6b5 commit 80e28cf

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

apps/automated/src/ui/styling/style-tests.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,36 @@ export function test_undefined_css_variable_invalidates_entire_expression() {
19481948
TKUnit.assertEqual(label.style.boxShadow, undefined, 'the css variable is undefined');
19491949
}
19501950

1951+
export function test_css_variable_that_resolves_to_another_css_variable_order_desc() {
1952+
const page = helper.getClearCurrentPage();
1953+
1954+
const cssVarName = `--my-var1-${Date.now()}`;
1955+
const cssVarName2 = `--my-var2-${Date.now()}`;
1956+
const cssVarName3 = `--my-var3-${Date.now()}`;
1957+
const greenColor = '#008000';
1958+
1959+
const stack = new StackLayout();
1960+
stack.css = `
1961+
StackLayout.var {
1962+
background-color: var(${cssVarName3});
1963+
}
1964+
StackLayout.var {
1965+
${cssVarName3}: var(${cssVarName2});
1966+
}
1967+
StackLayout.var {
1968+
${cssVarName2}: var(${cssVarName});
1969+
}
1970+
StackLayout.var {
1971+
${cssVarName}: ${greenColor};
1972+
}
1973+
`;
1974+
1975+
stack.className = 'var';
1976+
page.content = stack;
1977+
1978+
TKUnit.assertEqual(stack.style.backgroundColor.hex, greenColor, 'Failed to resolve css variable of css variable');
1979+
}
1980+
19511981
export function test_css_calc_and_variables() {
19521982
const page = helper.getClearCurrentPage();
19531983

@@ -1990,7 +2020,7 @@ export function test_css_calc_and_variables() {
19902020

19912021
export function test_css_variable_fallback() {
19922022
const redColor = '#FF0000';
1993-
const greeColor = '#008000';
2023+
const greenColor = '#008000';
19942024
const blueColor = '#0000FF';
19952025
const limeColor = new Color('lime').hex;
19962026
const yellowColor = new Color('yellow').hex;
@@ -2018,7 +2048,7 @@ export function test_css_variable_fallback() {
20182048
},
20192049
{
20202050
className: 'undefined-css-variable-with-multiple-fallbacks',
2021-
expectedColor: greeColor,
2051+
expectedColor: greenColor,
20222052
},
20232053
{
20242054
className: 'undefined-css-variable-with-missing-fallback-value',

0 commit comments

Comments
 (0)