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

Relationship Graph

Source Code

packages/svelte/tests/runtime-legacy/samples/inline-style-directive-spread-and-attr/_config.js lines 8–39

	test({ assert, component, target, window }) {
		const p = target.querySelector('p');
		ok(p);

		let styles = window.getComputedStyle(p);
		assert.equal(styles.color, 'rgb(0, 128, 0)');

		component.color = null;
		assert.htmlEqual(target.innerHTML, '<p style=""></p>');
		styles = window.getComputedStyle(p);
		assert.equal(styles.color, '');

		component.spread = { style: 'color: yellow; padding: 30px;' };

		assert.htmlEqual(target.innerHTML, '<p style="padding: 30px;"></p>');
		styles = window.getComputedStyle(p);
		assert.equal(styles.color, '');
		assert.equal(styles.padding, '30px');

		component.spread = {};
		component.style = 'color: blue; background-color: green;';
		assert.htmlEqual(target.innerHTML, '<p style="background-color: green;"></p>');
		styles = window.getComputedStyle(p);
		assert.equal(styles.color, '');
		assert.equal(styles.backgroundColor, 'rgb(0, 128, 0)');

		component.color = 'purple';
		assert.htmlEqual(target.innerHTML, '<p style="background-color: green; color: purple;"></p>');
		styles = window.getComputedStyle(p);
		assert.equal(styles.color, 'rgb(128, 0, 128)');
		assert.equal(styles.backgroundColor, 'rgb(0, 128, 0)');
	}

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/inline-style-directive-spread-and-attr/_config.js.
Where is default.test() defined?
default.test() is defined in packages/svelte/tests/runtime-legacy/samples/inline-style-directive-spread-and-attr/_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