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

Relationship Graph

Source Code

packages/svelte/tests/runtime-legacy/samples/ondestroy-prop-access/_config.js lines 5–65

	async test({ assert, target, logs }) {
		const [btn1, btn2, btn3] = target.querySelectorAll('button');
		let ps = [...target.querySelectorAll('p')];

		for (const p of ps) {
			assert.equal(p.innerHTML, '0');
		}

		flushSync(() => {
			btn1.click();
		});

		// prop update normally if we are not unmounting
		for (const p of ps) {
			assert.equal(p.innerHTML, '1');
		}

		flushSync(() => {
			btn3.click();
		});

		// binding still works and update the value correctly
		for (const p of ps) {
			assert.equal(p.innerHTML, '0');
		}

		flushSync(() => {
			btn1.click();
		});

		flushSync(() => {
			btn1.click();
		});

		// the five components guarded by `count < 2` unmount and log
		assert.deepEqual(logs, [1, true, 1, true, 1, true, 1, true, 1, true]);

		flushSync(() => {
			btn2.click();
		});

		// the three components guarded by `show` unmount and log
		assert.deepEqual(logs, [
			1,
			true,
			1,
			true,
			1,
			true,
			1,
			true,
			1,
			true,
			2,
			true,
			2,
			true,
			2,
			true
		]);
	}

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/ondestroy-prop-access/_config.js.
Where is default.test() defined?
default.test() is defined in packages/svelte/tests/runtime-legacy/samples/ondestroy-prop-access/_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