-
Notifications
You must be signed in to change notification settings - Fork 418
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(core): support pasting object into array + copying individual array items #7292
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
No changes to documentation |
Component Testing Report Updated Aug 13, 2024 11:33 AM (UTC)
|
sjelfull
force-pushed
the
fix/copy-paste-fixes
branch
from
August 1, 2024 11:33
265cdc5
to
448a9f5
Compare
Signed-off-by: Fred Carlsen <fred@sjelfull.no> Signed-off-by: Fred Carlsen <fred@sjelfull.no>
Signed-off-by: Fred Carlsen <fred@sjelfull.no>
Signed-off-by: Fred Carlsen <fred@sjelfull.no>
This makes sure we at least cover more of the studio side of the logic, and don’t rely solely on the unit test for the transferValue logic Signed-off-by: Fred Carlsen <fred@sjelfull.no>
Signed-off-by: Fred Carlsen <fred@sjelfull.no>
The underlying issue is that the `getRecentSearches()` function will mutate state, and the state will not necessarily be updated before the test continues. The workaround here is to force a rerender any time we change the state before continuing. This might point to some underlying implementation of `recentSearches`, but I did not dig too much into that. Signed-off-by: Fred Carlsen <fred@sjelfull.no> Signed-off-by: Fred Carlsen <fred@sjelfull.no>
juice49
previously approved these changes
Aug 13, 2024
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 great!
sjelfull
force-pushed
the
fix/copy-paste-fixes
branch
from
August 13, 2024 10:48
b8d5fca
to
627b039
Compare
Signed-off-by: Fred Carlsen <fred@sjelfull.no>
RitaDias
approved these changes
Aug 13, 2024
cngonzalez
pushed a commit
that referenced
this pull request
Aug 20, 2024
…ray items (#7292) * feat(core): support pasting object into array touches edx-1432 Signed-off-by: Fred Carlsen <fred@sjelfull.no> * fix(core): validate references in documents on paste fixes edx-1584 Signed-off-by: Fred Carlsen <fred@sjelfull.no> * fix(core): add missing translation key Signed-off-by: Fred Carlsen <fred@sjelfull.no> Signed-off-by: Fred Carlsen <fred@sjelfull.no> * feat(core): add support for copying single array items Signed-off-by: Fred Carlsen <fred@sjelfull.no> * fix(core): handle first index segments (0) when getting value Signed-off-by: Fred Carlsen <fred@sjelfull.no> * test(core): add tests for copy paste hook This makes sure we at least cover more of the studio side of the logic, and don’t rely solely on the unit test for the transferValue logic Signed-off-by: Fred Carlsen <fred@sjelfull.no> * chore(deps): add dependencies Signed-off-by: Fred Carlsen <fred@sjelfull.no> * fix(core): fix flaky test for recentSearches The underlying issue is that the `getRecentSearches()` function will mutate state, and the state will not necessarily be updated before the test continues. The workaround here is to force a rerender any time we change the state before continuing. This might point to some underlying implementation of `recentSearches`, but I did not dig too much into that. Signed-off-by: Fred Carlsen <fred@sjelfull.no> Signed-off-by: Fred Carlsen <fred@sjelfull.no> * chore(core): update comment about handling inline objects Signed-off-by: Fred Carlsen <fred@sjelfull.no> --------- Signed-off-by: Fred Carlsen <fred@sjelfull.no>
This was referenced Sep 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes and adds a few things in the new copy&paste feature:
recentSearches
that became even more flaky after upgrading the React testing libraryFixes EDX-1432 and EDX-1584.
CleanShot.2024-08-09.at.13.17.04.mp4
What to review
Testing
Unit tests have been added for these new scenarios.
Also new in this PR, we added unit tests for the
useCopyPaste
hook that covers some common scenarios. I found that only having unit tests for the underlying transferValue utility leads to false sense of security, since there is a lot that can go wrong inside the studio. This will hopefully allow us to catch bugs early when changing this logic, even if we don't have proper E2E tests setup.Notes for release
getValueAtPath()
utility wouldn't work for0
index path segments (['array', 0]
)