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
  574dfc12_9768_51af_93ac_c788e3f7148f["default.test()"]
  8b5907c0_630d_00fa_90b2_fb7eab781cfb["_config.js"]
  574dfc12_9768_51af_93ac_c788e3f7148f -->|defined in| 8b5907c0_630d_00fa_90b2_fb7eab781cfb
  07d76165_84db_aa3e_f8fc_c7c9c3a10163["test()"]
  574dfc12_9768_51af_93ac_c788e3f7148f -->|calls| 07d76165_84db_aa3e_f8fc_c7c9c3a10163
  4b6f72d5_8908_7410_71ee_78d06484a92f["htmlEqual()"]
  574dfc12_9768_51af_93ac_c788e3f7148f -->|calls| 4b6f72d5_8908_7410_71ee_78d06484a92f
  f4a0c661_f2f9_0ec6_e74c_ee5f896de9fe["assert_ok()"]
  574dfc12_9768_51af_93ac_c788e3f7148f -->|calls| f4a0c661_f2f9_0ec6_e74c_ee5f896de9fe
  style 574dfc12_9768_51af_93ac_c788e3f7148f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/tests/runtime-browser/samples/component-css-custom-properties-dynamic-svg/_config.js lines 26–64

	test({ component, assert, target }) {
		component.rectColor1 = 'yellow';
		component.circleColor2 = 'cyan';

		assert.htmlEqual(
			target.innerHTML,
			`
			<svg xmlns="http://www.w3.org/2000/svg">
				<g style="--rect-color: yellow; --circle-color: red;">
					<g id="svg-1">
						<circle cx="50" cy="50" r="10" class="svelte-1qzlp1k"></circle>
						<rect width="100" height="100" class="svelte-1qzlp1k"></rect>
					</g>
				</g>
				<g style="--rect-color: black; --circle-color: cyan;">
					<g id="svg-2">
						<circle cx="50" cy="50" r="10" class="svelte-1qzlp1k"></circle>
						<rect width="100" height="100" class="svelte-1qzlp1k"></rect>
					</g>
				</g>
			</svg>
		`
		);

		const circle_color1 = target.querySelector('#svg-1 circle');
		const rect_color1 = target.querySelector('#svg-1 rect');
		const circle_color2 = target.querySelector('#svg-2 circle');
		const rect_color2 = target.querySelector('#svg-2 rect');

		assert_ok(circle_color1);
		assert_ok(rect_color1);
		assert_ok(circle_color2);
		assert_ok(rect_color2);

		assert.htmlEqual(window.getComputedStyle(circle_color1).fill, 'rgb(255, 0, 0)');
		assert.htmlEqual(window.getComputedStyle(rect_color1).fill, 'rgb(255, 255, 0)');
		assert.htmlEqual(window.getComputedStyle(circle_color2).fill, 'rgb(0, 255, 255)');
		assert.htmlEqual(window.getComputedStyle(rect_color2).fill, 'rgb(0, 0, 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-browser/samples/component-css-custom-properties-dynamic-svg/_config.js.
Where is default.test() defined?
default.test() is defined in packages/svelte/tests/runtime-browser/samples/component-css-custom-properties-dynamic-svg/_config.js at line 26.
What does default.test() call?
default.test() calls 3 function(s): assert_ok, htmlEqual, test.

Analyze Your Own Codebase

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

Try Supermodel Free