Skip to content
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

fix: issue 6002 #6011

Merged
merged 5 commits into from
Mar 21, 2022
Merged

fix: issue 6002 #6011

merged 5 commits into from
Mar 21, 2022

Conversation

yamadayutaka
Copy link
Contributor

@yamadayutaka yamadayutaka commented Mar 18, 2022

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide

The details

Resolves

#6002

Proposed Changes

Some comment attributes (pinned/height/width) is removed when block is deleted ( in the trashcan ).
But BlockSerializer is always restore all attributes then comment bubble size may become NaN (and error occuered).
So I added a check when deserializing.

Reason for Changes

Fixing bugs.

Test Coverage

I wrote mocha test in tests/mocha/comment_test.js.

  • Desktop Chrome
  • Windows Edge

Documentation

Additional Information

@yamadayutaka yamadayutaka requested a review from a team as a code owner March 18, 2022 15:07
@google-cla
Copy link

google-cla bot commented Mar 18, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@BeksOmega BeksOmega removed the request for review from cpcallen March 18, 2022 15:10
@BeksOmega BeksOmega assigned BeksOmega and unassigned cpcallen Mar 18, 2022
@BeksOmega BeksOmega self-requested a review March 18, 2022 15:10
Copy link
Collaborator

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect solution! Thank you for identifying the problem and contributing a fix back to core :D

There are a few things to sort out with regard to the unit tests you added. But overall this is a lovely PR.

Also note that you'll have to sign the CLA before we can merge your code :/

Thank you again!

});
function assertComment(workspace, text) {
const count = workspace.getAllBlocks().length;
// show comment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start with a capital and end with a period =) (Here and below)

Suggested change
// show comment
// Show comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as suggested.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all the fixes!

});
test('Redo', function() {
// undo & undo
this.workspace.undo(false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for adding unit tests :D But the way these are structured needs to be changed a bit. Right now this test is relying on the state of the previous test, which means they can't be run on their own or in parallel.

Since this is more of an integration test (it tests a bunch of systems and how they "integrate", rather than just one "unit") you could make it one large test, rather than breaking it out into separate ones. Or even better, instead of writing an automated test, you could document your test steps in a comment on this PR, and we can add the steps to our manual testing document =)

Copy link
Contributor Author

@yamadayutaka yamadayutaka Mar 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your advice.
Which action do you think is better?

  1. Remove the added test code and document the test steps in this PR.
  2. Separate the added test code into another file (e.g. comment_deserialization_test.js) and modify the structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a try to separate the test code and modify the structure.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I pulled down the tests and now they all work when run in isolation. Thank you for the fixes :D

@yamadayutaka yamadayutaka changed the title Fix/issue 6002 fix: issue 6002 Mar 18, 2022
@yamadayutaka
Copy link
Contributor Author

Thank you for your reply!
I was relieved because it was my first contribution.
I will respond to your suggestions.

I've just signed the CLA.

@BeksOmega
Copy link
Collaborator

BeksOmega commented Mar 20, 2022

Thanks for signing the CLA @yamadayutaka :D I'll review your changes Monday =)

I was relieved because it was my first contribution.

Also, this is rad for your first contribution!

@BeksOmega
Copy link
Collaborator

Thank you for putting up a PR for this! I really appreciate that you put in tests, especially for your first contribution. We always want to improve our test suite, and having contributors submit tests is super helpful =)

If you want to contribute more we have help-wanted issues in this repository. Or even better, we have help-wanted issues, and good-first-issues in blockly/samples. That is the repository where we put extensions/plugins to Blockly, so it's a bit easier to develop in =)

If you're not interested in contributing any more right now, that's totally cool too! We still really appreciate you putting in this fix.

Best wishes! 🌻

@yamadayutaka
Copy link
Contributor Author

Thank you for reviewing my PR.
I would like to contribute again if I have the opportunity.
Best regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants