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

chore: remove underscores from private properties and methods in some fields #6977

Merged
merged 6 commits into from
Apr 13, 2023

Conversation

rachel-fenichel
Copy link
Collaborator

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Part of #6548

Proposed Changes

Remove underscores from private property and method names. Fix uses in tests. In some cases, update tests to use existing getters.

@rachel-fenichel rachel-fenichel requested a review from a team as a code owner April 13, 2023 20:39
@github-actions github-actions bot added the PR: chore General chores (dependencies, typos, etc) label Apr 13, 2023
@BeksOmega BeksOmega requested review from BeksOmega and removed request for NeilFraser April 13, 2023 20:47
@BeksOmega BeksOmega assigned BeksOmega and unassigned NeilFraser Apr 13, 2023
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.

LGTM! Just one question about whether the click handler tests are doing anything for us.

Comment on lines 95 to 108
test('JS Constructor', function() {
const field = new Blockly.FieldImage('src', 10, 10, null, this.onClick);
chai.assert.equal(field.clickHandler_, this.onClick);
chai.assert.equal(field.clickHandler, this.onClick);
});
test('setOnClickHandler', function() {
const field = new Blockly.FieldImage('src', 10, 10);
field.setOnClickHandler(this.onClick);
chai.assert.equal(field.clickHandler_, this.onClick);
chai.assert.equal(field.clickHandler, this.onClick);
});
test('Remove Click Handler', function() {
const field = new Blockly.FieldImage('src', 10, 10, null, this.onClick);
field.setOnClickHandler(null);
chai.assert.isNull(field.clickHandler_);
chai.assert.isNull(field.clickHandler);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Honestly not sure if these tests are worth maintaining given that setOnClickHandler literally just assigns a variable. (costs of doing updates like this might not be worth the benefits)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. It's testing all of the arguments, but not in a super useful way.

I've been taking notes as I changed fields, and this is a pattern across the field tests. I think the solution is to test that the click handler is actually getting called (possibly using the stuff Eric is working on?) and then delete the tests that check whether the property was set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But it is testing that all ways of constructing this particular type of field work exactly the same, and I think that coverage is worthwhile. I'd like to preserve that, just in a way that doesn't pry inside the field so aggressively.

@rachel-fenichel rachel-fenichel merged commit c458d63 into google:develop Apr 13, 2023
@rachel-fenichel rachel-fenichel deleted the misc_cleanup_6 branch April 13, 2023 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: chore General chores (dependencies, typos, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants