Conversation
|
|
||
| import { Signal } from './signal'; | ||
|
|
||
| describe('signal protocol', () => { |
There was a problem hiding this comment.
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.
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.
These tests validate the content is displayed correctly after the framework has subscribed to a signal.
nolanlawson
left a comment
There was a problem hiding this comment.
I know this is just the tests, but this already looks cool as hell! 🤘
divmain
left a comment
There was a problem hiding this comment.
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.
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