test(vue): avoid CSS-wide keyword as a custom-property value in useCssVar test

Setting a custom property to 'initial' (a CSS-wide keyword) computes to the guaranteed-invalid value, so getComputedStyle returns '' — correct per spec and now implemented by jsdom 29 (the deps bump from jsdom 28). Use a normal token ('start') so the read returns the value.
This commit is contained in:
2026-06-08 17:32:29 +07:00
parent d88fe9f9ab
commit f4cc6e45eb
@@ -172,7 +172,10 @@ describe(useCssVar, () => {
it('updates the ref when an observed mutation fires', () => { it('updates the ref when an observed mutation fires', () => {
vi.stubGlobal('MutationObserver', StubMutationObserver); vi.stubGlobal('MutationObserver', StubMutationObserver);
const el = document.createElement('div'); const el = document.createElement('div');
el.style.setProperty('--y', 'initial'); // NB: use a normal token, not a CSS-wide keyword like `initial` — per spec
// (and jsdom 29+) a custom property set to `initial` computes to the
// guaranteed-invalid value, so getComputedStyle returns an empty string.
el.style.setProperty('--y', 'start');
document.body.appendChild(el); document.body.appendChild(el);
const scope = effectScope(); const scope = effectScope();
@@ -181,7 +184,7 @@ describe(useCssVar, () => {
v = useCssVar('--y', el, { observe: true }); v = useCssVar('--y', el, { observe: true });
}); });
expect(v!.value).toBe('initial'); expect(v!.value).toBe('start');
// Simulate an external change followed by a mutation record. // Simulate an external change followed by a mutation record.
el.style.setProperty('--y', 'external'); el.style.setProperty('--y', 'external');