Remove return value from Field dropdownCreate_ (#4915)

These functions have side effects and set all kinds of private fields.  It is misleading for them to return the top-level element, for the caller to assign to a private field.
This commit is contained in:
Neil Fraser
2021-06-18 08:22:25 -07:00
committed by GitHub
parent 7b286dbf82
commit c8bea1ff3a
4 changed files with 27 additions and 24 deletions

View File

@@ -101,7 +101,7 @@ suite('Colour Fields', function() {
testHelpers.runFromJsonSuiteTests(
Blockly.FieldColour, validValueTestCases,invalidValueTestCases,
validTestCaseAssertField, assertFieldDefault);
suite('setValue', function() {
suite('Empty -> New Value', function() {
setup(function() {
@@ -165,9 +165,9 @@ suite('Colour Fields', function() {
suite('Customizations', function() {
suite('Colours and Titles', function() {
function assertColoursAndTitles(field, colours, titles) {
var editor = field.dropdownCreate_();
field.dropdownCreate_();
var index = 0;
var node = editor.firstChild.firstChild;
var node = field.picker_.firstChild.firstChild;
while (node) {
chai.assert.equal(node.getAttribute('title'), titles[index]);
chai.assert.equal(
@@ -243,8 +243,8 @@ suite('Colour Fields', function() {
});
suite('Columns', function() {
function assertColumns(field, columns) {
var editor = field.dropdownCreate_();
chai.assert.equal(editor.firstChild.children.length, columns);
field.dropdownCreate_();
chai.assert.equal(field.picker_.firstChild.children.length, columns);
}
test('Constants', function() {
var columns = Blockly.FieldColour.COLUMNS;