-
Notifications
You must be signed in to change notification settings - Fork 45
fix(copy/paste): Enable read/write support for custom Kaoto MIME type in clipboard #2372
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
Conversation
b57f688 to
2a86fc6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2372 +/- ##
==========================================
+ Coverage 81.61% 81.62% +0.01%
==========================================
Files 464 464
Lines 14740 14750 +10
Branches 3227 3112 -115
==========================================
+ Hits 12030 12040 +10
Misses 2708 2708
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Mock the ClipboardItem | ||
| Object.assign(window, { | ||
| ClipboardItem: jest.fn(), | ||
| // Mocking ClipboardItem.supports |
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.
@lordrip , Not entirely sure if this is the proper way to mock both the ClipboardItem constructor and its static supports() method.
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.
Wow, that's interesting 😄 , I've never seen it before.
Another way would be using:
jest.spyOn(ClipboardItem.prototype, 'supports');
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.
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.
Yup, I've seen that for functions, but I've never thought of using it for a class, you're a visionary @shivamG640. 😄
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.
That was the only approach I found that actually worked, none of the other methods I tried were successful.
Could you take a look and see if it's possible to mock both the constructor and the static method within the same test block?
It would be interesting to explore other working examples if you come across any.
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.
Looks good to me, just wondering about the any castings.
| // Mock the ClipboardItem | ||
| Object.assign(window, { | ||
| ClipboardItem: jest.fn(), | ||
| // Mocking ClipboardItem.supports |
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.
Wow, that's interesting 😄 , I've never seen it before.
Another way would be using:
jest.spyOn(ClipboardItem.prototype, 'supports');
2a86fc6 to
347c89b
Compare
|
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.
Thanks for taking care of the supports static method.
No description provided.