Add useCustomLocator() for non-DOM locators#302
Add useCustomLocator() for non-DOM locators#302Alloyed wants to merge 2 commits intothetarnav:mainfrom
Conversation
All DOM-specific parts of the existing locator have been moved into their own folder, DOMLocator. existing calls to `useLocator()` will continue to use the DOM locator, but as an opt-in you can provide a custom locator with the same API as the DOM locator. The types your custom locator are expected to match can be found at `locator/types.ts`.
|
|
|
||
| export type {LocationAttr, LocatorComponent, TargetIDE, TargetURLFunction} from './find-components' | ||
|
|
||
| export type LocatorOptions = { |
There was a problem hiding this comment.
I could not make LocatorOptions DOM-agnostic without changing the api. targetIDE is fine, but key assumes the browser's implementation of keyboard keys
|
|
||
| // TODO: rename or remove? | ||
| // this is used externally so any change is a change in API | ||
| export type {LocatorOptions} from './DOMLocator/types' |
There was a problem hiding this comment.
If breaking changes are OK I would maybe rename this to DOMLocatorOptions
|
I used a different approach in #345, but the goal is the same—supporting custom renderers. |
All DOM-specific parts of the existing locator have been moved into their own folder, DOMLocator. existing calls to
useLocator()will continue to use the DOM locator, but as an opt-in you can provide a custom locator with the same API as the DOM locator. The types your custom locator are expected to match can be found atlocator/types.ts.