This commit is contained in:
Rachel Fenichel
2017-12-06 15:56:18 -08:00
parent 399f1a5c11
commit be4054b593
5 changed files with 23 additions and 26 deletions

View File

@@ -25,9 +25,9 @@
<script src="utils_test.js"></script>
<script src="variable_map_test.js"></script>
<script src="variable_model_test.js"></script>
<script src="widget_div_test.js"></script>
<script src="workspace_test.js"></script>
<script src="workspace_undo_redo_test.js"></script>
<script src="widget_div_test.js"></script>
<script src="xml_test.js"></script>
</body>
</html>

View File

@@ -37,7 +37,6 @@ function proceduresTest_setUpWithMockBlocks() {
'message0': '%1',
'args0': [
{
// TODO: Why is this a variable? It shouldn't need to be.
'type': 'field_variable',
'name': 'NAME',
'variable': 'item'

View File

@@ -122,3 +122,21 @@ function createVariableAndBlock(workspace) {
workspace.createVariable('name1', 'type1', 'id1');
createMockBlock('id1');
}
function defineGetVarBlock() {
Blockly.defineBlocksWithJsonArray([{
"type": "get_var_block",
"message0": "%1",
"args0": [
{
"type": "field_variable",
"name": "VAR",
"variableTypes": ["", "type1", "type2"]
}
]
}]);
}
function undefineGetVarBlock() {
delete Blockly.Blocks['get_var_block'];
}

View File

@@ -26,23 +26,13 @@ var workspace;
var mockControl_;
function workspaceTest_setUp() {
Blockly.defineBlocksWithJsonArray([{
"type": "get_var_block",
"message0": "%1",
"args0": [
{
"type": "field_variable",
"name": "VAR",
"variableTypes": ["", "type1", "type2"]
}
]
}]);
defineGetVarBlock();
workspace = new Blockly.Workspace();
mockControl_ = new goog.testing.MockControl();
}
function workspaceTest_tearDown() {
delete Blockly.Blocks['get_var_block'];
undefineGetVarBlock();
mockControl_.$tearDown();
workspace.dispose();
}

View File

@@ -43,24 +43,14 @@ function temporary_fireEvent(event) {
}
function undoRedoTest_setUp() {
Blockly.defineBlocksWithJsonArray([{
"type": "get_var_block",
"message0": "%1",
"args0": [
{
"type": "field_variable",
"name": "VAR",
"variableTypes": ["", "type1", "type2"]
}
]
}]);
defineGetVarBlock();
workspace = new Blockly.Workspace();
mockControl_ = new goog.testing.MockControl();
Blockly.Events.fire = temporary_fireEvent;
}
function undoRedoTest_tearDown() {
delete Blockly.Blocks['get_var_block'];
undefineGetVarBlock();
mockControl_.$tearDown();
workspace.dispose();
Blockly.Events.fire = savedFireFunc;