Skip to main content

Module: testUtil/plainObjectToTarget

Functions

plainObjectToTarget

plainObjectToTarget(editor, plainObject): Target

Given a plain object describing a target, constructs a Target object. Note that the target object today doesn't include a reference to an editor, because all of our recorded tests are on single editors, so we just construct a target where the ranges refer to {@link editor}.

Note that this function is just a partial implementation today, throwing an exception if we try to rehydrate anything other than an UntypedTarget.

Parameters

NameTypeDescription
editorTextEditorThe editor where the target ranges are defined
plainObjectTargetPlainObjectA plain object describing a Target

Returns

Target

A Target constructed from the given plain object

Defined in

testUtil/plainObjectToTarget.ts:20