default.test() — svelte Function Reference
Architecture documentation for the default.test() function in _config.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 4d11e65b_35ce_30b7_9388_ff6a12d66f1c["default.test()"] 984062df_a5b4_a8e6_3d29_ca89e0c56549["_config.js"] 4d11e65b_35ce_30b7_9388_ff6a12d66f1c -->|defined in| 984062df_a5b4_a8e6_3d29_ca89e0c56549 8eec24a9_1998_0053_872e_b4a23bfe5bab["spyOnValueSetter()"] 4d11e65b_35ce_30b7_9388_ff6a12d66f1c -->|calls| 8eec24a9_1998_0053_872e_b4a23bfe5bab style 4d11e65b_35ce_30b7_9388_ff6a12d66f1c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/tests/runtime-legacy/samples/spread-element-input-value/_config.js lines 4–45
async test({ assert, component, target, window }) {
const [input1, input2] = target.querySelectorAll('input');
// we are not able emulate user interaction in jsdom,
// therefore, jsdom could not validate minlength / maxlength
// we simulate user input with
// setting input.value + dispatchEvent
// and we determine if svelte does not set the `input.value` again by
// spying on the setter of `input.value`
const spy1 = spyOnValueSetter(input1, input1.value);
const spy2 = spyOnValueSetter(input2, input2.value);
const event = new window.Event('input');
input1.value = '12345';
spy1.reset();
await input1.dispatchEvent(event);
// In Svelte 5, the value will always fire as the effects for setting
// the value and spreading happen in different parts.
// assert.ok(!spy1.isSetCalled());
input2.value = '12345';
spy2.reset();
await input2.dispatchEvent(event);
// Same as above.
// assert.ok(!spy2.isSetCalled());
spy1.reset();
component.val1 = '56789';
assert.ok(spy1.isSetCalled());
spy2.reset();
component.val2 = '56789';
// Same as above.
// assert.ok(spy2.isSetCalled());
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does default.test() do?
default.test() is a function in the svelte codebase, defined in packages/svelte/tests/runtime-legacy/samples/spread-element-input-value/_config.js.
Where is default.test() defined?
default.test() is defined in packages/svelte/tests/runtime-legacy/samples/spread-element-input-value/_config.js at line 4.
What does default.test() call?
default.test() calls 1 function(s): spyOnValueSetter.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free