Home / Function/ default.test() — svelte Function Reference

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
  fd4d0c7e_45a4_9091_ed3f_ba37763ec115["default.test()"]
  cf835496_273c_1bb9_2c5e_4803be121f41["_config.js"]
  fd4d0c7e_45a4_9091_ed3f_ba37763ec115 -->|defined in| cf835496_273c_1bb9_2c5e_4803be121f41
  style fd4d0c7e_45a4_9091_ed3f_ba37763ec115 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/tests/runtime-legacy/samples/binding-input-number-2/_config.js lines 11–43

	test({ assert, target, window, component }) {
		const input = target.querySelector('input');
		ok(input);
		const inputEvent = new window.InputEvent('input');
		assert.equal(component.value, 5);
		assert.equal(input.value, '5');

		input.value = '5.';
		input.dispatchEvent(inputEvent);
		flushSync();

		// input type number has value === "" if ends with dot/comma
		assert.equal(component.value, undefined);
		assert.equal(input.value, '');

		input.value = '5.5';
		input.dispatchEvent(inputEvent);
		flushSync();

		assert.equal(component.value, 5.5);
		assert.equal(input.value, '5.5');

		input.value = '5.50';
		input.dispatchEvent(inputEvent);
		flushSync();

		assert.equal(component.value, 5.5);
		assert.equal(input.value, '5.50');

		component.value = 1;
		assert.equal(component.value, 1);
		assert.equal(input.value, '1');
	}

Domain

Subdomains

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/binding-input-number-2/_config.js.
Where is default.test() defined?
default.test() is defined in packages/svelte/tests/runtime-legacy/samples/binding-input-number-2/_config.js at line 11.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free