mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-04-18 10:15:48 -04:00
fix: Fix test failures. (#10)
This commit is contained in:
parent
31189d616b
commit
111ccd6481
4 changed files with 30 additions and 33 deletions
test
fixtures
integration
unit
2
test/fixtures/events.json
vendored
2
test/fixtures/events.json
vendored
|
@ -89,7 +89,7 @@
|
|||
"name": "comment",
|
||||
"type": "comment_create",
|
||||
"commentId": "a comment",
|
||||
"xy": {"x": 10, "y": 20}
|
||||
"json": { "x": 10, "y": 20 }
|
||||
},
|
||||
"mockVariableBlock": {
|
||||
"name": "block",
|
||||
|
|
|
@ -44,7 +44,8 @@ test('stack click activates the stack', t => {
|
|||
if (allBlocks[blockId].opcode === 'event_whengreaterthan') {
|
||||
blockContainer.blocklyListen({
|
||||
blockId: blockId,
|
||||
element: 'stackclick'
|
||||
targetType: 'block',
|
||||
type: 'click'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,9 +125,7 @@ const extensionInfoWithCustomFieldTypes = {
|
|||
|
||||
const testCategoryInfo = function (t, block) {
|
||||
t.equal(block.json.category, 'fake test extension');
|
||||
t.equal(block.json.colour, '#111111');
|
||||
t.equal(block.json.colourSecondary, '#222222');
|
||||
t.equal(block.json.colourTertiary, '#333333');
|
||||
t.equal(block.json.style, 'test');
|
||||
t.equal(block.json.inputsInline, true);
|
||||
};
|
||||
|
||||
|
@ -139,12 +137,11 @@ const testButton = function (t, button) {
|
|||
const testReporter = function (t, reporter) {
|
||||
t.equal(reporter.json.type, 'test_reporter');
|
||||
testCategoryInfo(t, reporter);
|
||||
t.equal(reporter.json.checkboxInFlyout, true);
|
||||
t.equal(reporter.json.outputShape, ScratchBlocksConstants.OUTPUT_SHAPE_ROUND);
|
||||
t.equal(reporter.json.output, 'String');
|
||||
t.notOk(Object.prototype.hasOwnProperty.call(reporter.json, 'previousStatement'));
|
||||
t.notOk(Object.prototype.hasOwnProperty.call(reporter.json, 'nextStatement'));
|
||||
t.same(reporter.json.extensions, ['scratch_extension']);
|
||||
t.same(reporter.json.extensions, ['scratch_extension', 'monitor_block']);
|
||||
t.equal(reporter.json.message0, '%1 %2simple text'); // "%1 %2" from the block icon
|
||||
t.notOk(Object.prototype.hasOwnProperty.call(reporter.json, 'message1'));
|
||||
t.same(reporter.json.args0, [
|
||||
|
@ -167,12 +164,11 @@ const testReporter = function (t, reporter) {
|
|||
const testInlineImage = function (t, inlineImage) {
|
||||
t.equal(inlineImage.json.type, 'test_inlineImage');
|
||||
testCategoryInfo(t, inlineImage);
|
||||
t.equal(inlineImage.json.checkboxInFlyout, true);
|
||||
t.equal(inlineImage.json.outputShape, ScratchBlocksConstants.OUTPUT_SHAPE_ROUND);
|
||||
t.equal(inlineImage.json.output, 'String');
|
||||
t.notOk(Object.prototype.hasOwnProperty.call(inlineImage.json, 'previousStatement'));
|
||||
t.notOk(Object.prototype.hasOwnProperty.call(inlineImage.json, 'nextStatement'));
|
||||
t.notOk(inlineImage.json.extensions && inlineImage.json.extensions.length); // OK if it's absent or empty
|
||||
t.same(inlineImage.json.extensions, ['monitor_block']);
|
||||
t.equal(inlineImage.json.message0, 'text and %1'); // block text followed by inline image
|
||||
t.notOk(Object.prototype.hasOwnProperty.call(inlineImage.json, 'message1'));
|
||||
t.same(inlineImage.json.args0, [
|
||||
|
|
|
@ -255,11 +255,11 @@ test('Creating a block comment should emit a project changed event', t => {
|
|||
type: 'comment_create',
|
||||
blockId: 'a new block',
|
||||
commentId: 'a new comment',
|
||||
height: 250,
|
||||
width: 400,
|
||||
xy: {
|
||||
json: {
|
||||
x: -40,
|
||||
y: 27
|
||||
y: 27,
|
||||
height: 250,
|
||||
width: 400
|
||||
},
|
||||
minimized: false,
|
||||
text: 'comment'
|
||||
|
@ -274,11 +274,11 @@ test('Creating a workspace comment should emit a project changed event', t => {
|
|||
type: 'comment_create',
|
||||
blockId: null,
|
||||
commentId: 'a new comment',
|
||||
height: 250,
|
||||
width: 400,
|
||||
xy: {
|
||||
json: {
|
||||
x: -40,
|
||||
y: 27
|
||||
y: 27,
|
||||
height: 250,
|
||||
width: 400
|
||||
},
|
||||
minimized: false,
|
||||
text: 'comment'
|
||||
|
@ -293,11 +293,11 @@ test('Changing a comment should emit a project changed event', t => {
|
|||
type: 'comment_create',
|
||||
blockId: null,
|
||||
commentId: 'a new comment',
|
||||
height: 250,
|
||||
width: 400,
|
||||
xy: {
|
||||
json: {
|
||||
x: -40,
|
||||
y: 27
|
||||
y: 27,
|
||||
height: 250,
|
||||
width: 400
|
||||
},
|
||||
minimized: false,
|
||||
text: 'comment'
|
||||
|
@ -343,11 +343,11 @@ test('Deleting a block comment should emit a project changed event', t => {
|
|||
type: 'comment_create',
|
||||
blockId: 'a new block',
|
||||
commentId: 'a new comment',
|
||||
height: 250,
|
||||
width: 400,
|
||||
xy: {
|
||||
json: {
|
||||
x: -40,
|
||||
y: 27
|
||||
y: 27,
|
||||
height: 250,
|
||||
width: 400
|
||||
},
|
||||
minimized: false,
|
||||
text: 'comment'
|
||||
|
@ -378,11 +378,11 @@ test('Deleting a workspace comment should emit a project changed event', t => {
|
|||
type: 'comment_create',
|
||||
blockId: null,
|
||||
commentId: 'a new comment',
|
||||
height: 250,
|
||||
width: 400,
|
||||
xy: {
|
||||
json: {
|
||||
x: -40,
|
||||
y: 27
|
||||
y: 27,
|
||||
height: 250,
|
||||
width: 400
|
||||
},
|
||||
minimized: false,
|
||||
text: 'comment'
|
||||
|
@ -432,11 +432,11 @@ test('Moving a comment should emit a project changed event', t => {
|
|||
type: 'comment_create',
|
||||
blockId: null,
|
||||
commentId: 'a new comment',
|
||||
height: 250,
|
||||
width: 400,
|
||||
xy: {
|
||||
json: {
|
||||
x: -40,
|
||||
y: 27
|
||||
y: 27,
|
||||
height: 250,
|
||||
width: 400
|
||||
},
|
||||
minimized: false,
|
||||
text: 'comment'
|
||||
|
|
Loading…
Add table
Reference in a new issue