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

Relationship Graph

Source Code

packages/svelte/tests/runtime-runes/samples/async-fork/_config.js lines 5–91

	async test({ assert, target, raf }) {
		const [shift, increment, commit] = target.querySelectorAll('button');

		shift.click();
		await tick();

		assert.htmlEqual(
			target.innerHTML,
			`
				<button>shift</button>
				<button>increment</button>
				<button>commit</button>
				<p>count: 0</p>
				<p>eager: 0</p>
				<p>even</p>
			`
		);

		increment.click();
		await tick();

		shift.click();
		await tick();

		// nothing updates until commit
		assert.htmlEqual(
			target.innerHTML,
			`
				<button>shift</button>
				<button>increment</button>
				<button>commit</button>
				<p>count: 0</p>
				<p>eager: 0</p>
				<p>even</p>
			`
		);

		commit.click();
		await tick();

		// nothing updates until commit
		assert.htmlEqual(
			target.innerHTML,
			`
				<button>shift</button>
				<button>increment</button>
				<button>commit</button>
				<p>count: 1</p>
				<p>eager: 1</p>
				<p>odd</p>
			`
		);

		increment.click();
		await tick();

		commit.click();
		await tick();

		// eager state updates on commit
		assert.htmlEqual(
			target.innerHTML,
			`
				<button>shift</button>
				<button>increment</button>
				<button>commit</button>
				<p>count: 1</p>
				<p>eager: 2</p>
				<p>odd</p>
			`
		);

		shift.click();
		await tick();

		assert.htmlEqual(
			target.innerHTML,
			`
				<button>shift</button>
				<button>increment</button>
				<button>commit</button>

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-runes/samples/async-fork/_config.js.
Where is default.test() defined?
default.test() is defined in packages/svelte/tests/runtime-runes/samples/async-fork/_config.js at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free