-
Notifications
You must be signed in to change notification settings - Fork 399
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
feat: signals test cases #3962
feat: signals test cases #3962
Conversation
|
||
import { Signal } from './signal'; | ||
|
||
describe('signal protocol', () => { |
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.
I created these tests as a basic sanity check for behavior we're expecting from a signals implementation.
The idea is for anyone planning to implement the interface to understand how the framework expects it to behave.
describe('signal protocol', () => { | ||
describe('lwc engine subscribes template re-render callback when signal is bound to an LWC and used on a template', () => { |
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.
These tests validate when the framework will attempt to subscribe to a signal used in an LWC.
describe('signal reaction in lwc', () => { | ||
it('should render signal value', async () => { |
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.
These tests validate the content is displayed correctly after the framework has subscribed to a signal.
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.
I know this is just the tests, but this already looks cool as hell! 🤘
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.
This looks pretty good to me. Thanks for splitting this out into a separate PR; it made everything much easier to review.
I'm guessing there are test cases that are missed here. But I'd recommend not spending any more time enumerating the cases. We'll have a better idea of the edge cases as the larger effort moves forward, and we can circle back to add tests as needed.
import ExplicitSubscribe from 'x/explicitSubscribe'; | ||
import List from 'x/list'; | ||
|
||
import { Signal } from 'x/signal'; |
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.
It's a little weird to use LWC module resolution for this. I see why you're doing it, because to make it easier to import elsewhere in the test collateral. Maybe just leave a comment here, since at first glance it looks like you're importing a component named x-signal
.
Details
This is a draft to discuss the expected use cases for signals in LWC.
The implementation is based on the signals RFC with the following deviations:
Branch with the playground updated for signals.
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
GUS work item
W-14560945