Home / File/ _config.js — svelte Source File

_config.js — svelte Source File

Architecture documentation for _config.js, a javascript file in the svelte codebase. 1 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  1cdb4286_4a7d_eade_9c2d_ee1ce78c04e9["_config.js"]
  654af6d6_2570_6860_f8dd_6b6131e1eec4["test.ts"]
  1cdb4286_4a7d_eade_9c2d_ee1ce78c04e9 --> 654af6d6_2570_6860_f8dd_6b6131e1eec4
  style 1cdb4286_4a7d_eade_9c2d_ee1ce78c04e9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { test } from '../../test';

export default test({
	html: `<div>foo</div><div>bar</div><div>baz</div>
	<span>foo</span><span>bar</span><span>baz</span>
	<ul><li><p>foo</p></li><li><p>bar</p></li><li><p>baz</p></li></ul>
	<ul><li><hr /></li><li><hr /></li><li><hr /></li></ul>`,

	test({ assert, component, target }) {
		let divs = target.querySelectorAll('div');
		assert.equal(component.divs.length, 3, 'three divs are registered (unkeyed array)');
		// @ts-ignore
		component.divs.forEach((e, i) => {
			assert.equal(e, divs[i], `div ${i} is correct (unkeyed array)`);
		});

		let spans = target.querySelectorAll('span');
		assert.equal(
			Object.keys(component.spans).length,
			3,
			'three spans are registered (unkeyed object)'
		);
		// @ts-ignore
		component.items.forEach((e, i) => {
			assert.equal(
				component.spans[`-${e}${i}`],
				spans[i],
				`span -${e}${i} is correct (unkeyed object)`
			);
		});

		let ps = target.querySelectorAll('p');
		assert.equal(component.ps.length, 3, 'three ps are registered (keyed array)');
		// @ts-ignore
		component.ps.forEach((e, i) => {
			assert.equal(e, ps[i], `p ${i} is correct (keyed array)`);
		});

		let hrs = target.querySelectorAll('hr');
		assert.equal(Object.keys(component.hrs).length, 3, 'three hrs are registered (keyed object)');
		// @ts-ignore
		component.items.forEach((e, i) => {
			assert.equal(component.hrs[e], hrs[i], `hr ${e} is correct (keyed object)`);
		});

		component.items = ['foo', 'baz'];
		assert.equal(component.divs.length, 3, 'the divs array is still 3 long');
		assert.equal(component.divs[2], null, 'the last div is unregistered');
		assert.equal(component.ps[2], null, 'the last p is unregistered');
		assert.equal(component.spans['-bar1'], null, 'the bar span is unregistered');
		assert.equal(component.hrs.bar, null, 'the bar hr is unregistered');

		divs = target.querySelectorAll('div');
		// @ts-ignore
		component.divs.forEach((e, i) => {
			assert.equal(e, divs[i], `div ${i} is still correct`);
		});

		spans = target.querySelectorAll('span');
		// @ts-ignore
		component.items.forEach((e, i) => {
			assert.equal(component.spans[`-${e}${i}`], spans[i], `span -${e}${i} is still correct`);
		});

		ps = target.querySelectorAll('p');
		// @ts-ignore
		component.ps.forEach((e, i) => {
			assert.equal(e, ps[i], `p ${i} is still correct`);
		});

		hrs = target.querySelectorAll('hr');
		// @ts-ignore
		component.items.forEach((e, i) => {
			assert.equal(component.hrs[e], hrs[i], `hr ${e} is still correct`);
		});
	}
});

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does _config.js do?
_config.js is a source file in the svelte codebase, written in javascript. It belongs to the BuildSystem domain, MessageProcessor subdomain.
What functions are defined in _config.js?
_config.js defines 1 function(s): default.test.
What does _config.js depend on?
_config.js imports 1 module(s): test.ts.
Where is _config.js in the architecture?
_config.js is located at packages/svelte/tests/runtime-legacy/samples/binding-this-with-context/_config.js (domain: BuildSystem, subdomain: MessageProcessor, directory: packages/svelte/tests/runtime-legacy/samples/binding-this-with-context).

Analyze Your Own Codebase

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

Try Supermodel Free