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 #1619. buildTooltipWithFieldValue() => buildTooltipWithFieldText() #1638

Merged
merged 2 commits into from
Feb 17, 2018

Conversation

AnmAtAnm
Copy link
Contributor

The basics

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

The details

Resolves

Fix #1619

The "value" of FieldVariables was the variable id.
However, we want the field text for the human visible tooltip. Refactoring and renaming buildTooltipWithFieldValue to use the field text.

Proposed Changes

  • Refactor buildTooltipWithFieldValue() to use field text, instead of value. Rename accordingly.
  • Make sure all use (the blocks in question) use the renamed function.
  • Remove custom functions that were not using this helper.

Reason for Changes

#1619

Test Coverage

Tested on:

  • Desktop Chrome

…ext.

The "value" of FieldVariables was the variable id.
However, we usually want the field text for the human visible tooltip.
Refactoring and renaming buildTooltipWithFieldValue to use the field
text.
@@ -423,7 +423,7 @@ Blockly.Extensions.buildTooltipWithFieldValue = function(msgTemplate,
var extensionFn = function() {
this.setTooltip(function() {
return Blockly.utils.replaceMessageReferences(msgTemplate)
.replace('%1', this.getFieldValue(fieldName));
.replace('%1', this.getField(fieldName).getText());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Check if the field exists and use the empty string if it doesn't

@AnmAtAnm AnmAtAnm merged commit f45c6fa into google:develop Feb 17, 2018
@AnmAtAnm AnmAtAnm deleted the fix-tooltip-var-ref-1619 branch February 20, 2018 23:25
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.

2 participants