From fc5a41a960867fd4c6f38f4e02acc07e11178e9f Mon Sep 17 00:00:00 2001 From: Mathias Picker <48158184+MathiasWP@users.noreply.github.com> Date: Thu, 7 May 2026 15:22:43 +0200 Subject: [PATCH] chore: tighten style-object test assertions Empty inputs (`[false, null]`, `{}`, etc.) now consistently drop the attribute, so the assertions that accommodated either `null` or `''` are tightened to expect `null` exactly. Stale commentary updated. --- .../runtime-runes/samples/style-object/_config.js | 11 +++++------ .../runtime-runes/samples/style-object/main.svelte | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/svelte/tests/runtime-runes/samples/style-object/_config.js b/packages/svelte/tests/runtime-runes/samples/style-object/_config.js index 19d4ecf8cb..b361fe7487 100644 --- a/packages/svelte/tests/runtime-runes/samples/style-object/_config.js +++ b/packages/svelte/tests/runtime-runes/samples/style-object/_config.js @@ -33,12 +33,11 @@ export default test({ assert.equal(get('nested').style.padding, '4px'); assert.equal(get('nested').style.margin, '2px'); - // all entries falsy → attribute absent (or empty) - assert.notOk(get('all-falsy').getAttribute('style')); + // all entries falsy → attribute absent + assert.equal(get('all-falsy').getAttribute('style'), null); - // empty object → empty style attribute (parallels clsx({}) === '') - const empty_attr = get('empty-object').getAttribute('style'); - assert.ok(empty_attr === '' || empty_attr === null); + // empty object → attribute absent + assert.equal(get('empty-object').getAttribute('style'), null); // conditional inline object: dropped when the gate is false assert.equal(get('conditional').style.padding, '4px'); @@ -92,7 +91,7 @@ export default test({ // $derived gated by a condition: when falsy, no attribute should be emitted assert.notOk(get('derived-conditional').getAttribute('style')); - // $derived combined with style: directive — directive wins + // $derived combined with style: directive, directive wins assert.equal(get('derived-directive').style.color, 'blue'); assert.equal(get('derived-directive').style.padding, '2px'); diff --git a/packages/svelte/tests/runtime-runes/samples/style-object/main.svelte b/packages/svelte/tests/runtime-runes/samples/style-object/main.svelte index 79c3d98b28..e07cb63e18 100644 --- a/packages/svelte/tests/runtime-runes/samples/style-object/main.svelte +++ b/packages/svelte/tests/runtime-runes/samples/style-object/main.svelte @@ -33,7 +33,7 @@
- + @@ -70,7 +70,7 @@ - +