Skip to content

[jsinterop] implement mocking support for static JSInterop #49351

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

Closed
3 tasks done
Tracked by #49353
sigmundch opened this issue Jun 27, 2022 · 0 comments
Closed
3 tasks done
Tracked by #49353

[jsinterop] implement mocking support for static JSInterop #49351

sigmundch opened this issue Jun 27, 2022 · 0 comments
Assignees
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop web-js-interop Issues that impact all js interop

Comments

@sigmundch
Copy link
Member

sigmundch commented Jun 27, 2022

JSInterop with @staticInterop only supports dispatching code statically and doesn't support mocking logic by implementing a Dart interface. Instead, mocks need to be implemented at the JS layer.

This bug tracks progress towards support for js mocks. This includes:

@sigmundch sigmundch added web-js-interop Issues that impact all js interop area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop labels Jun 27, 2022
@srujzs srujzs self-assigned this Aug 9, 2022
copybara-service bot pushed a commit that referenced this issue Sep 16, 2022
Bug: #49351

Adds checks for the following cases:
- Type arguments to createStaticInteropMock are correct
- No missing members in implementing class
- Inherited and non-overridden @staticInterop members are implemented
- Dart class can implement through inheritance and mixins
- Implemented members are correct subtypes of @staticInterop members
- Potential extension member conflicts that are attempted to be
resolved through subtyping rules

Change-Id: Iacbe5846040ba7fab41459aa19be77351cf1efca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255761
Reviewed-by: Sigmund Cherem <[email protected]>
Reviewed-by: Riley Porter <[email protected]>
copybara-service bot pushed a commit that referenced this issue Sep 16, 2022
Bug: #49351

After static checks have passed, adds functionality for a JS
object literal to mock a @staticInterop class using a Dart
implementation. Fields, getters, setters, and methods' names are
added to the object literal, and their values are closures which
call the Dart mock's members.

Change-Id: Ie2ef27179eb79039d3aa28737b246c5091f4beb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257160
Reviewed-by: Riley Porter <[email protected]>
@srujzs srujzs closed this as completed Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

2 participants