From e3bf012c20b1c6acfdd08569e21f020ea46ae695 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 29 Oct 2018 15:41:43 -0700 Subject: [PATCH 1/2] Use checkboxes instead of dropdowns for generator tests --- tests/generators/index.html | 55 ++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/tests/generators/index.html b/tests/generators/index.html index e1e5a1720..fea98344b 100644 --- a/tests/generators/index.html +++ b/tests/generators/index.html @@ -75,6 +75,7 @@ 'use strict'; var demoWorkspace = null; +var outputCode = ''; function start() { demoWorkspace = Blockly.inject('blocklyDiv', @@ -111,11 +112,11 @@ function loadSelected() { // Clear before adding all of the blocks. demoWorkspace.clear(); - var boxList = document.getElementById('checkboxes'); - var inputChildren = boxList.getElementsByTagName('input'); - for (var i = 0; i < inputChildren.length; i++) { - if (inputChildren[i].checked) { - var testUrl = inputChildren[i].value; + var boxList = document.getElementsByClassName('suite_checkbox'); + console.log(boxList.length); + for (var i = 0; i < boxList.length; i++) { + if (boxList[i].checked) { + var testUrl = boxList[i].value; if (testUrl) { var xmlText = fetchFile(testUrl); if (xmlText !== null) { @@ -195,18 +196,17 @@ function fromXml(filename, xmlText, opt_append) { } function checkAll() { - var boxList = document.getElementById('checkboxes'); - var inputChildren = boxList.getElementsByTagName('input'); - for (var i = 0; i < inputChildren.length; i++) { - inputChildren[i].checked = true; + var boxList = document.getElementsByClassName('suite_checkbox'); + console.log(boxList.length) + for (var i = 0; i < boxList.length; i++) { + boxList[i].checked = true; } } function uncheckAll() { - var boxList = document.getElementById('checkboxes'); - var inputChildren = boxList.getElementsByTagName('input'); - for (var i = 0; i < inputChildren.length; i++) { - inputChildren[i].checked = false; + var boxList = document.getElementsByClassName('suite_checkbox'); + for (var i = 0; i < boxList.length; i++) { + boxList[i].checked = false; } } @@ -229,26 +229,31 @@ function toJavaScript() { var code = '\'use strict\';\n\n' code += Blockly.JavaScript.workspaceToCode(demoWorkspace); setOutput(code); + outputCode = code; } function toPython() { var code = Blockly.Python.workspaceToCode(demoWorkspace); setOutput(code); + outputCode = code; } function toPhp() { var code = Blockly.PHP.workspaceToCode(demoWorkspace); setOutput(code); + outputCode = code; } function toLua() { var code = Blockly.Lua.workspaceToCode(demoWorkspace); setOutput(code); + outputCode = code; } function toDart() { var code = Blockly.Dart.workspaceToCode(demoWorkspace); setOutput(code); + outputCode = code; } function changeIndex() { @@ -392,18 +397,18 @@ h1 {
- -
- Logic
- Loops 1 (repeat, while, foreach)
- Loops 2 (count)
- Loops 3 (continue, break)
- Math
- Text
- Lists
- Colour
- Variables
- Functions
+ +
+ Logic
+ Loops 1 (repeat, while, foreach)
+ Loops 2 (count)
+ Loops 3 (continue, break)
+ Math
+ Text
+ Lists
+ Colour
+ Variables
+ Functions

From 29e836770d4c41ffe28cb10559a87b3a4ef8f02e Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 31 Oct 2018 15:05:28 -0700 Subject: [PATCH 2/2] Remove bad classes --- tests/generators/index.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/generators/index.html b/tests/generators/index.html index fea98344b..dbff605dc 100644 --- a/tests/generators/index.html +++ b/tests/generators/index.html @@ -113,7 +113,6 @@ function loadSelected() { demoWorkspace.clear(); var boxList = document.getElementsByClassName('suite_checkbox'); - console.log(boxList.length); for (var i = 0; i < boxList.length; i++) { if (boxList[i].checked) { var testUrl = boxList[i].value; @@ -197,7 +196,6 @@ function fromXml(filename, xmlText, opt_append) { function checkAll() { var boxList = document.getElementsByClassName('suite_checkbox'); - console.log(boxList.length) for (var i = 0; i < boxList.length; i++) { boxList[i].checked = true; } @@ -397,8 +395,8 @@ h1 {

- -
+ +
Logic
Loops 1 (repeat, while, foreach)
Loops 2 (count)