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

Relationship Graph

Source Code

packages/svelte/tests/runtime-legacy/samples/textarea-content/_config.js lines 18–90

	test({ assert, target }) {
		// Test for <textarea> tag
		const elementTextarea = /** @type {HTMLTextAreaElement} */ (target.querySelector('#textarea'));
		// Test for <textarea> tag in non <textarea> tag
		const elementDivWithTextarea = /** @type {HTMLDivElement} */ (
			target.querySelector('#div-with-textarea')
		);
		// Test for <textarea> tag with leading newline
		const elementTextareaWithLeadingNewline = target.querySelector(
			'#textarea-with-leading-newline'
		);
		const elementTextareaWithoutLeadingNewline = target.querySelector(
			'#textarea-without-leading-newline'
		);
		const elementTextareaWithMultipleLeadingNewline = target.querySelector(
			'#textarea-with-multiple-leading-newlines'
		);
		const elementDivWithTextareaWithMultipleLeadingNewline = target.querySelector(
			'#div-with-textarea-with-multiple-leading-newlines'
		);

		ok(elementTextareaWithLeadingNewline);
		ok(elementTextareaWithoutLeadingNewline);
		ok(elementTextareaWithMultipleLeadingNewline);
		ok(elementDivWithTextareaWithMultipleLeadingNewline);

		assert.equal(
			elementTextarea.value,
			`  A
  B
`
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementDivWithTextarea.children[0]).value,
			`    A
    B
  `
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithLeadingNewline.children[0]).value,
			'leading newline'
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithLeadingNewline.children[1]).value,
			'  leading newline and spaces'
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithLeadingNewline.children[2]).value,
			'\nleading newlines'
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithoutLeadingNewline.children[0]).value,
			'without spaces'
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithoutLeadingNewline.children[1]).value,
			'  with spaces  '
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithoutLeadingNewline.children[2]).value,
			' \nnewline after leading space'
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (elementTextareaWithMultipleLeadingNewline).value,
			'\n\nmultiple leading newlines'
		);
		assert.equal(
			/** @type {HTMLTextAreaElement} */ (
				elementDivWithTextareaWithMultipleLeadingNewline.children[0]
			).value,
			'\n\nmultiple leading newlines'
		);
	}

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

Analyze Your Own Codebase

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

Try Supermodel Free