8000 fix: Utilize getIcon instead of getCommentIcon in tests by itsjayway · Pull Request #7200 · google/blockly · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Utilize getIcon instead of getCommentIcon in tests #7200

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

Merged
merged 3 commits into from
Jun 23, 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
3 changes: 2 additions & 1 deletion tests/mocha/comment_deserialization_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
sharedTestSetup,
sharedTestTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should have been from '../../build/src/core/icons/comment_icon.js' (here and below).

We are now seeing build warnings that I believe are due to this; I'm actually not certain how this test is running successfully as I would not expect the import as written to work at all:

Could not find "../../core/icons/comment_icon.js".Assuming it (and its transitive dependencies) are non-Closure managed. /Users/cpcallen/src/blockly/tests/mocha/comment_deserialization_test.js
Could not find "../../core/icons/comment_icon.js".Assuming it (and its transitive dependencies) are non-Closure managed. /Users/cpcallen/src/blockly/tests/mocha/contextmenu_items_test.js
...

import {simulateClick} from './test_helpers/user_input.js';

10000 suite('Comment Deserialization', function () {
Expand Down Expand Up @@ -61,7 +62,7 @@ suite('Comment Deserialization', function () {
const icon = block.getIcon(Blockly.icons.CommentIcon.TYPE);
icon.setBubbleVisible(true);
// Check comment bubble size.
const comment = block.getCommentIcon();
const comment = block.getIcon(CommentIcon.TYPE);
const bubbleSize = comment.getBubbleSize();
chai.assert.isNotNaN(bubbleSize.width);
chai.assert.isNotNaN(bubbleSize.height);
Expand Down
5 changes: 3 additions & 2 deletions tests/mocha/contextmenu_items_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ 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,11 +460,11 @@ suite('Context Menu Items', function () {

test('Creates comment if one did not exist', function () {
chai.assert.isNull(
this.block.getCommentIcon(),
this.block.getIcon(CommentIcon.TYPE),
'New block should not have a comment'
);
this.commentOption.callback(this.scope);
chai.assert.exists(this.block.getCommentIcon());
chai.assert.exists(this.block.getIcon(CommentIcon.TYPE));
chai.assert.isEmpty(
this.block.getCommentText(),
'Block should have empty comment text'
Expand Down
18 changes: 11 additions & 7 deletions tests/mocha/xml_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
sharedTestTeardown,
workspaceTeardown,
} from './test_helpers/setup_teardown.js';
import {CommentIcon} from '../../core/icons/comment_icon.js';
import {assertVariableValues} from './test_helpers/variables.js'; D889

suite('XML', function () {
Expand Down Expand Up @@ -442,7 +443,7 @@ suite('XML', function () {
test('Size', function () {
this.block.setCommentText('test text');
this.block
.getCommentIcon()
.getIcon(CommentIcon.TYPE)
.setBubbleSize(new Blockly.utils.Size(100, 200));
const xml = Blockly.Xml.blockToDom(this.block);
const commentXml = xml.firstChild;
Expand All @@ -452,7 +453,7 @@ suite('XML', function () {
});
test('Pinned True', function () {
this.block.setCommentText('test text');
this.block.getCommentIcon().setBubbleVisible(true);
this.block.getIcon(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 @@ -697,7 +698,7 @@ suite('XML', function () {
this.workspace
);
chai.assert.equal(block.getCommentText(), 'test text');
chai.assert.isOk(block.getCommentIcon());
chai.assert.isOk(block.getIcon(CommentIcon.TYPE));
});
test('No Text', function () {
const block = Blockly.Xml.domToBlock(
Expand All @@ -721,10 +722,13 @@ suite('XML', function () {
this.workspace
);
chai.assert.isOk(block.getIcon(Blockly.icons.CommentIcon.TYPE));
chai.assert.deepEqual(block.getCommentIcon().getBubbleSize(), {
width: 100,
height: 200,
});
chai.assert.deepEqual(
block.getIcon(CommentIcon.TYPE).getBubbleSize(),
{
width: 100,
height: 200,
}
);
});
suite('Pinned', function () {
test('Pinned True', function () {
Expand Down
0