repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/compat/test/browser/testUtils.js
compat/test/browser/testUtils.js
/** * Retrieve a Symbol if supported or use the fallback value * @param {string} name The name of the Symbol to look up * @param {number} fallback Fallback value if Symbols are not supported */ export function getSymbol(name, fallback) { let out = fallback; try { // eslint-disable-next-line if ( Function....
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/compat/test/browser/PureComponent.test.jsx
compat/test/browser/PureComponent.test.jsx
import React, { createElement } from 'preact/compat'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { vi } from 'vitest'; describe('PureComponent', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let rer...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/compat/test/browser/hooks.test.jsx
compat/test/browser/hooks.test.jsx
import { createContext } from 'preact'; import { createElement, useDeferredValue, useInsertionEffect, useTransition, render, useState, useContext, useEffect } from 'preact/compat'; import { setupRerender, act } from 'preact/test-utils'; import { setupScratch, teardown } from '../../../test/_util/helpers'; impor...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/compat/test/browser/componentDidCatch.test.jsx
compat/test/browser/componentDidCatch.test.jsx
import { createElement, render, Component } from 'preact/compat'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { act } from 'preact/test-utils'; describe('componentDidCatch', () => { let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scrat...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/compat/test/browser/compat.options.test.jsx
compat/test/browser/compat.options.test.jsx
import { vnodeSpy, eventSpy } from '../../../test/_util/optionSpies'; import { createElement, render, Component, createRef } from 'preact/compat'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown, createEvent } from '../../../test/_util/helpers'; describe('compat options', () =...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/devtools/src/index.js
devtools/src/index.js
import { options } from 'preact'; import { initDevTools } from './devtools'; initDevTools(); /** * Display a custom label for a custom hook for the devtools panel * @type {<T>(value: T, name: string) => T} */ export function addHookName(value, name) { if (options._addHookName) { options._addHookName(name); } ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/devtools/src/devtools.js
devtools/src/devtools.js
import { Component, Fragment, options } from 'preact'; export function initDevTools() { const globalVar = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : undefined; if ( globalVar !== null && globalVar !== undefined && globalVar.__PREACT_DEVTOOLS__ ) ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/devtools/test/browser/addHookName.test.jsx
devtools/test/browser/addHookName.test.jsx
import { createElement, render, options } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useState } from 'preact/hooks'; import { addHookName } from 'preact/devtools'; import { vi } from 'vitest'; describe('addHookName', () => { /** @type {HTMLDivElement} */ let scratch...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/index.js
src/index.js
export { render, hydrate } from './render'; export { createElement, createElement as h, Fragment, createRef, isValidElement } from './create-element'; export { BaseComponent as Component } from './component'; export { cloneElement } from './clone-element'; export { createContext } from './create-context'; export {...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/component.js
src/component.js
import { assign } from './util'; import { diff, commitRoot } from './diff/index'; import options from './options'; import { Fragment } from './create-element'; import { COMPONENT_FORCE, COMPONENT_DIRTY, MODE_HYDRATE, NULL } from './constants'; /** * Base Component class. Provides `setState()` and `forceUpdate()`,...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/constants.js
src/constants.js
// Vnode._flags /** Normal hydration that attaches to a DOM tree but does not diff it. */ export const MODE_HYDRATE = 1 << 5; /** Signifies this VNode suspended on the previous render */ export const MODE_SUSPENDED = 1 << 7; /** Indicates that this node needs to be inserted while patching children */ export const INSER...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/render.js
src/render.js
import { EMPTY_OBJ, MODE_HYDRATE, NULL } from './constants'; import { commitRoot, diff } from './diff/index'; import { createElement, Fragment } from './create-element'; import options from './options'; import { slice } from './util'; /** * Render a Preact virtual node into a DOM element * @param {import('./internal...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/create-element.js
src/create-element.js
import { slice } from './util'; import options from './options'; import { NULL, UNDEFINED } from './constants'; let vnodeId = 0; /** * Create an virtual node (used for JSX) * @param {import('./internal').VNode["type"]} type The node name or Component constructor for this * virtual node * @param {object | null | u...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/options.js
src/options.js
import { _catchError } from './diff/catch-error'; /** * The `option` object can potentially contain callback functions * that are called during various stages of our renderer. This is the * foundation on which all our addons like `preact/debug`, `preact/compat`, * and `preact/hooks` are based on. See the `Options`...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/create-context.js
src/create-context.js
import { enqueueRender } from './component'; import { NULL, COMPONENT_FORCE } from './constants'; export let i = 0; export function createContext(defaultValue) { function Context(props) { if (!this.getChildContext) { /** @type {Set<import('./internal').Component> | null} */ let subs = new Set(); let ctx =...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/clone-element.js
src/clone-element.js
import { assign, slice } from './util'; import { createVNode } from './create-element'; import { NULL } from './constants'; /** * Clones the given VNode, optionally adding attributes/props and replacing its * children. * @param {import('./internal').VNode} vnode The virtual DOM element to clone * @param {object} p...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/util.js
src/util.js
import { EMPTY_ARR } from './constants'; export const isArray = Array.isArray; export const slice = EMPTY_ARR.slice; export const assign = Object.assign; /** * Remove a child node from its parent if attached. * @param {import('./internal').PreactElement | null} node The node to remove */ export function removeNode...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/diff/index.js
src/diff/index.js
import { COMPONENT_FORCE, COMPONENT_DIRTY, COMPONENT_PENDING_ERROR, COMPONENT_PROCESSING_EXCEPTION, EMPTY_OBJ, FORCE_PROPS_REVALIDATE, MATH_NAMESPACE, MODE_HYDRATE, MODE_SUSPENDED, NULL, RESET_MODE, SVG_NAMESPACE, UNDEFINED, XHTML_NAMESPACE, MATHML_TOKEN_ELEMENTS } from '../constants'; import { BaseCompo...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/diff/children.js
src/diff/children.js
import { diff, unmount, applyRef } from './index'; import { createVNode, Fragment } from '../create-element'; import { EMPTY_OBJ, EMPTY_ARR, INSERT_VNODE, MATCHED, UNDEFINED, NULL } from '../constants'; import { isArray } from '../util'; import { getDomSibling } from '../component'; /** * @typedef {import('../i...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/diff/props.js
src/diff/props.js
import { NULL, SVG_NAMESPACE } from '../constants'; import options from '../options'; function setStyle(style, key, value) { if (key[0] == '-') { style.setProperty(key, value == NULL ? '' : value); } else if (value == NULL) { style[key] = ''; } else { style[key] = value; } } const CAPTURE_REGEX = /(PointerC...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/src/diff/catch-error.js
src/diff/catch-error.js
import { resetRenderCount } from '../component'; import { NULL, COMPONENT_DIRTY, COMPONENT_PENDING_ERROR, COMPONENT_PROCESSING_EXCEPTION, COMPONENT_FORCE } from '../constants'; /** * Find the closest error boundary to a thrown error and call it * @param {object} error The thrown value * @param {import('../inte...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/src/index.js
hooks/src/index.js
import { options as _options } from 'preact'; import { COMPONENT_FORCE } from '../../src/constants'; const ObjectIs = Object.is; /** @type {number} */ let currentIndex; /** @type {import('./internal').Component} */ let currentComponent; /** @type {import('./internal').Component} */ let previousComponent; /** @type...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/_util/useEffectUtil.js
hooks/test/_util/useEffectUtil.js
export function scheduleEffectAssert(assertFn) { return new Promise(resolve => { requestAnimationFrame(() => setTimeout(() => { assertFn(); resolve(); }, 0) ); }); }
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useLayoutEffect.test.jsx
hooks/test/browser/useLayoutEffect.test.jsx
import { act } from 'preact/test-utils'; import { createElement, render, Fragment, Component } from 'preact'; import { setupScratch, teardown, serializeHtml } from '../../../test/_util/helpers'; import { useEffectAssertions } from './useEffectAssertions'; import { useLayoutEffect, useRef, useState } from 'preact/hoo...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/hooks.options.test.jsx
hooks/test/browser/hooks.options.test.jsx
import { afterDiffSpy, beforeRenderSpy, unmountSpy, hookSpy } from '../../../test/_util/optionSpies'; import { setupRerender, act } from 'preact/test-utils'; import { createElement, render, createContext, options } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useSt...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useRef.test.jsx
hooks/test/browser/useRef.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useRef } from 'preact/hooks'; describe('useRef', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scrat...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useReducer.test.jsx
hooks/test/browser/useReducer.test.jsx
import { setupRerender, act } from 'preact/test-utils'; import { createElement, render, createContext } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useReducer, useEffect, useContext } from 'preact/hooks'; describe('useReducer', () => { /** @type {HTMLDivElement} */ l...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useState.test.jsx
hooks/test/browser/useState.test.jsx
import { setupRerender, act } from 'preact/test-utils'; import { createElement, render, createContext, Component } from 'preact'; import { vi } from 'vitest'; import { useState, useContext, useEffect } from 'preact/hooks'; import { setupScratch, teardown } from '../../../test/_util/helpers'; describe('useState', () =>...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useMemo.test.jsx
hooks/test/browser/useMemo.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useMemo, useState } from 'preact/hooks'; import { act } from 'preact/test-utils'; import { vi } from 'vitest'; describe('useMemo', () => { /** @type {HTMLDivElement} */ let scratch; before...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useDebugValue.test.jsx
hooks/test/browser/useDebugValue.test.jsx
import { createElement, render, options } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useDebugValue, useState } from 'preact/hooks'; import { vi } from 'vitest'; describe('useDebugValue', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scrat...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/errorBoundary.test.jsx
hooks/test/browser/errorBoundary.test.jsx
import { Fragment, createElement, render } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useErrorBoundary, useLayoutEffect, useState } from 'preact/hooks'; import { setupRerender } from 'preact/test-utils'; import { vi } from 'vitest'; describe('errorBoundary', () => { ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useCallback.test.jsx
hooks/test/browser/useCallback.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useCallback } from 'preact/hooks'; describe('useCallback', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { tear...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useContext.test.jsx
hooks/test/browser/useContext.test.jsx
import { createElement, render, createContext, Component } from 'preact'; import { act } from 'preact/test-utils'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useContext, useEffect, useState } from 'preact/hooks'; import { vi } from 'vitest'; describe('useContext', () => { /** @type...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/combinations.test.jsx
hooks/test/browser/combinations.test.jsx
import { setupRerender, act } from 'preact/test-utils'; import { createElement, render, Component, createContext } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useState, useReducer, useEffect, useLayoutEffect, useRef, useMemo, useContext } from 'preact/hooks'; imp...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useImperativeHandle.test.jsx
hooks/test/browser/useImperativeHandle.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useImperativeHandle, useRef, useState } from 'preact/hooks'; import { setupRerender } from 'preact/test-utils'; import { vi } from 'vitest'; describe('useImperativeHandle', () => { /** @type ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useId.test.jsx
hooks/test/browser/useId.test.jsx
import { createElement, Fragment, hydrate, render } from 'preact'; import { useId, useReducer, useState } from 'preact/hooks'; import { setupRerender } from 'preact/test-utils'; import { render as rts } from 'preact-render-to-string'; import { setupScratch, teardown } from '../../../test/_util/helpers'; describe('useI...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useEffectAssertions.jsx
hooks/test/browser/useEffectAssertions.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { vi } from 'vitest'; // Common behaviors between all effect hooks export function useEffectAssertions(useEffect, scheduleEffectAssert) { /** ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/useEffect.test.jsx
hooks/test/browser/useEffect.test.jsx
import { act, teardown as teardownAct } from 'preact/test-utils'; import { createElement, render, Fragment, Component } from 'preact'; import { useEffect, useState, useRef } from 'preact/hooks'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useEffectAssertions } from './useEffectAsserti...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/hooks/test/browser/componentDidCatch.test.jsx
hooks/test/browser/componentDidCatch.test.jsx
import { createElement, render, Component } from 'preact'; import { act } from 'preact/test-utils'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { useEffect } from 'preact/hooks'; describe('errorInfo', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scratch =...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/node/index.test.js
test/node/index.test.js
import { expect } from 'chai'; import * as preact from '../../'; describe('build artifact', () => { // #1075 Check that the build artifact has the correct exports it('should have exported properties', () => { expect(typeof preact).to.equal('object'); expect(preact).to.have.property('createElement'); expect(pre...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/fixtures/preact.js
test/fixtures/preact.js
!(function () { 'use strict'; function h(nodeName, attributes) { var lastSimple, child, simple, i, children = EMPTY_CHILDREN; for (i = arguments.length; i-- > 2; ) stack.push(arguments[i]); if (attributes && null != attributes.children) { if (!stack.length) stack.push(attributes.children); del...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/_util/helpers.jsx
test/_util/helpers.jsx
import { createElement, options } from 'preact'; import { clearLog, getLog } from './logCall'; import { teardown as testUtilTeardown } from 'preact/test-utils'; import { vi } from 'vitest'; /** @jsx createElement */ /** * Assign properties from `props` to `obj` * @template O, P The obj and props types * @param {O}...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/_util/logCall.js
test/_util/logCall.js
/** * Serialize an object * @param {Object} obj * @return {string} */ function serialize(obj) { if (obj instanceof Text) return '#text'; if (obj instanceof Element) return `<${obj.localName}>${obj.textContent}`; if (obj === document) return 'document'; if (typeof obj == 'string') return obj; return Object.prot...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/_util/dom.js
test/_util/dom.js
/** * Serialize contents * @typedef {string | number | Array<string | number>} Contents * @param {Contents} contents */ const serialize = contents => Array.isArray(contents) ? contents.join('') : contents.toString(); /** * A helper to generate innerHTML validation strings containing spans * @param {Contents} co...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/_util/optionSpies.js
test/_util/optionSpies.js
import { options as rawOptions } from 'preact'; import { vi } from 'vitest'; /** @type {import('preact/src/internal').Options} */ let options = rawOptions; let oldVNode = options.vnode; let oldEvent = options.event || (e => e); let oldAfterDiff = options.diffed; let oldUnmount = options.unmount; let oldRoot = option...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/spec.test.jsx
test/browser/spec.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { vi } from 'vitest'; describe('Component spec', () => { let scratch, rerender; beforeEach(() => { scratch = setupScratch(); rerender = ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/style.test.jsx
test/browser/style.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown, sortCss } from '../_util/helpers'; import { vi } from 'vitest'; describe('style attribute', () => { /** @type {HTMLElement} */ let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scratch); ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/customBuiltInElements.test.jsx
test/browser/customBuiltInElements.test.jsx
import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { vi } from 'vitest'; const runSuite = typeof customElements == 'undefined' ? xdescribe : describe; runSuite('customised built-in elements', () => { let scratch; beforeEach(() => { scratch...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/mathml.test.jsx
test/browser/mathml.test.jsx
import { createElement, Component, render } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown } from '../_util/helpers'; const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; describe('mathml', () => { let ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/events.test.jsx
test/browser/events.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown, supportsPassiveEvents } from '../_util/helpers'; import { vi } from 'vitest'; describe('event handling', () => { let scratch, proto; function fireEvent(on, type) { let e = document.createEvent('Event'); e.initEvent(type, true, t...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/svg.test.jsx
test/browser/svg.test.jsx
import { createElement, Component, render } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown, sortAttributes } from '../_util/helpers'; import { vi } from 'vitest'; describe('svg', () => { let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach((...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/context.test.jsx
test/browser/context.test.jsx
import { createElement, render, Component, Fragment } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { vi } from 'vitest'; describe('context', () => { let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scratch); }); it('should pass co...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/isValidElement.test.js
test/browser/isValidElement.test.js
import { createElement, isValidElement, Component } from 'preact'; import { isValidElementTests } from '../shared/isValidElementTests'; isValidElementTests(expect, isValidElement, createElement, Component);
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/hydrate.test.jsx
test/browser/hydrate.test.jsx
import { createElement, hydrate, Fragment, Component } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown, sortAttributes, serializeHtml, spyOnElementAttributes, createEvent } from '../_util/helpers'; import { ul, li, div } from '../_util/dom'; import { logCall, clea...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/keys.test.jsx
test/browser/keys.test.jsx
import { createElement, Component, render, createRef } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown } from '../_util/helpers'; import { logCall, clearLog, getLog } from '../_util/logCall'; import { div } from '../_util/dom'; import { vi } from 'vitest'; describe('ke...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/placeholders.test.jsx
test/browser/placeholders.test.jsx
import { createElement, Component, render, createRef, Fragment } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown } from '../_util/helpers'; import { logCall, clearLog, getLog } from '../_util/logCall'; import { div } from '../_util/dom'; import { vi } from 'vitest'; de...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/cloneElement.test.jsx
test/browser/cloneElement.test.jsx
import { createElement, cloneElement, createRef } from 'preact'; describe('cloneElement', () => { it('should clone components', () => { function Comp() {} const instance = <Comp prop1={1}>hello</Comp>; const clone = cloneElement(instance); expect(clone.prototype).to.equal(instance.prototype); expect(clone....
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/focus.test.jsx
test/browser/focus.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component, Fragment, hydrate } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { div, span, input as inputStr, h1, h2 } from '../_util/dom'; /* eslint-disable react/jsx-boolean-value */ describe('focus'...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/toChildArray.test.jsx
test/browser/toChildArray.test.jsx
import { createElement, render, toChildArray } from 'preact'; import { setupScratch, teardown, getMixedArray, mixedArrayHTML } from '../_util/helpers'; describe('toChildArray', () => { /** @type {HTMLDivElement} */ let scratch; let children; let Foo = props => { children = toChildArray(props.children); r...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/fragments.test.jsx
test/browser/fragments.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component, Fragment, createContext } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { span, div, ul, ol, li, section } from '../_util/dom'; import { logCall, clearLog, getLog } from '../_util/logCal...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
true
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/createContext.test.jsx
test/browser/createContext.test.jsx
import { setupRerender, act } from 'preact/test-utils'; import { createElement, render, Component, createContext, Fragment } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { vi } from 'vitest'; describe('createContext', () => { let scratch; let rerender; beforeEach(() => { ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/render.test.jsx
test/browser/render.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component, options, Fragment } from 'preact'; import { setupScratch, teardown, getMixedArray, mixedArrayHTML, serializeHtml, supportsDataList, sortAttributes, spyOnElementAttributes, createEvent } from '../_util/helpers'; import...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
true
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/refs.test.jsx
test/browser/refs.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component, createRef, Fragment } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; import { vi } from 'vitest'; // gives call count and argument errors names (otherwise vitest just uses "spy"): let spy = (name, ....
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/components.test.jsx
test/browser/components.test.jsx
import { createElement, render, Component, Fragment } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown, getMixedArray, mixedArrayHTML, serializeHtml, sortAttributes } from '../_util/helpers'; import { vi } from 'vitest'; const h = createElement; function getAttri...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
true
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/getDomSibling.test.jsx
test/browser/getDomSibling.test.jsx
import { createElement, render, Fragment } from '../../src/'; import { getDomSibling } from '../../src/component'; import { setupScratch, teardown } from '../_util/helpers'; describe('getDomSibling', () => { /** @type {HTMLDivElement} */ let scratch; const getRoot = dom => dom._children; beforeEach(() => { scr...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/select.test.jsx
test/browser/select.test.jsx
import { createElement, render } from 'preact'; import { setupScratch, teardown } from '../_util/helpers'; describe('Select', () => { let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(scratch); }); it('should set <select> value', () => { function App() { return ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentWillMount.test.jsx
test/browser/lifecycles/componentWillMount.test.jsx
import { createElement, render, Component } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown } from '../../_util/helpers'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let rerender; beforeEach(() => { ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentDidUpdate.test.jsx
test/browser/lifecycles/componentDidUpdate.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let re...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentWillUpdate.test.jsx
test/browser/lifecycles/componentWillUpdate.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let re...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentWillUnmount.test.jsx
test/browser/lifecycles/componentWillUnmount.test.jsx
import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scratch = setupScratch(); }); afterEach(() => { teardown(s...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentWillReceiveProps.test.jsx
test/browser/lifecycles/componentWillReceiveProps.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let re...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/getSnapshotBeforeUpdate.test.jsx
test/browser/lifecycles/getSnapshotBeforeUpdate.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let rerender; beforeEach(() => { ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/shouldComponentUpdate.test.jsx
test/browser/lifecycles/shouldComponentUpdate.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component, Fragment } from 'preact'; import { vi } from 'vitest'; import { setupScratch, teardown } from '../../_util/helpers'; import { logCall, getLog, clearLog } from '../../_util/logCall'; describe('Lifecycle methods', () => { /** ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentDidMount.test.jsx
test/browser/lifecycles/componentDidMount.test.jsx
import { createElement, render, Component } from 'preact'; import { setupRerender } from 'preact/test-utils'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; let rerender; beforeEach(() => {...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/getDerivedStateFromError.test.jsx
test/browser/lifecycles/getDerivedStateFromError.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /* eslint-disable react/display-name */ /** @type {HTMLDivElement} */ let sc...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/lifecycle.test.jsx
test/browser/lifecycles/lifecycle.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let re...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/componentDidCatch.test.jsx
test/browser/lifecycles/componentDidCatch.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component, Fragment } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi, expect } from 'vitest'; describe('Lifecycle methods', () => { /* eslint-disable react/display-name */ /** @type {HTMLDivE...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/browser/lifecycles/getDerivedStateFromProps.test.jsx
test/browser/lifecycles/getDerivedStateFromProps.test.jsx
import { setupRerender } from 'preact/test-utils'; import { createElement, render, Component } from 'preact'; import { setupScratch, teardown } from '../../_util/helpers'; import { vi } from 'vitest'; describe('Lifecycle methods', () => { /** @type {HTMLDivElement} */ let scratch; /** @type {() => void} */ let re...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/shared/createElement.test.jsx
test/shared/createElement.test.jsx
import { createElement } from '../../src/index'; import { expect } from 'chai'; const h = createElement; /*eslint-env browser */ // const buildVNode = (nodeName, attributes, children=[]) => ({ // nodeName, // children, // attributes, // key: attributes && attributes.key // }); describe('createElement(jsx)', () =...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/shared/isValidElement.test.js
test/shared/isValidElement.test.js
import { createElement, isValidElement, Component } from '../../src/index'; import { expect } from 'chai'; import { isValidElementTests } from './isValidElementTests'; isValidElementTests(expect, isValidElement, createElement, Component);
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/shared/isValidElementTests.jsx
test/shared/isValidElementTests.jsx
// @jsxRuntime classic // @jsx createElement export function isValidElementTests( expect, isValidElement, createElement, Component ) { describe('isValidElement', () => { it('should check if the argument is a valid vnode', () => { // Failure cases expect(isValidElement(123)).to.equal(false); expect(isVa...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/shared/exports.test.js
test/shared/exports.test.js
import { createElement, h, createContext, Component, Fragment, render, hydrate, cloneElement, options, createRef, toChildArray, isValidElement } from '../../src/index'; import { expect } from 'chai'; describe('preact', () => { it('should be available as named exports', () => { expect(h).to.be.a('functio...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test/shared/createContext.test.jsx
test/shared/createContext.test.jsx
import { createElement, createContext } from '../../src/index'; import { expect } from 'chai'; /* eslint-env browser */ describe('createContext', () => { it('should return a Provider and a Consumer', () => { const context = createContext(null); expect(context).to.have.property('Provider'); expect(context).to.h...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test-utils/src/index.js
test-utils/src/index.js
import { options } from 'preact'; /** * Setup a rerender function that will drain the queue of pending renders * @returns {() => void} */ export function setupRerender() { options.__test__previousDebounce = options.debounceRendering; options.debounceRendering = cb => (options.__test__drainQueue = cb); return () ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test-utils/test/shared/rerender.test.jsx
test-utils/test/shared/rerender.test.jsx
import { options, createElement, render, Component } from 'preact'; import { teardown, setupRerender } from 'preact/test-utils'; import { vi } from 'vitest'; describe('setupRerender & teardown', () => { /** @type {HTMLDivElement} */ let scratch; beforeEach(() => { scratch = document.createElement('div'); }); ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/test-utils/test/shared/act.test.jsx
test-utils/test/shared/act.test.jsx
import { options, createElement, render } from 'preact'; import { useEffect, useReducer, useState } from 'preact/hooks'; import { act } from 'preact/test-utils'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { vi } from 'vitest'; // IE11 doesn't support `new Event()` function createEvent...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/jsx-runtime/src/index.js
jsx-runtime/src/index.js
import { options, Fragment } from 'preact'; import { encodeEntities } from './utils'; let vnodeId = 0; const isArray = Array.isArray; /** * @fileoverview * This file exports various methods that implement Babel's "automatic" JSX runtime API: * - jsx(type, props, key) * - jsxs(type, props, key) * - jsxDEV(type, ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/jsx-runtime/src/utils.js
jsx-runtime/src/utils.js
const ENCODED_ENTITIES = /["&<]/; /** @param {string} str */ export function encodeEntities(str) { // Skip all work for strings with no entities needing encoding: if (str.length === 0 || ENCODED_ENTITIES.test(str) === false) return str; let last = 0, i = 0, out = '', ch = ''; // Seek forward in str until t...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/jsx-runtime/test/browser/jsx-runtime.test.js
jsx-runtime/test/browser/jsx-runtime.test.js
import { Component, createElement, createRef, options } from 'preact'; import { jsx, jsxs, jsxDEV, Fragment, jsxAttr, jsxTemplate, jsxEscape } from 'preact/jsx-runtime'; import { setupScratch, teardown } from '../../../test/_util/helpers'; import { encodeEntities } from '../../src/utils'; import { vi } from 'vit...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/config/codemod-let-name.js
config/codemod-let-name.js
/** * Restores var names transformed by babel's let block scoping */ export default (file, api) => { let j = api.jscodeshift; let code = j(file.source); // @TODO unsafe, but without it we gain 20b gzipped: https://www.diffchecker.com/bVrOJWTO code .findVariableDeclarators() .filter(d => /^_i/.test(d.value.id...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/config/codemod-strip-tdz.js
config/codemod-strip-tdz.js
/* eslint no-console:0 */ // parent node types that we don't want to remove pointless initializations from (because it breaks hoisting) const BLOCKED = ['ForStatement', 'WhileStatement']; // 'IfStatement', 'SwitchStatement' /** Removes var initialization to `void 0`, which Babel adds for TDZ strictness. */ export def...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/config/compat-entries.js
config/compat-entries.js
const path = require('path'); const fs = require('fs'); const kl = require('kolorist'); const pkgFiles = new Set(require('../package.json').files); const compatDir = path.join(__dirname, '..', 'compat'); const files = fs.readdirSync(compatDir); let missing = 0; for (const file of files) { const expected = 'compat/' ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/config/codemod-const.js
config/codemod-const.js
/* eslint no-console:0 */ /** Find constants (identified by ALL_CAPS_DECLARATIONS), and inline them globally. * This is safe because Preact *only* uses global constants. */ export default (file, api) => { let j = api.jscodeshift, code = j(file.source), constants = {}, found = 0; code .find(j.VariableDecla...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/src/index.js
debug/src/index.js
import { initDebug } from './debug'; import 'preact/devtools'; initDebug(); export { resetPropWarnings } from './check-props'; export { captureOwnerStack, getCurrentVNode, getDisplayName, getOwnerStack, setupComponentStack } from './component-stack';
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/src/component-stack.js
debug/src/component-stack.js
import { options, Fragment } from 'preact'; /** * Get human readable name of the component/dom node * * @param {import('./internal').VNode} vnode * @returns {string} */ export function getDisplayName(vnode) { if (vnode.type === Fragment) { return 'Fragment'; } else if (typeof vnode.type == 'function') { ret...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/src/check-props.js
debug/src/check-props.js
const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; let loggedTypeFailures = {}; /** * Reset the history of which prop type warnings have been logged. */ export function resetPropWarnings() { loggedTypeFailures = {}; } /** * Assert that the values match with the type specs. * Error mess...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/src/constants.js
debug/src/constants.js
export const ELEMENT_NODE = 1; export const DOCUMENT_NODE = 9; export const DOCUMENT_FRAGMENT_NODE = 11;
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/src/debug.js
debug/src/debug.js
import { checkPropTypes } from './check-props'; import { options, Component } from 'preact'; import { ELEMENT_NODE, DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE } from './constants'; import { getOwnerStack, setupComponentStack, getCurrentVNode, getDisplayName } from './component-stack'; import { isNaN } from './util'; ...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/src/util.js
debug/src/util.js
export const assign = Object.assign; export function isNaN(value) { return value !== value; }
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false
preactjs/preact
https://github.com/preactjs/preact/blob/bf7a195ac4b1706468e876e41b27428e3d8a08f3/debug/test/browser/debug.options.test.jsx
debug/test/browser/debug.options.test.jsx
import { vnodeSpy, rootSpy, beforeDiffSpy, hookSpy, afterDiffSpy, catchErrorSpy } from '../../../test/_util/optionSpies'; import { createElement, render, Component } from 'preact'; import { useState } from 'preact/hooks'; import { setupRerender } from 'preact/test-utils'; import 'preact/debug'; import { setupScr...
javascript
MIT
bf7a195ac4b1706468e876e41b27428e3d8a08f3
2026-01-04T14:59:51.617528Z
false