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(tests): Make test imports correct and more consistent #7260

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions tests/mocha/comment_deserialization_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
sharedTestSetup,
sharedTestTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';
import {simulateClick} from './test_helpers/user_input.js';

suite('Comment Deserialization', function () {
Expand Down Expand Up @@ -62,8 +61,7 @@ suite('Comment Deserialization', function () {
const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE);
icon.setBubbleVisible(true);
// Check comment bubble size.
const comment = block.getIcon(CommentIcon.TYPE);
const bubbleSize = comment.getBubbleSize();
const bubbleSize = icon.getBubbleSize();
chai.assert.isNotNaN(bubbleSize.width);
chai.assert.isNotNaN(bubbleSize.height);
chai.assert.equal(icon.getText(), text);
Expand Down
7 changes: 3 additions & 4 deletions tests/mocha/contextmenu_items_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
sharedTestTeardown,
workspaceTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';

suite('Context Menu Items', function () {
setup(function () {
Expand Down Expand Up @@ -459,12 +458,12 @@ suite('Context Menu Items', function () {
});

test('Creates comment if one did not exist', function () {
chai.assert.isNull(
this.block.getIcon(CommentIcon.TYPE),
chai.assert.isUndefined(
this.block.getIcon(Blockly.icons.CommentIcon.TYPE),
'New block should not have a comment'
);
this.commentOption.callback(this.scope);
chai.assert.exists(this.block.getIcon(CommentIcon.TYPE));
chai.assert.exists(this.block.getIcon(Blockly.icons.CommentIcon.TYPE));
chai.assert.isEmpty(
this.block.getCommentText(),
'Block should have empty comment text'
Expand Down
10 changes: 5 additions & 5 deletions tests/mocha/field_multilineinput_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import {
workspaceTeardown,
} from './test_helpers/setup_teardown.js';
import {runCodeGenerationTestSuites} from './test_helpers/code_generation.js';
import {dartGenerator} from '../../generators/dart.js';
import {javascriptGenerator} from '../../generators/javascript.js';
import {luaGenerator} from '../../generators/lua.js';
import {phpGenerator} from '../../generators/php.js';
import {pythonGenerator} from '../../generators/python.js';
import {dartGenerator} from '../../build/src/generators/dart.js';
import {javascriptGenerator} from '../../build/src/generators/javascript.js';
import {luaGenerator} from '../../build/src/generators/lua.js';
import {phpGenerator} from '../../build/src/generators/php.js';
import {pythonGenerator} from '../../build/src/generators/python.js';

suite('Multiline Input Fields', function () {
setup(function () {
Expand Down
10 changes: 5 additions & 5 deletions tests/mocha/generator_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
goog.declareModuleId('Blockly.test.generator');

import * as Blockly from '../../build/src/core/blockly.js';
import {DartGenerator} from '../../generators/dart/dart_generator.js';
import {JavascriptGenerator} from '../../generators/javascript/javascript_generator.js';
import {LuaGenerator} from '../../generators/lua/lua_generator.js';
import {PhpGenerator} from '../../generators/php/php_generator.js';
import {PythonGenerator} from '../../generators/python/python_generator.js';
import {DartGenerator} from '../../build/src/generators/dart/dart_generator.js';
import {JavascriptGenerator} from '../../build/src/generators/javascript/javascript_generator.js';
import {LuaGenerator} from '../../build/src/generators/lua/lua_generator.js';
import {PhpGenerator} from '../../build/src/generators/php/php_generator.js';
import {PythonGenerator} from '../../build/src/generators/python/python_generator.js';
import {
sharedTestSetup,
sharedTestTeardown,
Expand Down
11 changes: 6 additions & 5 deletions tests/mocha/xml_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
sharedTestTeardown,
workspaceTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';
import {assertVariableValues} from './test_helpers/variables.js';

suite('XML', function () {
Expand Down Expand Up @@ -443,7 +442,7 @@ suite('XML', function () {
test('Size', function () {
this.block.setCommentText('test text');
this.block
.getIcon(CommentIcon.TYPE)
.getIcon(Blockly.icons.CommentIcon.TYPE)
.setBubbleSize(new Blockly.utils.Size(100, 200));
const xml = Blockly.Xml.blockToDom(this.block);
const commentXml = xml.firstChild;
Expand All @@ -453,7 +452,9 @@ suite('XML', function () {
});
test('Pinned True', function () {
this.block.setCommentText('test text');
this.block.getIcon(CommentIcon.TYPE).setBubbleVisible(true);
this.block
.getIcon(Blockly.icons.CommentIcon.TYPE)
.setBubbleVisible(true);
const xml = Blockly.Xml.blockToDom(this.block);
const commentXml = xml.firstChild;
chai.assert.equal(commentXml.tagName, 'comment');
Expand Down Expand Up @@ -698,7 +699,7 @@ suite('XML', function () {
this.workspace
);
chai.assert.equal(block.getCommentText(), 'test text');
chai.assert.isOk(block.getIcon(CommentIcon.TYPE));
chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE));
});
test('No Text', function () {
const block = Blockly.Xml.domToBlock(
Expand All @@ -723,7 +724,7 @@ suite('XML', function () {
);
chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE));
chai.assert.deepEqual(
block.getIcon(CommentIcon.TYPE).getBubbleSize(),
block.getIcon(Blockly.icons.CommentIcon.TYPE).getBubbleSize(),
{
width: 100,
height: 200,
Expand Down