Home / Function/ default.before_test() — svelte Function Reference

default.before_test() — svelte Function Reference

Architecture documentation for the default.before_test() function in _config.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  51f696fe_b532_8a34_3f8d_53bbb2d2fed4["default.before_test()"]
  786fd3fa_1346_154b_fdbd_cfaf5ccc7340["_config.js"]
  51f696fe_b532_8a34_3f8d_53bbb2d2fed4 -->|defined in| 786fd3fa_1346_154b_fdbd_cfaf5ccc7340
  style 51f696fe_b532_8a34_3f8d_53bbb2d2fed4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/tests/runtime-legacy/samples/dynamic-element-animation-2/_config.js lines 34–58

	before_test() {
		originalDivGetBoundingClientRect = window.HTMLDivElement.prototype.getBoundingClientRect;
		originalSpanGetBoundingClientRect = window.HTMLSpanElement.prototype.getBoundingClientRect;
		originalParagraphGetBoundingClientRect =
			window.HTMLParagraphElement.prototype.getBoundingClientRect;

		window.HTMLDivElement.prototype.getBoundingClientRect = fakeGetBoundingClientRect;
		window.HTMLSpanElement.prototype.getBoundingClientRect = fakeGetBoundingClientRect;
		window.HTMLParagraphElement.prototype.getBoundingClientRect = fakeGetBoundingClientRect;

		/**
		 * @this {HTMLElement}
		 */
		function fakeGetBoundingClientRect() {
			const index = [...(this.parentNode?.children ?? [])].indexOf(this);
			const top = index * 30;

			return /** @type {DOMRect} */ ({
				left: 0,
				right: 100,
				top,
				bottom: top + 20
			});
		}
	},

Domain

Subdomains

Frequently Asked Questions

What does default.before_test() do?
default.before_test() is a function in the svelte codebase, defined in packages/svelte/tests/runtime-legacy/samples/dynamic-element-animation-2/_config.js.
Where is default.before_test() defined?
default.before_test() is defined in packages/svelte/tests/runtime-legacy/samples/dynamic-element-animation-2/_config.js at line 34.

Analyze Your Own Codebase

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

Try Supermodel Free