reactlynx-testing-library / LynxTestingEnv

Class: LynxTestingEnv

A pure-JavaScript implementation of the Lynx Spec, notably the Element PAPI and Dual-threaded Model for use with Node.js.

Example

import { LynxTestingEnv } from '@lynx-js/testing-environment';

const lynxTestingEnv = new LynxTestingEnv();

lynxTestingEnv.switchToMainThread();
// use the main thread Element PAPI
const page = __CreatePage('0', 0);
const view = __CreateView(0);
__AppendElement(page, view);

Constructors

new LynxTestingEnv()

new LynxTestingEnv(): LynxTestingEnv

Returns

LynxTestingEnv

Defined in

index.d.ts:892

Properties

backgroundThread

backgroundThread: LynxGlobalThis;

The global object for the background thread.

Example

import { LynxTestingEnv } from '@lynx-js/testing-environment';

const lynxTestingEnv = new LynxTestingEnv();

lynxTestingEnv.switchToBackgroundThread();
// use the background thread global object
globalThis.lynxCoreInject.tt.OnLifecycleEvent(...args);

Defined in

index.d.ts:872


jsdom

jsdom: JSDOM;

Defined in

index.d.ts:891


mainThread

mainThread: LynxGlobalThis & ElementTreeGlobals;

The global object for the main thread.

Example

import { LynxTestingEnv } from '@lynx-js/testing-environment';

const lynxTestingEnv = new LynxTestingEnv();

lynxTestingEnv.switchToMainThread();
// use the main thread global object
const page = globalThis.__CreatePage('0', 0);
const view = globalThis.__CreateView(0);
globalThis.__AppendElement(page, view);

Defined in

index.d.ts:890

Methods

clearGlobal()

clearGlobal(): void

Returns

void

Defined in

index.d.ts:896


injectGlobals()

injectGlobals(): void

Returns

void

Defined in

index.d.ts:893


reset()

reset(): void

Returns

void

Defined in

index.d.ts:897


switchToBackgroundThread()

switchToBackgroundThread(): void

Returns

void

Defined in

index.d.ts:894


switchToMainThread()

switchToMainThread(): void

Returns

void

Defined in

index.d.ts:895

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.