-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fluid Interactors #735
Fluid Interactors #735
Conversation
🦋 Changeset detectedLatest commit: 052bf8f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A preview package of this pull request has been published with the tag $ npm install @bigtest/interactor@fluid-interactors or by updating your package.json to: {
"@bigtest/interactor": "fluid-interactors"
} |
ae94b32
to
7ec1e07
Compare
7ec1e07
to
99b3417
Compare
export function makeBuilder<T, E extends Element, F extends Filters<E>, A extends Actions<E>>(base: T, name: string, specification: InteractorSpecification<E, F, A>): T & InteractorBuilder<E, F, A> { | ||
return Object.assign(base, { | ||
selector: (value: string): InteractorConstructor<E, F, A> => { | ||
return createConstructor(name, { ...specification, selector: value }); | ||
}, | ||
locator: (value: LocatorFn<E>): InteractorConstructor<E, F, A> => { | ||
return createConstructor(name, { ...specification, locator: value }); | ||
}, | ||
filters: <FR extends Filters<E>>(filters: FR): InteractorConstructor<E, F & FR, A> => { | ||
return createConstructor(name, { ...specification, filters: { ...specification.filters, ...filters } }); | ||
}, | ||
actions: <AR extends Actions<E>>(actions: AR): InteractorConstructor<E, F, A & AR> => { | ||
return createConstructor(name, { ...specification, actions: Object.assign({}, specification.actions, actions) }); | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we remove backward compatibility, this will no longer need to be a separate thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should talk about what in the guides need to be updated with this new syntax. Obviously there are the 1:1 API changes, but this also changes the story around how to write your own interactor since this now enables deriving interactors from other interactors and the ability to to "extend" an existing interactor instead.
Let's update the 1:1 changes in the guides with this PR, and then we can have the discussion about what is the best way to write and organize your own interactors and your own interactor library.
@cowboyd worth mentioning that as far as I am aware, this change is 100% backward compatible. |
Oh snap! Well in that case we can do the documentation upgrade later |
Decoupling docs updates from this change makes sense to me. The new API experience seems great too. |
This explores the design space of an alternative API for creating interactors.
See: #737