Skip to content
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
1 change: 1 addition & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
navigation test blocks
</option>
<option value="moveTestBlocks">move test blocks</option>
<option value="comments">comments</option>
</select>
</div>
<div>
Expand Down
122 changes: 119 additions & 3 deletions test/loadTestBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,121 @@ const moveTestBlocks = {
},
};

const comments = {
'workspaceComments': [
{
'height': 100,
'width': 146.63990783691406,
'id': 'workspace_comment_1',
'x': 96.5390625,
'y': 531.42578125,
'text': 'Workspace comment',
},
],
'blocks': {
'languageVersion': 0,
'blocks': [
{
'type': 'p5_setup',
'id': 'p5_setup_1',
'x': 0,
'y': 75,
'deletable': false,
'inputs': {
'STATEMENTS': {
'block': {
'type': 'p5_canvas',
'id': 'create_canvas_1',
'deletable': false,
'movable': false,
'fields': {
'WIDTH': 400,
'HEIGHT': 400,
},
'next': {
'block': {
'type': 'p5_background_color',
'id': 'set_background_color_1',
'inputs': {
'COLOR': {
'shadow': {
'type': 'colour_picker',
'id': 'set_background_color_1_color',
'fields': {
'COLOUR': '#9999ff',
},
},
},
},
},
},
},
},
},
},
{
'type': 'p5_draw',
'id': 'p5_draw_1',
'x': 0,
'y': 332,
'deletable': false,
'inputs': {
'STATEMENTS': {
'block': {
'type': 'simple_circle',
'id': 'draw_circle_1',
'icons': {
'comment': {
'text': 'Pinned block comment',
'pinned': true,
'height': 80,
'width': 160,
},
},
'inputs': {
'COLOR': {
'shadow': {
'type': 'colour_picker',
'id': 'draw_circle_1_color',
'fields': {
'COLOUR': '#ffff00',
},
},
},
},
'next': {
'block': {
'type': 'simple_circle',
'id': 'draw_circle_2',
'icons': {
'comment': {
'text': 'Unpinned block comment',
'pinned': false,
'height': 80,
'width': 160,
},
},
'inputs': {
'COLOR': {
'shadow': {
'type': 'colour_picker',
'id': 'draw_circle_2_color',
'fields': {
'COLOUR': '#000000',
},
},
},
},
},
},
},
},
},
},
],
},
};

/**
* Loads saved state from local storage into the given workspace.
* @param {Blockly.Workspace} workspace Blockly workspace to load into.
Expand All @@ -870,11 +985,12 @@ const moveTestBlocks = {
export const load = function (workspace, scenarioString) {
const scenarioMap = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alphabetised so I don't have to think too hard where new ones go.

'blank': blankCanvas,
'sun': sunnyDay,
'simpleCircle': simpleCircle,
'comments': comments,
'moreBlocks': moreBlocks,
'navigationTestBlocks': navigationTestBlocks,
'moveTestBlocks': moveTestBlocks,
'navigationTestBlocks': navigationTestBlocks,
'simpleCircle': simpleCircle,
'sun': sunnyDay,
};

const data = JSON.stringify(scenarioMap[scenarioString]);
Expand Down