mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
Fix advanced compilation tests for Q1 2021 release (#4709)
This commit is contained in:
@@ -21,7 +21,6 @@ goog.require('Blockly.inputTypes');
|
||||
goog.requireType('Blockly.Block');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.Field');
|
||||
goog.requireType('Blockly.FieldDropdown');
|
||||
goog.requireType('Blockly.RenderedConnection');
|
||||
|
||||
|
||||
@@ -122,17 +121,16 @@ Blockly.Input.prototype.insertFieldAt = function(index, field, opt_name) {
|
||||
field.name = opt_name;
|
||||
field.setVisible(this.isVisible());
|
||||
|
||||
var fieldDropdown = /** @type {Blockly.FieldDropdown} */ (field);
|
||||
if (fieldDropdown.prefixField) {
|
||||
if (field.prefixField) {
|
||||
// Add any prefix.
|
||||
index = this.insertFieldAt(index, fieldDropdown.prefixField);
|
||||
index = this.insertFieldAt(index, field.prefixField);
|
||||
}
|
||||
// Add the field to the field row.
|
||||
this.fieldRow.splice(index, 0, field);
|
||||
++index;
|
||||
if (fieldDropdown.suffixField) {
|
||||
if (field.suffixField) {
|
||||
// Add any suffix.
|
||||
index = this.insertFieldAt(index, fieldDropdown.suffixField);
|
||||
index = this.insertFieldAt(index, field.suffixField);
|
||||
}
|
||||
|
||||
if (this.sourceBlock_.rendered) {
|
||||
|
||||
@@ -447,6 +447,7 @@ function buildLangfiles(done) {
|
||||
function buildAdvancedCompilationTest() {
|
||||
const srcs = [
|
||||
'tests/compile/main.js',
|
||||
'tests/compile/test_blocks.js',
|
||||
'core/**/**/*.js',
|
||||
'blocks/*.js',
|
||||
'generators/**/*.js'];
|
||||
|
||||
@@ -14,6 +14,7 @@ goog.require('Blockly.VerticalFlyout');
|
||||
goog.require('Blockly.Constants.Logic');
|
||||
goog.require('Blockly.Constants.Loops');
|
||||
goog.require('Blockly.Constants.Math');
|
||||
goog.require('Blockly.Constants.TestBlocks');
|
||||
goog.require('Blockly.Constants.Text');
|
||||
goog.require('Blockly.Constants.Lists');
|
||||
goog.require('Blockly.Constants.Colour');
|
||||
|
||||
50
tests/compile/test_blocks.js
Normal file
50
tests/compile/test_blocks.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2021 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Test blocks for advanced compilation.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
goog.provide('Blockly.Constants.TestBlocks');
|
||||
|
||||
goog.require('Blockly');
|
||||
goog.require('Blockly.Blocks');
|
||||
|
||||
|
||||
Blockly.defineBlocksWithJsonArray([
|
||||
{
|
||||
'type': 'test_style_hex1',
|
||||
'message0': 'Block color: Bright purple %1 %2 %3 %4',
|
||||
'args0': [
|
||||
{
|
||||
'type': 'field_input',
|
||||
'name': 'TEXT',
|
||||
'text': '#992aff',
|
||||
},
|
||||
{
|
||||
'type': 'field_dropdown',
|
||||
'name': 'DROPDOWN',
|
||||
'options': [
|
||||
['option', 'ONE'],
|
||||
['option', 'TWO'],
|
||||
],
|
||||
},
|
||||
{
|
||||
'type': 'field_checkbox',
|
||||
'name': 'NAME',
|
||||
'checked': true,
|
||||
},
|
||||
{
|
||||
'type': 'input_value',
|
||||
'name': 'NAME',
|
||||
},
|
||||
],
|
||||
'previousStatement': null,
|
||||
'nextStatement': null,
|
||||
'colour': '#992aff',
|
||||
}
|
||||
]);
|
||||
Reference in New Issue
Block a user