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

Relationship Graph

Source Code

packages/svelte/tests/runtime-runes/samples/option-rich-content/_config.js lines 8–36

	test({ assert, target }) {
		const select = /** @type {HTMLSelectElement} */ (target.querySelector('select'));
		const p = /** @type {HTMLParagraphElement} */ (target.querySelector('p'));
		const button = /** @type {HTMLButtonElement} */ (target.querySelector('button'));

		assert.ok(select);
		assert.ok(p);
		assert.ok(button);
		assert.equal(select.value, 'a');
		assert.equal(p.textContent, 'Selected: a');

		// Verify options exist
		assert.equal(select.options.length, 3);

		// Change selection
		select.value = 'b';
		select.dispatchEvent(new Event('change'));
		flushSync();

		assert.equal(p.textContent, 'Selected: b');

		// Test reactivity of content within option (only works on browsers that support rich options)
		// On modern browsers, clicking the button should update the text inside the span
		button.click();
		flushSync();

		// The option text content should be updated on browsers that support rich options
		// For this test, we just verify the component doesn't crash
	}

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

Analyze Your Own Codebase

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

Try Supermodel Free