[reactive-element] Make context decorators work with standard decorators#4151
[reactive-element] Make context decorators work with standard decorators#4151justinfagnani merged 18 commits into3.0from
Conversation
🦋 Changeset detectedLatest commit: 43175a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
📊 Tachometer Benchmark ResultsSummarynop-update
render
update
update-reflect
Resultsthis-change
render
update
update-reflect
this-change, tip-of-tree, previous-release
render
update
nop-update
this-change, tip-of-tree, previous-release
render
update
this-change, tip-of-tree, previous-release
render
update
update-reflect
|
|
The size of lit-html.js and lit-core.min.js are as expected. |
rictic
left a comment
There was a problem hiding this comment.
This is a small subset of the tests in https://github.com/lit/lit/pull/4009/files
I can land that PR after this one and land all of the tests as part of that
Co-authored-by: Benny Powers <bennypowers@users.noreply.github.com>
|
I didn't copy over all of the tests because I'm not entirely happy with how the tests are organized right now. Ideally I would have just copied over the decorator tests, but there aren't tests for just the decorators. There are tests for scenarios, and some components of the tests directly use controllers or use decorators. It's a little tricky because of the two-part nature of the protocol. It's easier to test a consumer if you have a provider and vice-versa. I don't think it's that great to reimplement half of the context protocol with the possibility of mistakes there. It would be great if there were common protocol interop tests. But even with a combined comsumer/provider test, that could use the controllers only and then we could have isolated and smaller tests for decorators. |
Part of #4144
One thing to check on here is how optional fields are translated to auto-accessors and whether or not we have the types correct, and had them correct prior to this PR. The exist tests include a case of an optional field decorated with a non-optional context type. That doesn't exactly work with accessors, which can't be optional, and so have to include
undefinedin their type to get the same effect. This difference is that this setup requires the context includeundefined, whereas optional fields don't. The actual type of optional fields is the same though, so it seems like something was wrong in the original types.