diff --git a/.eslintignore b/.eslintignore index 5131e6201..22c20bea9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,9 +2,13 @@ *_uncompressed*.js /msg/* /core/css.js +/tests/blocks/* +/tests/compile/* /tests/jsunit/* /tests/generators/* +/tests/workspace_svg/* /generators/* /demos/* /accessible/* -/appengine/* \ No newline at end of file +/appengine/* +/externs/svg-externs.js diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 888f9c3f2..f0bd0b762 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,57 +1,73 @@ -Thanks for opening an issue for us! Before you open an issue, please check if a similar issue exists or has been closed before. - -If you're asking a question about how to use Blockly in your application, please ask questions on the [mailing list](https://groups.google.com/forum/#!forum/blockly) instead of filing issues. - -_Please delete the above section and the instructions in the sections below before submitting. If a section is not applicable, type "N/A" in that section._ + ### Problem statement -_Remove this hint: these checkboxes can be checked like this: [x]_ - -- [ ] Bug report -- [ ] Feature request - -_What were you trying to do when you hit this bug? Or, what do you want to do with Blockly that your proposed feature would enable?_ + ### Expected Behavior -_Please describe what should happen. Include screenshots if applicable._ + ### Actual Behavior -_Describe what actually happens. Include screenshots if applicable._ + ### Steps to Reproduce -_Explain what someone needs to do in order to see what's described in *Actual behavior* above_ + + +1. Start by.. +2. Next, do.. ### Stack Traces -``` -Please open up the console. If you see any Blockly-related errors, paste them here. + -Ignore any instances of "Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause()." +``` +Replace with error stack trace. ``` ### Operating System and Browser -_Remove this hint: these checkboxes can be checked like this: [x]_ + -- [ ] Desktop: - - [ ] Chrome - - [ ] Firefox - - [ ] Safari - - [ ] Opera - - [ ] IE 10+ - - [ ] IE 11 - - [ ] EDGE + + + + + + + -- [ ] Smartphone/Tablet/Chromebook (please complete the following information): - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + ### Additional Information -_Anything else we should know?_ + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 511a5fe8a..c828f5842 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,12 @@ -Thanks for submitting code to Blockly! Please fill out the following as part of your pull request so we can review your code more easily. + ## The basics + + - [ ] I branched from develop - [ ] My pull request is against develop - [ ] My code follows the [style guide](https://developers.google.com/blockly/guides/modify/web/style-guide) @@ -9,37 +14,40 @@ Thanks for submitting code to Blockly! Please fill out the following as part of ## The details ### Resolves -_What Github issue does this resolve (please include link)?_ + ### Proposed Changes -_Describe what this Pull Request does. Include screenshots if applicable._ + ### Reason for Changes -_Explain why these changes should be made. Include screenshots if applicable._ + ### Test Coverage -_Please show how you have added tests to cover your changes, or tell us how you tested it and on which platforms. If it's plaform-agnostic you can delete these checkboxes._ + Tested on: -_Remove this hint: these checkboxes can be checked like this: [x]_ -- [ ] Desktop: - - [ ] Chrome - - [ ] Firefox - - [ ] Safari - - [ ] Opera - - [ ] IE 10+ - - [ ] IE 11 - - [ ] EDGE + + + + + + + + + -- [ ] Smartphone/Tablet/Chromebook (please complete the following information): - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - ### Additional Information -_Anything else we should know?_ + diff --git a/.gitignore b/.gitignore index 4216e2f62..0dce6535c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ npm-debug.log *.pyc *.komodoproject /nbproject/private/ + +tests/compile/main_compressed.js +tests/compile/*compiler*.jar diff --git a/.travis.yml b/.travis.yml index bbc6cfcb8..b370eb809 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,16 +15,19 @@ matrix: before_install: - npm install google-closure-library +- npm install google-closure-compiler - npm install webdriverio # Symlink closure library - ln -s $(npm root)/google-closure-library ../closure-library before_script: - export DISPLAY=:99.0 - - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( scripts/setup_linux_env.sh ) fi - - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( scripts/setup_osx_env.sh ) fi + - if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi + - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( tests/scripts/setup_osx_env.sh ) fi - sleep 2 script: - set -x + - npm run lint - npm test + - cd tests/compile; compile.sh; cd .. diff --git a/blockly_accessible_compressed.js b/blockly_accessible_compressed.js index d3e0380ac..58f17d19c 100644 --- a/blockly_accessible_compressed.js +++ b/blockly_accessible_compressed.js @@ -10,36 +10,39 @@ goog.module=function(a){if(!goog.isString(a)||!a||-1==a.search(goog.VALID_MODULE goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)};goog.module.getInternal_=function(a){if(!COMPILED){if(a in goog.loadedModules_)return goog.loadedModules_[a];if(!goog.implicitNamespaces_[a])return a=goog.getObjectByName(a),null!=a?a:null}return null};goog.moduleLoaderState_=null; goog.isInModuleLoader_=function(){return null!=goog.moduleLoaderState_};goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0}; goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.forwardDeclare=function(a){};COMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&goog.isDefAndNotNull(goog.getObjectByName(a))},goog.implicitNamespaces_={"goog.module":!0}); -goog.getObjectByName=function(a,b){a=a.split(".");b=b||goog.global;for(var c=0;c\x3c/script>')},goog.appendScriptSrcNode_=function(a){var b=goog.global.document,c=b.createElement("script"); -c.type="text/javascript";c.src=a;c.defer=!1;c.async=!1;b.head.appendChild(c)},goog.writeScriptTag_=function(a,b){if(goog.inHtmlDocument_()){var c=goog.global.document;if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&"complete"==c.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}void 0===b?goog.IS_OLD_IE_?(goog.oldIeWaiting_=!0,b=" onreadystatechange='goog.onScriptLoad_(this, "+ ++goog.lastNonModuleScriptIndex_+")' ",c.write(' @@ -49,41 +49,40 @@ diff --git a/demos/minimap/minimap.js b/demos/minimap/minimap.js index 4ac687e39..6803d41f2 100644 --- a/demos/minimap/minimap.js +++ b/demos/minimap/minimap.js @@ -1,46 +1,46 @@ /** -* Blockly Demos: Code -* -* Copyright 2017 Google Inc. -* https://developers.google.com/blockly/ -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Blockly Demos: Minimap + * + * Copyright 2017 Google Inc. + * https://developers.google.com/blockly/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** -* @fileoverview JavaScript for Blockly's Minimap demo. -* @author karnpurohit@gmail.com (Karan Purohit) -*/ + * @fileoverview JavaScript for Blockly's Minimap demo. + * @author karnpurohit@gmail.com (Karan Purohit) + */ 'use strict'; /** -* Creating a seperate namespace for minimap. -*/ + * Creating a separate namespace for minimap. + */ var Minimap = {}; /** -* Initilize the workspace and minimap. -* @param {Workspace} workspace The main workspace of the user. -* @param {Workspace} minimap The workspace that will be used as a minimap. -*/ -Minimap.init = function(workspace, minimap){ + * Initialize the workspace and minimap. + * @param {!Workspace} workspace The main workspace of the user. + * @param {!Workspace} minimap The workspace that will be used as a minimap. + */ +Minimap.init = function(workspace, minimap) { this.workspace = workspace; this.minimap = minimap; - //Adding scroll callback functionlity to vScroll and hScroll just for this demo. - //IMPORTANT: This should be changed when there is proper UI event handling - // api available and should be handled by workspace's event listeners. - this.workspace.scrollbar.vScroll.setHandlePosition = function(newPosition){ + // Adding scroll callback functionality to vScroll and hScroll just for this demo. + // IMPORTANT: This should be changed when there is proper UI event handling + // API available and should be handled by workspace's event listeners. + this.workspace.scrollbar.vScroll.setHandlePosition = function(newPosition) { this.handlePosition_ = newPosition; this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_); @@ -55,7 +55,7 @@ Minimap.init = function(workspace, minimap){ }; // Adding call back for horizontal scroll. - this.workspace.scrollbar.hScroll.setHandlePosition = function(newPosition){ + this.workspace.scrollbar.hScroll.setHandlePosition = function(newPosition) { this.handlePosition_ = newPosition; this.svgHandle_.setAttribute(this.positionAttribute_, this.handlePosition_); @@ -71,7 +71,7 @@ Minimap.init = function(workspace, minimap){ // Required to stop a positive feedback loop when user clicks minimap - // and the scroll changes, which inturn may change minimap. + // and the scroll changes, which in turn may change minimap. this.disableScrollChange = false; // Listen to events on the main workspace. @@ -95,9 +95,9 @@ Minimap.init = function(workspace, minimap){ // Creating a rectangle in the minimap that represents current view. Blockly.utils.createSvgElement('rect', { - 'width':100, - 'height':100, - 'class':'mapDragger' + 'width': 100, + 'height': 100, + 'class': 'mapDragger' }, this.svg); // Rectangle in the minimap that represents current view. @@ -105,7 +105,7 @@ Minimap.init = function(workspace, minimap){ // Adding mouse events to the rectangle, to make it Draggable. // Using Blockly.bindEvent_ to attach mouse/touch listeners. - Blockly.bindEvent_(this.mapDragger, "mousedown", null, Minimap.mousedown); + Blockly.bindEvent_(this.mapDragger, 'mousedown', null, Minimap.mousedown); //When the window change, we need to resize the minimap window. window.addEventListener('resize', Minimap.repositionMinimap); @@ -113,20 +113,22 @@ Minimap.init = function(workspace, minimap){ // Mouse up event for the minimap. this.svg.addEventListener('mouseup', Minimap.updateMapDragger); - //Boolen to check whether I am dragging the surface or not. + //Boolean to check whether I am dragging the surface or not. this.isDragging = false; }; -Minimap.mousedown = function(e){ +Minimap.mousedown = function(e) { // Using Blockly.bindEvent_ to attach mouse/touch listeners. - Minimap.mouseMoveBindData = Blockly.bindEvent_(document,"mousemove", null, Minimap.mousemove); - Minimap.mouseUpBindData = Blockly.bindEvent_(document,"mouseup", null, Minimap.mouseup); + Minimap.mouseMoveBindData = + Blockly.bindEvent_(document, 'mousemove', null, Minimap.mousemove); + Minimap.mouseUpBindData = + Blockly.bindEvent_(document, 'mouseup', null, Minimap.mouseup); - Minimap.isDragging=true; + Minimap.isDragging = true; e.stopPropagation(); }; -Minimap.mouseup = function(e){ +Minimap.mouseup = function(e) { Minimap.isDragging = false; // Removing listeners. Blockly.unbindEvent_(Minimap.mouseUpBindData); @@ -135,18 +137,18 @@ Minimap.mouseup = function(e){ e.stopPropagation(); }; -Minimap.mousemove = function(e){ - if(Minimap.isDragging){ +Minimap.mousemove = function(e) { + if (Minimap.isDragging) { Minimap.updateMapDragger(e); e.stopPropagation(); } }; /** -* Initilize the workspace and minimap. -* @param {Event} event Event that triggered in the main workspace. -*/ -Minimap.mirrorEvent = function(event){ + * Run non-UI events from the main workspace on the minimap. + * @param {!Event} event Event that triggered in the main workspace. + */ +Minimap.mirrorEvent = function(event) { if (event.type == Blockly.Events.UI) { return; // Don't mirror UI events. } @@ -161,146 +163,152 @@ Minimap.mirrorEvent = function(event){ }; /** -* Called when window is resized. Repositions the minimap overlay. -*/ -Minimap.repositionMinimap = function(){ + * Called when window is resized. Repositions the minimap overlay. + */ +Minimap.repositionMinimap = function() { Minimap.rect = document.getElementById('mapDiv').getBoundingClientRect(); Minimap.svg.style.top = Minimap.rect.top + 'px'; Minimap.svg.style.left = Minimap.rect.left + 'px'; }; /** -* Updates the rectangle's height . -*/ -Minimap.setDraggerHeight = function(){ + * Updates the rectangle's height. + */ +Minimap.setDraggerHeight = function() { var workspaceMetrics = Minimap.workspace.getMetrics(); - var draggerHeight = (workspaceMetrics.viewHeight / Minimap.workspace.scale) * Minimap.minimap.scale; + var draggerHeight = (workspaceMetrics.viewHeight / Minimap.workspace.scale) * + Minimap.minimap.scale; // It's zero when first block is placed. - if(draggerHeight == 0){ + if (draggerHeight == 0) { return; } - Minimap.mapDragger.setAttribute("height", draggerHeight); + Minimap.mapDragger.setAttribute('height', draggerHeight); }; /** -* Updates the rectangle's width. -*/ -Minimap.setDraggerWidth = function(){ + * Updates the rectangle's width. + */ +Minimap.setDraggerWidth = function() { var workspaceMetrics = Minimap.workspace.getMetrics(); - var draggerWidth = (workspaceMetrics.viewWidth / Minimap.workspace.scale) * Minimap.minimap.scale; + var draggerWidth = (workspaceMetrics.viewWidth / Minimap.workspace.scale) * + Minimap.minimap.scale; // It's zero when first block is placed. - if(draggerWidth == 0){ + if (draggerWidth == 0) { return; } - Minimap.mapDragger.setAttribute("width", draggerWidth); + Minimap.mapDragger.setAttribute('width', draggerWidth); }; /** -* Updates the overall position of the viewport of the minimap by appropriately -* using translate functions. -*/ -Minimap.scaleMinimap = function(){ + * Updates the overall position of the viewport of the minimap by appropriately + * using translate functions. + */ +Minimap.scaleMinimap = function() { var minimapBoundingBox = Minimap.minimap.getBlocksBoundingBox(); var workspaceBoundingBox = Minimap.workspace.getBlocksBoundingBox(); var workspaceMetrics = Minimap.workspace.getMetrics(); var minimapMetrics = Minimap.minimap.getMetrics(); - //Scaling the mimimap such that all the blocks can be seen in the viewport. - //This padding is default because this is how to scrollbar(in main workspace) is implemented. - var topPadding = (workspaceMetrics.viewHeight) * Minimap.minimap.scale / (2 * Minimap.workspace.scale); - var sidePadding = (workspaceMetrics.viewWidth) * Minimap.minimap.scale / (2 * Minimap.workspace.scale); + // Scaling the mimimap such that all the blocks can be seen in the viewport. + // This padding is default because this is how to scrollbar(in main workspace) + // is implemented. + var topPadding = (workspaceMetrics.viewHeight) * Minimap.minimap.scale / + (2 * Minimap.workspace.scale); + var sidePadding = (workspaceMetrics.viewWidth) * Minimap.minimap.scale / + (2 * Minimap.workspace.scale); - // If actual padding is more than half view ports height, change it to actual padding. - if((workspaceBoundingBox.y * Minimap.workspace.scale - workspaceMetrics.contentTop) - * Minimap.minimap.scale / Minimap.workspace.scale > topPadding){ - topPadding = (workspaceBoundingBox.y * Minimap.workspace.scale - workspaceMetrics.contentTop) - * Minimap.minimap.scale / Minimap.workspace.scale; + // If actual padding is more than half view ports height, + // change it to actual padding. + if ((workspaceBoundingBox.y * Minimap.workspace.scale - + workspaceMetrics.contentTop) * + Minimap.minimap.scale / Minimap.workspace.scale > topPadding) { + topPadding = (workspaceBoundingBox.y * Minimap.workspace.scale - + workspaceMetrics.contentTop) * + Minimap.minimap.scale / Minimap.workspace.scale; } - // If actual padding is more than half view ports height, change it to actual padding. - if((workspaceBoundingBox.x * Minimap.workspace.scale - workspaceMetrics.contentLeft) - * Minimap.minimap.scale / Minimap.workspace.scale > sidePadding){ - sidePadding = (workspaceBoundingBox.x * Minimap.workspace.scale - workspaceMetrics.contentLeft) - * Minimap.minimap.scale / Minimap.workspace.scale; + // If actual padding is more than half view ports height, + // change it to actual padding. + if ((workspaceBoundingBox.x * Minimap.workspace.scale - + workspaceMetrics.contentLeft) * + Minimap.minimap.scale / Minimap.workspace.scale > sidePadding) { + sidePadding = (workspaceBoundingBox.x * Minimap.workspace.scale - + workspaceMetrics.contentLeft) * + Minimap.minimap.scale / Minimap.workspace.scale; } - var scalex = (minimapMetrics.viewWidth - 2 * sidePadding) / minimapBoundingBox.width; - var scaley = (minimapMetrics.viewHeight - 2 * topPadding) / minimapBoundingBox.height; + var scalex = (minimapMetrics.viewWidth - 2 * sidePadding) / + minimapBoundingBox.width; + var scaley = (minimapMetrics.viewHeight - 2 * topPadding) / + minimapBoundingBox.height; Minimap.minimap.setScale(Math.min(scalex, scaley)); // Translating the minimap. - Minimap.minimap.translate( - minimapMetrics.contentLeft * Minimap.minimap.scale + sidePadding, - - minimapMetrics.contentTop * Minimap.minimap.scale + topPadding); + Minimap.minimap.translate( + -minimapMetrics.contentLeft * Minimap.minimap.scale + sidePadding, + -minimapMetrics.contentTop * Minimap.minimap.scale + topPadding); }; /** -* Handles the onclick event on the minimapBoundingBox. Changes mapDraggers position. -* @param {Event} e Event from the mouse click. -*/ -Minimap.updateMapDragger = function(e){ + * Handles the onclick event on the minimapBoundingBox. + * Changes mapDraggers position. + * @param {!Event} e Event from the mouse click. + */ +Minimap.updateMapDragger = function(e) { var y = e.clientY; var x = e.clientX; - var draggerHeight = Minimap.mapDragger.getAttribute("height"); - var draggerWidth = Minimap.mapDragger.getAttribute("width"); + var draggerHeight = Minimap.mapDragger.getAttribute('height'); + var draggerWidth = Minimap.mapDragger.getAttribute('width'); var finalY = y - Minimap.rect.top - draggerHeight / 2; var finalX = x - Minimap.rect.left - draggerWidth / 2; - var maxValidY = (Minimap.workspace.getMetrics().contentHeight - Minimap.workspace.getMetrics().viewHeight) - * Minimap.minimap.scale; - var maxValidX = (Minimap.workspace.getMetrics().contentWidth - Minimap.workspace.getMetrics().viewWidth) - * Minimap.minimap.scale; + var maxValidY = (Minimap.workspace.getMetrics().contentHeight - + Minimap.workspace.getMetrics().viewHeight) * Minimap.minimap.scale; + var maxValidX = (Minimap.workspace.getMetrics().contentWidth - + Minimap.workspace.getMetrics().viewWidth) * Minimap.minimap.scale; - if(y + draggerHeight / 2 > Minimap.rect.bottom){ + if (y + draggerHeight / 2 > Minimap.rect.bottom) { finalY = Minimap.rect.bottom - Minimap.rect.top - draggerHeight; - }else if(y < Minimap.rect.top + draggerHeight / 2){ + } else if (y < Minimap.rect.top + draggerHeight / 2) { finalY = 0; } - if(x + draggerWidth / 2 > Minimap.rect.right){ + if (x + draggerWidth / 2 > Minimap.rect.right) { finalX = Minimap.rect.right - Minimap.rect.left - draggerWidth; - }else if(x < Minimap.rect.left + draggerWidth / 2){ + } else if (x < Minimap.rect.left + draggerWidth / 2) { finalX = 0; } // Do not go below lower bound of scrollbar. - if(finalY > maxValidY){ + if (finalY > maxValidY) { finalY = maxValidY; } - - if(finalX > maxValidX){ + if (finalX > maxValidX) { finalX = maxValidX; } - Minimap.mapDragger.setAttribute("y", finalY); - Minimap.mapDragger.setAttribute("x", finalX); + Minimap.mapDragger.setAttribute('y', finalY); + Minimap.mapDragger.setAttribute('x', finalX); // Required, otherwise creates a feedback loop. Minimap.disableScrollChange = true; - Minimap.workspace.scrollbar.vScroll.set((finalY * Minimap.workspace.scale) / Minimap.minimap.scale); - Minimap.workspace.scrollbar.hScroll.set((finalX * Minimap.workspace.scale) / Minimap.minimap.scale); + Minimap.workspace.scrollbar.vScroll.set((finalY * Minimap.workspace.scale) / + Minimap.minimap.scale); + Minimap.workspace.scrollbar.hScroll.set((finalX * Minimap.workspace.scale) / + Minimap.minimap.scale); Minimap.disableScrollChange = false; }; /** -* Handles the onclick event on the minimapBoundingBox, paramaters are passed by -* the event handler. -* @param {Float} position This is the absolute postion of the scrollbar. -* @param {boolean} horizontal Informs if the change event if for horizontal(true) -* scrollbar or vertical(false) scrollbar. -*/ -Minimap.onScrollChange = function(position, horizontal){ - - if(Minimap.disableScrollChange){ - return; - } - - var newDraggerPosition = (position * Minimap.minimap.scale / Minimap.workspace.scale); - if(horizontal){ - // Change the horizontal position of dragger. - Minimap.mapDragger.setAttribute("x", newDraggerPosition); - } - else{ - // Change the vertical position of dragger. - Minimap.mapDragger.setAttribute("y", newDraggerPosition); + * Handles the onclick event on the minimapBoundingBox, parameters are passed by + * the event handler. + * @param {number} position This is the absolute position of the scrollbar. + * @param {boolean} horizontal Informs if the change event if for + * horizontal (true) or vertical (false) scrollbar. + */ +Minimap.onScrollChange = function(position, horizontal) { + if (!Minimap.disableScrollChange) { + Minimap.mapDragger.setAttribute(horizontal ? 'x' : 'y', + position * Minimap.minimap.scale / Minimap.workspace.scale); } }; diff --git a/generators/dart/procedures.js b/generators/dart/procedures.js index fad15c211..7e61ab56c 100644 --- a/generators/dart/procedures.js +++ b/generators/dart/procedures.js @@ -47,7 +47,7 @@ Blockly.Dart['procedures_defreturn'] = function(block) { var returnValue = Blockly.Dart.valueToCode(block, 'RETURN', Blockly.Dart.ORDER_NONE) || ''; if (returnValue) { - returnValue = ' return ' + returnValue + ';\n'; + returnValue = Blockly.Dart.INDENT + 'return ' + returnValue + ';\n'; } var returnType = returnValue ? 'dynamic' : 'void'; var args = []; @@ -101,9 +101,9 @@ Blockly.Dart['procedures_ifreturn'] = function(block) { if (block.hasReturnValue_) { var value = Blockly.Dart.valueToCode(block, 'VALUE', Blockly.Dart.ORDER_NONE) || 'null'; - code += ' return ' + value + ';\n'; + code += Blockly.Dart.INDENT + 'return ' + value + ';\n'; } else { - code += ' return;\n'; + code += Blockly.Dart.INDENT + 'return;\n'; } code += '}\n'; return code; diff --git a/generators/javascript/procedures.js b/generators/javascript/procedures.js index aaab94350..7ed4da794 100644 --- a/generators/javascript/procedures.js +++ b/generators/javascript/procedures.js @@ -47,7 +47,7 @@ Blockly.JavaScript['procedures_defreturn'] = function(block) { var returnValue = Blockly.JavaScript.valueToCode(block, 'RETURN', Blockly.JavaScript.ORDER_NONE) || ''; if (returnValue) { - returnValue = ' return ' + returnValue + ';\n'; + returnValue = Blockly.JavaScript.INDENT + 'return ' + returnValue + ';\n'; } var args = []; for (var i = 0; i < block.arguments_.length; i++) { @@ -101,9 +101,9 @@ Blockly.JavaScript['procedures_ifreturn'] = function(block) { if (block.hasReturnValue_) { var value = Blockly.JavaScript.valueToCode(block, 'VALUE', Blockly.JavaScript.ORDER_NONE) || 'null'; - code += ' return ' + value + ';\n'; + code += Blockly.JavaScript.INDENT + 'return ' + value + ';\n'; } else { - code += ' return;\n'; + code += Blockly.JavaScript.INDENT + 'return;\n'; } code += '}\n'; return code; diff --git a/generators/lua/procedures.js b/generators/lua/procedures.js index 92e7b4da2..07626b65a 100644 --- a/generators/lua/procedures.js +++ b/generators/lua/procedures.js @@ -47,7 +47,7 @@ Blockly.Lua['procedures_defreturn'] = function(block) { var returnValue = Blockly.Lua.valueToCode(block, 'RETURN', Blockly.Lua.ORDER_NONE) || ''; if (returnValue) { - returnValue = ' return ' + returnValue + '\n'; + returnValue = Blockly.Lua.INDENT + 'return ' + returnValue + '\n'; } else if (!branch) { branch = ''; } @@ -103,9 +103,9 @@ Blockly.Lua['procedures_ifreturn'] = function(block) { if (block.hasReturnValue_) { var value = Blockly.Lua.valueToCode(block, 'VALUE', Blockly.Lua.ORDER_NONE) || 'nil'; - code += ' return ' + value + '\n'; + code += Blockly.Lua.INDENT + 'return ' + value + '\n'; } else { - code += ' return\n'; + code += Blockly.Lua.INDENT + 'return\n'; } code += 'end\n'; return code; diff --git a/generators/php/procedures.js b/generators/php/procedures.js index 10569268d..d2aafc3d8 100644 --- a/generators/php/procedures.js +++ b/generators/php/procedures.js @@ -43,7 +43,7 @@ Blockly.PHP['procedures_defreturn'] = function(block) { Blockly.Variables.NAME_TYPE)); } } - globals = globals.length ? ' global ' + globals.join(', ') + ';\n' : ''; + globals = globals.length ? Blockly.PHP.INDENT + 'global ' + globals.join(', ') + ';\n' : ''; var funcName = Blockly.PHP.variableDB_.getName( block.getFieldValue('NAME'), Blockly.Procedures.NAME_TYPE); @@ -61,7 +61,7 @@ Blockly.PHP['procedures_defreturn'] = function(block) { var returnValue = Blockly.PHP.valueToCode(block, 'RETURN', Blockly.PHP.ORDER_NONE) || ''; if (returnValue) { - returnValue = ' return ' + returnValue + ';\n'; + returnValue = Blockly.PHP.INDENT + 'return ' + returnValue + ';\n'; } var args = []; for (var i = 0; i < block.arguments_.length; i++) { @@ -115,9 +115,9 @@ Blockly.PHP['procedures_ifreturn'] = function(block) { if (block.hasReturnValue_) { var value = Blockly.PHP.valueToCode(block, 'VALUE', Blockly.PHP.ORDER_NONE) || 'null'; - code += ' return ' + value + ';\n'; + code += Blockly.PHP.INDENT + 'return ' + value + ';\n'; } else { - code += ' return;\n'; + code += Blockly.PHP.INDENT + 'return;\n'; } code += '}\n'; return code; diff --git a/generators/python/procedures.js b/generators/python/procedures.js index 506482d17..0670f9d64 100644 --- a/generators/python/procedures.js +++ b/generators/python/procedures.js @@ -44,7 +44,7 @@ Blockly.Python['procedures_defreturn'] = function(block) { Blockly.Variables.NAME_TYPE)); } } - globals = globals.length ? ' global ' + globals.join(', ') + '\n' : ''; + globals = globals.length ? Blockly.Python.INDENT + 'global ' + globals.join(', ') + '\n' : ''; var funcName = Blockly.Python.variableDB_.getName(block.getFieldValue('NAME'), Blockly.Procedures.NAME_TYPE); var branch = Blockly.Python.statementToCode(block, 'STACK'); @@ -61,7 +61,7 @@ Blockly.Python['procedures_defreturn'] = function(block) { var returnValue = Blockly.Python.valueToCode(block, 'RETURN', Blockly.Python.ORDER_NONE) || ''; if (returnValue) { - returnValue = ' return ' + returnValue + '\n'; + returnValue = Blockly.Python.INDENT + 'return ' + returnValue + '\n'; } else if (!branch) { branch = Blockly.Python.PASS; } @@ -117,9 +117,9 @@ Blockly.Python['procedures_ifreturn'] = function(block) { if (block.hasReturnValue_) { var value = Blockly.Python.valueToCode(block, 'VALUE', Blockly.Python.ORDER_NONE) || 'None'; - code += ' return ' + value + '\n'; + code += Blockly.Python.INDENT + 'return ' + value + '\n'; } else { - code += ' return\n'; + code += Blockly.Python.INDENT + 'return\n'; } return code; }; diff --git a/javascript_compressed.js b/javascript_compressed.js index da860030b..027f2df19 100644 --- a/javascript_compressed.js +++ b/javascript_compressed.js @@ -70,10 +70,10 @@ Blockly.JavaScript.math_constrain=function(a){var b=Blockly.JavaScript.valueToCo Blockly.JavaScript.math_random_int=function(a){var b=Blockly.JavaScript.valueToCode(a,"FROM",Blockly.JavaScript.ORDER_COMMA)||"0";a=Blockly.JavaScript.valueToCode(a,"TO",Blockly.JavaScript.ORDER_COMMA)||"0";return[Blockly.JavaScript.provideFunction_("mathRandomInt",["function "+Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);", "}"])+"("+b+", "+a+")",Blockly.JavaScript.ORDER_FUNCTION_CALL]};Blockly.JavaScript.math_random_float=function(a){return["Math.random()",Blockly.JavaScript.ORDER_FUNCTION_CALL]};Blockly.JavaScript.procedures={}; Blockly.JavaScript.procedures_defreturn=function(a){var b=Blockly.JavaScript.variableDB_.getName(a.getFieldValue("NAME"),Blockly.Procedures.NAME_TYPE),c=Blockly.JavaScript.statementToCode(a,"STACK");if(Blockly.JavaScript.STATEMENT_PREFIX){var d=a.id.replace(/\$/g,"$$$$");c=Blockly.JavaScript.prefixLines(Blockly.JavaScript.STATEMENT_PREFIX.replace(/%1/g,"'"+d+"'"),Blockly.JavaScript.INDENT)+c}Blockly.JavaScript.INFINITE_LOOP_TRAP&&(c=Blockly.JavaScript.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+a.id+"'")+ -c);(d=Blockly.JavaScript.valueToCode(a,"RETURN",Blockly.JavaScript.ORDER_NONE)||"")&&(d=" return "+d+";\n");for(var e=[],f=0;f", - "lastupdated": "2017-09-26 13:14:31.417792", + "lastupdated": "2017-11-13 14:55:14.026613", "locale": "en", "messagedocumentation" : "qqq" }, diff --git a/msg/json/qqq.json b/msg/json/qqq.json index 71e70e37a..7c6abd540 100644 --- a/msg/json/qqq.json +++ b/msg/json/qqq.json @@ -1,13 +1,4 @@ { - "@metadata": { - "authors": [ - "Espertus", - "Liuxinyu970226", - "Metalhead64", - "Robby", - "Shirayuki" - ] - }, "VARIABLES_DEFAULT_NAME": "default name - A simple, general default name for a variable, preferably short. For more context, see [[Translating:Blockly#infrequent_message_types]].\n{{Identical|Item}}", "TODAY": "button text - Button that sets a calendar to today's date.\n{{Identical|Today}}", "DUPLICATE_BLOCK": "context menu - Make a copy of the selected block (and any blocks it contains).\n{{Identical|Duplicate}}", @@ -245,7 +236,7 @@ "TEXT_GET_SUBSTRING_HELPURL": "url - Information about extracting characters from text. Reminder: urls are the lowest priority translations. Feel free to skip.", "TEXT_GET_SUBSTRING_INPUT_IN_TEXT": "block text - Precedes a piece of text from which a portion should be extracted. [[File:Blockly-get-substring.png]]", "TEXT_GET_SUBSTRING_START_FROM_START": "dropdown - Indicates that the following number specifies the position (relative to the start position) of the beginning of the region of text that should be obtained from the preceding piece of text. See [https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text]. [[File:Blockly-get-substring.png]]", - "TEXT_GET_SUBSTRING_START_FROM_END": "dropdown - Indicates that the following number specifies the position (relative to the end position) of the beginning of the region of text that should be obtained from the preceding piece of text. See [https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text]. Note: If {{msg-blockly|ORDINAL_NUMBER_SUFFIX}} is defined, it will automatically appear ''after'' this and any other [https://translatewiki.net/wiki/Translating:Blockly#Ordinal_numbers ordinal numbers] on this block. [[File:Blockly-get-substring.png]]", + "TEXT_GET_SUBSTRING_START_FROM_END": "dropdown - Indicates that the following number specifies the position (relative to the end position) of the beginning of the region of text that should be obtained from the preceding piece of text. See [https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text]. Note: If {{msg-Blockly|ORDINAL_NUMBER_SUFFIX}} is defined, it will automatically appear ''after'' this and any other [https://translatewiki.net/wiki/Translating:Blockly#Ordinal_numbers ordinal numbers] on this block. [[File:Blockly-get-substring.png]]", "TEXT_GET_SUBSTRING_START_FIRST": "block text - Indicates that a region starting with the first letter of the preceding piece of text should be extracted. See [https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text]. [[File:Blockly-get-substring.png]]", "TEXT_GET_SUBSTRING_END_FROM_START": "dropdown - Indicates that the following number specifies the position (relative to the start position) of the end of the region of text that should be obtained from the preceding piece of text. See [https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text]. [[File:Blockly-get-substring.png]]", "TEXT_GET_SUBSTRING_END_FROM_END": "dropdown - Indicates that the following number specifies the position (relative to the end position) of the end of the region of text that should be obtained from the preceding piece of text. See [https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text]. [[File:Blockly-get-substring.png]]", @@ -304,7 +295,7 @@ "LISTS_GET_INDEX_GET": "dropdown - Indicates that the user wishes to [https://github.com/google/blockly/wiki/Lists#getting-a-single-item get an item from a list] without removing it from the list.", "LISTS_GET_INDEX_GET_REMOVE": "dropdown - Indicates that the user wishes to [https://github.com/google/blockly/wiki/Lists#getting-a-single-item get and remove an item from a list], as opposed to merely getting it without modifying the list.", "LISTS_GET_INDEX_REMOVE": "dropdown - Indicates that the user wishes to [https://github.com/google/blockly/wiki/Lists#removing-an-item remove an item from a list].\n{{Identical|Remove}}", - "LISTS_GET_INDEX_FROM_START": "dropdown - Indicates that an index relative to the front of the list should be used to [https://github.com/google/blockly/wiki/Lists#getting-a-single-item get and/or remove an item from a list]. Note: If {{msg-blockly|ORDINAL_NUMBER_SUFFIX}} is defined, it will automatically appear ''after'' this number (and any other ordinal numbers on this block). See [[Translating:Blockly#Ordinal_numbers]] for more information on ordinal numbers in Blockly. [[File:Blockly-list-get-item.png]]", + "LISTS_GET_INDEX_FROM_START": "dropdown - Indicates that an index relative to the front of the list should be used to [https://github.com/google/blockly/wiki/Lists#getting-a-single-item get and/or remove an item from a list]. Note: If {{msg-Blockly|ORDINAL_NUMBER_SUFFIX}} is defined, it will automatically appear ''after'' this number (and any other ordinal numbers on this block). See [[Translating:Blockly#Ordinal_numbers]] for more information on ordinal numbers in Blockly. [[File:Blockly-list-get-item.png]]", "LISTS_GET_INDEX_FROM_END": "dropdown - Indicates that an index relative to the end of the list should be used to [https://github.com/google/blockly/wiki/Lists#getting-a-single-item access an item in a list]. [[File:Blockly-list-get-item.png]]", "LISTS_GET_INDEX_FIRST": "dropdown - Indicates that the '''first''' item should be [https://github.com/google/blockly/wiki/Lists#getting-a-single-item accessed in a list]. [[File:Blockly-list-get-item.png]]", "LISTS_GET_INDEX_LAST": "dropdown - Indicates that the '''last''' item should be [https://github.com/google/blockly/wiki/Lists#getting-a-single-item accessed in a list]. [[File:Blockly-list-get-item.png]]", @@ -337,7 +328,7 @@ "LISTS_SET_INDEX_TOOLTIP_INSERT_LAST": "tooltip - See [https://github.com/google/blockly/wiki/Lists#getting-a-single-item} (even though the page describes the 'get' block, the idea is the same for the 'insert' block).", "LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM": "tooltip - See [https://github.com/google/blockly/wiki/Lists#getting-a-single-item} (even though the page describes the 'get' block, the idea is the same for the 'insert' block).", "LISTS_GET_SUBLIST_HELPURL": "url - Information describing extracting a sublist from an existing list.", - "LISTS_GET_SUBLIST_START_FROM_START": "dropdown - Indicates that an index relative to the front of the list should be used to specify the beginning of the range from which to [https://github.com/google/blockly/wiki/Lists#getting-a-sublist get a sublist]. [[File:Blockly-get-sublist.png]] Note: If {{msg-blockly|ORDINAL_NUMBER_SUFFIX}} is defined, it will automatically appear ''after'' this number (and any other ordinal numbers on this block). See [[Translating:Blockly#Ordinal_numbers]] for more information on ordinal numbers in Blockly.", + "LISTS_GET_SUBLIST_START_FROM_START": "dropdown - Indicates that an index relative to the front of the list should be used to specify the beginning of the range from which to [https://github.com/google/blockly/wiki/Lists#getting-a-sublist get a sublist]. [[File:Blockly-get-sublist.png]] Note: If {{msg-Blockly|ORDINAL_NUMBER_SUFFIX}} is defined, it will automatically appear ''after'' this number (and any other ordinal numbers on this block). See [[Translating:Blockly#Ordinal_numbers]] for more information on ordinal numbers in Blockly.", "LISTS_GET_SUBLIST_START_FROM_END": "dropdown - Indicates that an index relative to the end of the list should be used to specify the beginning of the range from which to [https://github.com/google/blockly/wiki/Lists#getting-a-sublist get a sublist].", "LISTS_GET_SUBLIST_START_FIRST": "dropdown - Indicates that the [https://github.com/google/blockly/wiki/Lists#getting-a-sublist sublist to extract] should begin with the list's first item.", "LISTS_GET_SUBLIST_END_FROM_START": "dropdown - Indicates that an index relative to the front of the list should be used to specify the end of the range from which to [https://github.com/google/blockly/wiki/Lists#getting-a-sublist get a sublist]. [[File:Blockly-get-sublist.png]]", diff --git a/package.json b/package.json index 95a7ea9eb..985c15170 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "name": "Neil Fraser" }, "scripts": { - "lint": "jshint .", - "pretest": "scripts/test_setup.sh", + "lint": "eslint .", + "pretest": "tests/scripts/test_setup.sh", "test": "node tests/jsunit/test_runner.js" }, "license": "Apache-2.0", @@ -45,5 +45,8 @@ "npm": "^4.4.4", "closure-library": "^1.43629075.2", "webdriverio": "^4.6.2" + }, + "devDependencies": { + "eslint": "2.9.0" } } diff --git a/php_compressed.js b/php_compressed.js index 1868473f4..219da66d3 100644 --- a/php_compressed.js +++ b/php_compressed.js @@ -65,11 +65,11 @@ Blockly.PHP.math_on_list=function(a){var b=a.getFieldValue("OP");switch(b){case Blockly.PHP.math_constrain=function(a){var b=Blockly.PHP.valueToCode(a,"VALUE",Blockly.PHP.ORDER_COMMA)||"0",c=Blockly.PHP.valueToCode(a,"LOW",Blockly.PHP.ORDER_COMMA)||"0";a=Blockly.PHP.valueToCode(a,"HIGH",Blockly.PHP.ORDER_COMMA)||"Infinity";return["min(max("+b+", "+c+"), "+a+")",Blockly.PHP.ORDER_FUNCTION_CALL]}; Blockly.PHP.math_random_int=function(a){var b=Blockly.PHP.valueToCode(a,"FROM",Blockly.PHP.ORDER_COMMA)||"0";a=Blockly.PHP.valueToCode(a,"TO",Blockly.PHP.ORDER_COMMA)||"0";return[Blockly.PHP.provideFunction_("math_random_int",["function "+Blockly.PHP.FUNCTION_NAME_PLACEHOLDER_+"($a, $b) {"," if ($a > $b) {"," return rand($b, $a);"," }"," return rand($a, $b);","}"])+"("+b+", "+a+")",Blockly.PHP.ORDER_FUNCTION_CALL]}; Blockly.PHP.math_random_float=function(a){return["(float)rand()/(float)getrandmax()",Blockly.PHP.ORDER_FUNCTION_CALL]};Blockly.PHP.procedures={}; -Blockly.PHP.procedures_defreturn=function(a){for(var b=[],c,d=a.workspace.getAllVariables()||[],e=0;c=d[e];e++)c=c.name,-1==a.arguments_.indexOf(c)&&b.push(Blockly.PHP.variableDB_.getName(c,Blockly.Variables.NAME_TYPE));b=b.length?" global "+b.join(", ")+";\n":"";d=Blockly.PHP.variableDB_.getName(a.getFieldValue("NAME"),Blockly.Procedures.NAME_TYPE);c=Blockly.PHP.statementToCode(a,"STACK");Blockly.PHP.STATEMENT_PREFIX&&(e=a.id.replace(/\$/g,"$$$$"),c=Blockly.PHP.prefixLines(Blockly.PHP.STATEMENT_PREFIX.replace(/%1/g,"'"+ -e+"'"),Blockly.PHP.INDENT)+c);Blockly.PHP.INFINITE_LOOP_TRAP&&(c=Blockly.PHP.INFINITE_LOOP_TRAP.replace(/%1/g,"'"+a.id+"'")+c);var g=Blockly.PHP.valueToCode(a,"RETURN",Blockly.PHP.ORDER_NONE)||"";g&&(g=" return "+g+";\n");var f=[];for(e=0;ec?"int("+a+" - "+-c+")":"int("+a+")",d&&(a="-"+a));return a};Blockly.Python.colour={};Blockly.Python.colour_picker=function(a){return["'"+a.getFieldValue("COLOUR")+"'",Blockly.Python.ORDER_ATOMIC]};Blockly.Python.colour_random=function(a){Blockly.Python.definitions_.import_random="import random";return["'#%06x' % random.randint(0, 2**24 - 1)",Blockly.Python.ORDER_FUNCTION_CALL]}; Blockly.Python.colour_rgb=function(a){var b=Blockly.Python.provideFunction_("colour_rgb",["def "+Blockly.Python.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b):"," r = round(min(100, max(0, r)) * 2.55)"," g = round(min(100, max(0, g)) * 2.55)"," b = round(min(100, max(0, b)) * 2.55)"," return '#%02x%02x%02x' % (r, g, b)"]),c=Blockly.Python.valueToCode(a,"RED",Blockly.Python.ORDER_NONE)||0,d=Blockly.Python.valueToCode(a,"GREEN",Blockly.Python.ORDER_NONE)||0;a=Blockly.Python.valueToCode(a,"BLUE",Blockly.Python.ORDER_NONE)|| @@ -59,11 +59,11 @@ Blockly.Python.math_on_list=function(a){var b=a.getFieldValue("OP");a=Blockly.Py Blockly.Python.math_modulo=function(a){var b=Blockly.Python.valueToCode(a,"DIVIDEND",Blockly.Python.ORDER_MULTIPLICATIVE)||"0";a=Blockly.Python.valueToCode(a,"DIVISOR",Blockly.Python.ORDER_MULTIPLICATIVE)||"0";return[b+" % "+a,Blockly.Python.ORDER_MULTIPLICATIVE]}; Blockly.Python.math_constrain=function(a){var b=Blockly.Python.valueToCode(a,"VALUE",Blockly.Python.ORDER_NONE)||"0",c=Blockly.Python.valueToCode(a,"LOW",Blockly.Python.ORDER_NONE)||"0";a=Blockly.Python.valueToCode(a,"HIGH",Blockly.Python.ORDER_NONE)||"float('inf')";return["min(max("+b+", "+c+"), "+a+")",Blockly.Python.ORDER_FUNCTION_CALL]}; Blockly.Python.math_random_int=function(a){Blockly.Python.definitions_.import_random="import random";var b=Blockly.Python.valueToCode(a,"FROM",Blockly.Python.ORDER_NONE)||"0";a=Blockly.Python.valueToCode(a,"TO",Blockly.Python.ORDER_NONE)||"0";return["random.randint("+b+", "+a+")",Blockly.Python.ORDER_FUNCTION_CALL]};Blockly.Python.math_random_float=function(a){Blockly.Python.definitions_.import_random="import random";return["random.random()",Blockly.Python.ORDER_FUNCTION_CALL]};Blockly.Python.procedures={}; -Blockly.Python.procedures_defreturn=function(a){for(var b=[],c,d=a.workspace.getAllVariables()||[],e=0;c=d[e];e++)c=c.name,-1==a.arguments_.indexOf(c)&&b.push(Blockly.Python.variableDB_.getName(c,Blockly.Variables.NAME_TYPE));b=b.length?" global "+b.join(", ")+"\n":"";d=Blockly.Python.variableDB_.getName(a.getFieldValue("NAME"),Blockly.Procedures.NAME_TYPE);c=Blockly.Python.statementToCode(a,"STACK");Blockly.Python.STATEMENT_PREFIX&&(e=a.id.replace(/\$/g,"$$$$"),c=Blockly.Python.prefixLines(Blockly.Python.STATEMENT_PREFIX.replace(/%1/g,"'"+ -e+"'"),Blockly.Python.INDENT)+c);Blockly.Python.INFINITE_LOOP_TRAP&&(c=Blockly.Python.INFINITE_LOOP_TRAP.replace(/%1/g,'"'+a.id+'"')+c);var f=Blockly.Python.valueToCode(a,"RETURN",Blockly.Python.ORDER_NONE)||"";f?f=" return "+f+"\n":c||(c=Blockly.Python.PASS);var g=[];for(e=0;e /dev/null +echo Compiling Blockly... +java -jar $COMPILER --js='main.js' \ + --js='../../core/**.js' \ + --js='../../blocks/**.js' \ + --js='../../generators/**.js' \ + --js='../../msg/js/**.js' \ + --js='../../../closure-library/closure/goog/**.js' \ + --js='../../../closure-library/third_party/closure/goog/**.js' \ + --generate_exports \ + --externs ../../externs/svg-externs.js \ + --compilation_level ADVANCED_OPTIMIZATIONS \ + --dependency_mode=STRICT --entry_point=Main \ + --js_output_file main_compressed.js +if [ -s main_compressed.js ]; then + echo Compilation OK. +else + echo Compilation FAIL. + exit 1 +fi diff --git a/demos/fixed-advanced/index.html b/tests/compile/index.html similarity index 52% rename from demos/fixed-advanced/index.html rename to tests/compile/index.html index a5630860d..93444421d 100644 --- a/demos/fixed-advanced/index.html +++ b/tests/compile/index.html @@ -2,7 +2,7 @@ - Blockly Demo: Fixed Blockly built with Closure Compiler's advanced optimizations + Blockly: Advanced Compilation Test -

- Blockly > - Demos > - Fixed Blockly built with Closure Compiler's advanced optimizations -

+

Blockly: Advanced Compilation Test

-

- This is a simple demo of injecting Blockly into a fixed-sized 'div' element - from a Closure-compiled source code with advanced optimizations. -

+

To run this test manually, download + closure-compiler-vxxxxxxxx.jar, + place it in this directory, then run compile.js from the command line.

-

→ More info on injecting fixed-sized Blockly

+

Measure the size of main_compressed.js (295kb as of October 2017), then reload + this page and see if Blockly works.

- - diff --git a/tests/compile/main.js b/tests/compile/main.js new file mode 100644 index 000000000..3fd1115a3 --- /dev/null +++ b/tests/compile/main.js @@ -0,0 +1,17 @@ +goog.provide('Main'); +// Messages (in some language) +goog.require('Blockly.Msg.en'); +// Core +goog.require('Blockly'); +// Blocks +goog.require('Blockly.Constants.Logic'); +goog.require('Blockly.Constants.Loops'); +goog.require('Blockly.Constants.Math'); +goog.require('Blockly.Constants.Text'); + +Main.init = function() { + Blockly.inject('blocklyDiv', { + 'toolbox': document.getElementById('toolbox') + }); +}; +window.addEventListener('load', Main.init); diff --git a/tests/jsunit/connection_db_test.js b/tests/jsunit/connection_db_test.js index 558edf100..c9eb6add1 100644 --- a/tests/jsunit/connection_db_test.js +++ b/tests/jsunit/connection_db_test.js @@ -304,4 +304,4 @@ function helper_createConnection(x, y, type, opt_shared_workspace, conn.x_ = x; conn.y_ = y; return conn; -} \ No newline at end of file +} diff --git a/tests/jsunit/db_test.js b/tests/jsunit/db_test.js deleted file mode 100644 index 45fc62a4b..000000000 --- a/tests/jsunit/db_test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @license - * Blockly Tests - * - * Copyright 2016 Google Inc. - * https://developers.google.com/blockly/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -'use strict'; - -function test_DB_getNeighbours() { - var db = new Blockly.ConnectionDB(); - - // Search an empty list. - assertEquals(helper_getNeighbours(db, 10 /* x */, 10 /* y */, 100 /* radius */).length, 0); - - // Set up some connections. - for (var i = 0; i < 10; i++) { - db.addConnection_(helper_createConnection(0, i, Blockly.PREVIOUS_STATEMENT)); - } - - // Test block belongs at beginning - var result = helper_getNeighbours(db, 0, 0, 4); - assertEquals(5, result.length); - for (i = 0; i < result.length; i++) { - assertNotEquals(result.indexOf(db[i]), -1); // contains - } - - // Test block belongs at middle - result = helper_getNeighbours(db, 0, 4, 2); - assertEquals(5, result.length); - for (i = 0; i < result.length; i++) { - assertNotEquals(result.indexOf(db[i + 2]), -1); // contains - } - - // Test block belongs at end - result = helper_getNeighbours(db, 0, 9, 4); - assertEquals(5, result.length); - for (i = 0; i < result.length; i++) { - assertNotEquals(result.indexOf(db[i + 5]), -1); // contains - } - - // Test block has no neighbours due to being out of range in the x direction - result = helper_getNeighbours(db, 10, 9, 4); - assertEquals(result.length, 0); - - // Test block has no neighbours due to being out of range in the y direction - result = helper_getNeighbours(db, 0, 19, 4); - assertEquals(result.length, 0); - - // Test block has no neighbours due to being out of range diagonally - result = helper_getNeighbours(db, -2, -2, 2); - assertEquals(result.length, 0); -} - -function helper_getNeighbours(db, x, y, radius) { - return db.getNeighbours(helper_createConnection(x, y, Blockly.NEXT_STATEMENT), radius); -} - -function helper_createConnection(x, y, type) { - var conn = new Blockly.Connection({workspace: {}}, type); - conn.x_ = x; - conn.y_ = y; - return conn; -} \ No newline at end of file diff --git a/tests/jsunit/event_test.js b/tests/jsunit/event_test.js index d5583089e..3221ed927 100644 --- a/tests/jsunit/event_test.js +++ b/tests/jsunit/event_test.js @@ -512,6 +512,48 @@ function test_events_mergeUi() { eventTest_tearDownWithMockBlocks(); } +/** + * Tests that events that collide on a (event, block, workspace) tuple + * but cannot be merged do not get dropped during filtering. + */ +function test_events_stackclick() { + eventTest_setUpWithMockBlocks(); + var block = workspace.newBlock('field_variable_test_block', '1'); + var events = [ + new Blockly.Events.Ui(block, 'click', undefined, undefined), + new Blockly.Events.Ui(block, 'stackclick', undefined, undefined) + ]; + var filteredEvents = Blockly.Events.filter(events, true); + // click and stackclick should both exist + assertEquals(2, filteredEvents.length); + assertEquals('click', filteredEvents[0].element); + assertEquals('stackclick', filteredEvents[1].element); + eventTest_tearDownWithMockBlocks(); +} + +/** + * Mutator composition could result in move events for blocks + * connected to the mutated block that were null operations. This + * leads to events in the undo/redo queue that do nothing, requiring + * an extra undo/redo to proceed to the next event. This test ensures + * that two move events that do get merged (disconnecting and + * reconnecting a block in response to a mutator change) are filtered + * from the queue. + */ +function test_events_filteraftermerge() { + eventTest_setUpWithMockBlocks(); + var block = workspace.newBlock('field_variable_test_block', '1'); + block.setParent(null); + var events = []; + helper_addMoveEventParent(events, block, null); + helper_addMoveEventParent(events, block, null); + var filteredEvents = Blockly.Events.filter(events, true); + // The two events should be merged, but because nothing has changed + // they will be filtered out. + assertEquals(0, filteredEvents.length); + eventTest_tearDownWithMockBlocks(); +} + /** * Helper function to simulate block move events. * @@ -525,3 +567,9 @@ function helper_addMoveEvent(events, block, newX, newY) { block.xy_ = new goog.math.Coordinate(newX, newY); events[events.length-1].recordNew(); } + +function helper_addMoveEventParent(events, block, parent) { + events.push(new Blockly.Events.BlockMove(block)); + block.setParent(parent); + events[events.length-1].recordNew(); +} diff --git a/tests/jsunit/index.html b/tests/jsunit/index.html index 8ab715c6f..500f2cb37 100644 --- a/tests/jsunit/index.html +++ b/tests/jsunit/index.html @@ -8,26 +8,26 @@ - - - + - + + + + + + + + - - - - - diff --git a/tests/jsunit/input_test.js b/tests/jsunit/input_test.js index b80f44ab5..35bdd4f30 100644 --- a/tests/jsunit/input_test.js +++ b/tests/jsunit/input_test.js @@ -19,8 +19,8 @@ */ /** - * @fileoverview Tests for Blockly.Input - */ + * @fileoverview Tests for Blockly.Input + */ 'use strict'; function test_appendField_simple() { @@ -157,7 +157,7 @@ function test_insertFieldAt_prefix() { var after = new Blockly.FieldLabel('after'); var prefix = new Blockly.FieldLabel('prefix'); var between = new Blockly.FieldLabel('between'); - between.prefixField = prefix + between.prefixField = prefix; input.appendField(before); input.appendField(after); @@ -175,7 +175,7 @@ function test_insertFieldAt_prefix() { assertEquals(after, input.fieldRow[3]); } -function test_insertFieldAt_prefix() { +function test_insertFieldAt_suffix() { var ws = new Blockly.Workspace(); var block = new Blockly.Block(ws); var input = new Blockly.Input(Blockly.DUMMY_INPUT, 'INPUT', block); @@ -183,7 +183,7 @@ function test_insertFieldAt_prefix() { var after = new Blockly.FieldLabel('after'); var suffix = new Blockly.FieldLabel('suffix'); var between = new Blockly.FieldLabel('between'); - between.suffixField = suffix + between.suffixField = suffix; input.appendField(before); input.appendField(after); @@ -199,4 +199,4 @@ function test_insertFieldAt_prefix() { assertEquals(between, input.fieldRow[1]); assertEquals(suffix, input.fieldRow[2]); assertEquals(after, input.fieldRow[3]); -} \ No newline at end of file +} diff --git a/tests/jsunit/json_test.js b/tests/jsunit/json_test.js index 7967cd2f6..d489022b2 100644 --- a/tests/jsunit/json_test.js +++ b/tests/jsunit/json_test.js @@ -257,4 +257,3 @@ function test_json_dropdown_image() { delete Blockly.Msg['ALTTEXT']; } } - diff --git a/tests/jsunit/procedures_test.js b/tests/jsunit/procedures_test.js index 10003ec74..0284f3978 100644 --- a/tests/jsunit/procedures_test.js +++ b/tests/jsunit/procedures_test.js @@ -80,4 +80,3 @@ function test_isNameUsed_True() { assertTrue(result); proceduresTest_tearDownWithMockBlocks(); } - diff --git a/tests/jsunit/utils_test.js b/tests/jsunit/utils_test.js index 31ccfc187..98ffabd7f 100644 --- a/tests/jsunit/utils_test.js +++ b/tests/jsunit/utils_test.js @@ -42,14 +42,14 @@ function test_addClass() { assertEquals('Adding "three"', 'one two three', p.className); } -function test_hasClass() { - var p = document.createElement('p'); - p.className = ' one three two three '; - assertTrue('Has "one"', Blockly.utils.hasClass(p, 'one')); - assertTrue('Has "two"', Blockly.utils.hasClass(p, 'two')); - assertTrue('Has "three"', Blockly.utils.hasClass(p, 'three')); - assertFalse('Has no "four"', Blockly.utils.hasClass(p, 'four')); - assertFalse('Has no "t"', Blockly.utils.hasClass(p, 't')); +function test_hasClass() { + var p = document.createElement('p'); + p.className = ' one three two three '; + assertTrue('Has "one"', Blockly.utils.hasClass(p, 'one')); + assertTrue('Has "two"', Blockly.utils.hasClass(p, 'two')); + assertTrue('Has "three"', Blockly.utils.hasClass(p, 'three')); + assertFalse('Has no "four"', Blockly.utils.hasClass(p, 'four')); + assertFalse('Has no "t"', Blockly.utils.hasClass(p, 't')); } function test_removeClass() { @@ -128,19 +128,19 @@ function test_tokenizeInterpolation() { tokens = Blockly.utils.tokenizeInterpolation('Hello'); assertArrayEquals('No interpolation', ['Hello'], tokens); - + tokens = Blockly.utils.tokenizeInterpolation('Hello%World'); assertArrayEquals('Unescaped %.', ['Hello%World'], tokens); - + tokens = Blockly.utils.tokenizeInterpolation('Hello%%World'); assertArrayEquals('Escaped %.', ['Hello%World'], tokens); - + tokens = Blockly.utils.tokenizeInterpolation('Hello %1 World'); assertArrayEquals('Interpolation.', ['Hello ', 1, ' World'], tokens); - + tokens = Blockly.utils.tokenizeInterpolation('%123Hello%456World%789'); assertArrayEquals('Interpolations.', [123, 'Hello', 456, 'World', 789], tokens); - + tokens = Blockly.utils.tokenizeInterpolation('%%%x%%0%00%01%'); assertArrayEquals('Torture interpolations.', ['%%x%0', 0, 1, '%'], tokens); @@ -192,22 +192,13 @@ function test_tokenizeInterpolation() { function test_replaceMessageReferences() { Blockly.Msg = Blockly.Msg || {}; Blockly.Msg.STRING_REF = 'test string'; + Blockly.Msg.SUBREF = 'subref'; + Blockly.Msg.STRING_REF_WITH_ARG = 'test %1 string'; + Blockly.Msg.STRING_REF_WITH_SUBREF = 'test %{bky_subref} string'; var resultString = Blockly.utils.replaceMessageReferences(''); assertEquals('Empty string produces empty string', '', resultString); - resultString = Blockly.utils.replaceMessageReferences('%{bky_string_ref}'); - assertEquals('Message ref dereferenced.', 'test string', resultString); - resultString = Blockly.utils.replaceMessageReferences('before %{bky_string_ref} after'); - assertEquals('Message ref dereferenced.', 'before test string after', resultString); - - resultString = Blockly.utils.replaceMessageReferences('%1'); - assertEquals('Interpolation tokens ignored.', '%1', resultString); - resultString = Blockly.utils.replaceMessageReferences('%1 %2'); - assertEquals('Interpolation tokens ignored.', '%1 %2', resultString); - resultString = Blockly.utils.replaceMessageReferences('before %1 after'); - assertEquals('Interpolation tokens ignored.', 'before %1 after', resultString); - resultString = Blockly.utils.replaceMessageReferences('%%'); assertEquals('Escaped %', '%', resultString); resultString = Blockly.utils.replaceMessageReferences('%%{bky_string_ref}'); @@ -215,4 +206,29 @@ function test_replaceMessageReferences() { resultString = Blockly.utils.replaceMessageReferences('%a'); assertEquals('Unrecognized % escape code treated as literal', '%a', resultString); + + resultString = Blockly.utils.replaceMessageReferences('%1'); + assertEquals('Interpolation tokens ignored.', '%1', resultString); + resultString = Blockly.utils.replaceMessageReferences('%1 %2'); + assertEquals('Interpolation tokens ignored.', '%1 %2', resultString); + resultString = Blockly.utils.replaceMessageReferences('before %1 after'); + assertEquals('Interpolation tokens ignored.', 'before %1 after', resultString); + + // Blockly.Msg.STRING_REF cases: + resultString = Blockly.utils.replaceMessageReferences('%{bky_string_ref}'); + assertEquals('Message ref dereferenced.', 'test string', resultString); + resultString = Blockly.utils.replaceMessageReferences('before %{bky_string_ref} after'); + assertEquals('Message ref dereferenced.', 'before test string after', resultString); + + // Blockly.Msg.STRING_REF_WITH_ARG cases: + resultString = Blockly.utils.replaceMessageReferences('%{bky_string_ref_with_arg}'); + assertEquals('Message ref dereferenced with argument preserved.', 'test %1 string', resultString); + resultString = Blockly.utils.replaceMessageReferences('before %{bky_string_ref_with_arg} after'); + assertEquals('Message ref dereferenced with argument preserved.', 'before test %1 string after', resultString); + + // Blockly.Msg.STRING_REF_WITH_SUBREF cases: + resultString = Blockly.utils.replaceMessageReferences('%{bky_string_ref_with_subref}'); + assertEquals('Message ref and subref dereferenced.', 'test subref string', resultString); + resultString = Blockly.utils.replaceMessageReferences('before %{bky_string_ref_with_subref} after'); + assertEquals('Message ref and subref dereferenced.', 'before test subref string after', resultString); } diff --git a/tests/jsunit/variable_map_test.js b/tests/jsunit/variable_map_test.js index 023377b14..b2c0ccb95 100644 --- a/tests/jsunit/variable_map_test.js +++ b/tests/jsunit/variable_map_test.js @@ -131,8 +131,7 @@ function test_createVariableNullId() { try { variable_map.createVariable('name1', 'type1', null); checkVariableValues(variable_map, 'name1', 'type1', '1'); - } - finally { + } finally { variableMapTest_tearDown(); } } @@ -143,8 +142,7 @@ function test_createVariableUndefinedId() { try { variable_map.createVariable('name1', 'type1', undefined); checkVariableValues(variable_map, 'name1', 'type1', '1'); - } - finally { + } finally { variableMapTest_tearDown(); } } diff --git a/tests/jsunit/widget_div_test.js b/tests/jsunit/widget_div_test.js index e43cde217..ea1260524 100644 --- a/tests/jsunit/widget_div_test.js +++ b/tests/jsunit/widget_div_test.js @@ -151,4 +151,3 @@ function test_widgetDiv_noXConflict_RTL() { anchorBBox, widgetDiv_test_widgetSize, true /* rtl */); assertEquals(anchorBBox.right - widgetDiv_test_widgetSize.width, calculated); } - diff --git a/tests/jsunit/workspace_test.js b/tests/jsunit/workspace_test.js index 17755f158..a96a34ac4 100644 --- a/tests/jsunit/workspace_test.js +++ b/tests/jsunit/workspace_test.js @@ -66,8 +66,7 @@ function test_emptyWorkspace() { assertEquals('Empty workspace (4).', 0, workspace.getTopBlocks(true).length); assertEquals('Empty workspace (5).', 0, workspace.getTopBlocks(false).length); assertEquals('Empty workspace (6).', 0, workspace.getAllBlocks().length); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -187,8 +186,7 @@ function test_updateVariableStore_TrivialNoClear() { workspace.updateVariableStore(); checkVariableValues(workspace, 'name1', 'type1', 'id1'); checkVariableValues(workspace, 'name2', 'type2', 'id2'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -202,8 +200,7 @@ function test_updateVariableStore_NameNotInvariableMap_NoClear() { try { workspace.updateVariableStore(); checkVariableValues(workspace, 'name1', '', '1'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -219,8 +216,7 @@ function test_updateVariableStore_ClearAndAllInUse() { workspace.updateVariableStore(true); checkVariableValues(workspace, 'name1', 'type1', 'id1'); checkVariableValues(workspace, 'name2', 'type2', 'id2'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -237,8 +233,7 @@ function test_updateVariableStore_ClearAndOneInUse() { checkVariableValues(workspace, 'name1', 'type1', 'id1'); var variabe = workspace.getVariable('name2'); assertNull(variable); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -255,8 +250,7 @@ function test_addTopBlock_TrivialFlyoutIsTrue() { try { workspace.addTopBlock(block); checkVariableValues(workspace, 'name1', '', '1'); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -274,8 +268,7 @@ function test_clear_Trivial() { var varMapLength = Object.keys(workspace.variableMap_.variableMap_).length; assertEquals(0, topBlocks_length); assertEquals(0, varMapLength); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -291,8 +284,7 @@ function test_clear_NoVariables() { var varMapLength = Object.keys(workspace.variableMap_.variableMap_).length; assertEquals(0, topBlocks_length); assertEquals(0, varMapLength); - } - finally { + } finally { workspaceTest_tearDown(); } } @@ -312,8 +304,7 @@ function test_renameVariable_NoBlocks() { checkVariableValues(workspace, 'name2', '', '1'); var variable = workspace.getVariable(oldName); assertNull(variable); - } - finally { + } finally { workspaceTest_tearDown(); } } diff --git a/tests/jsunit/xml_test.js b/tests/jsunit/xml_test.js index ea682dfb7..1a6dbce3d 100644 --- a/tests/jsunit/xml_test.js +++ b/tests/jsunit/xml_test.js @@ -67,7 +67,7 @@ function xmlTest_setUpWithMockBlocks() { 'name': 'VAR', 'variable': 'item' } - ], + ] }]); } @@ -91,7 +91,7 @@ function xmlTest_checkNonVariableField(fieldDom, name, text) { assertEquals(text, fieldDom.textContent); assertEquals(name, fieldDom.getAttribute('name')); assertNull(fieldDom.getAttribute('id')); - assertNull(fieldDom.getAttribute('variableType')); + assertNull(fieldDom.getAttribute('variabletype')); } /** @@ -104,7 +104,7 @@ function xmlTest_checkNonVariableField(fieldDom, name, text) { */ function xmlTest_checkVariableFieldDomValues(fieldDom, name, type, id, text) { assertEquals(name, fieldDom.getAttribute('name')); - assertEquals(type, fieldDom.getAttribute('variableType')); + assertEquals(type, fieldDom.getAttribute('variabletype')); assertEquals(id, fieldDom.getAttribute('id')); assertEquals(text, fieldDom.textContent); } @@ -166,7 +166,7 @@ function test_domToWorkspace_VariablesAtTop() { ' name3' + ' ' + ' ' + - ' name3' + + ' name3' + ' ' + ''); Blockly.Xml.domToWorkspace(dom, workspace); @@ -210,7 +210,7 @@ function test_domToWorkspace_VariablesAtTop_MissingType() { ' name1' + ' ' + ' ' + - ' name3' + + ' name3' + ' ' + ''); Blockly.Xml.domToWorkspace(dom, workspace); @@ -233,7 +233,7 @@ function test_domToWorkspace_VariablesAtTop_MismatchBlockType() { ' name1' + ' ' + ' ' + - ' name1' + + ' name1' + ' ' + ''); Blockly.Xml.domToWorkspace(dom, workspace); @@ -364,3 +364,28 @@ function test_variablesToDom_noVariables() { assertEquals(1, resultDom.children.length); xmlTest_tearDown(); } + +function test_variableFieldXml_caseSensitive() { + var id = 'testId'; + var type = 'testType'; + var name = 'testName'; + + var mockVariableModel = { + type: type, + name: name, + getId: function() { + return id; + } + }; + + var generatedXml = Blockly.Variables.generateVariableFieldXml_(mockVariableModel); + // The field contains this XML tag as a result of how we're generating this + // XML. This is not desirable, but the goal of this test is to make sure + // we're preserving case-sensitivity. + var xmlns = 'xmlns="http://www.w3.org/1999/xhtml"'; + var goldenXml = + '' + name + ''; + assertEquals(goldenXml, generatedXml); +} diff --git a/scripts/.selenium_connect.sh.swp b/tests/scripts/.selenium_connect.sh.swp similarity index 100% rename from scripts/.selenium_connect.sh.swp rename to tests/scripts/.selenium_connect.sh.swp diff --git a/scripts/get_chromedriver.sh b/tests/scripts/get_chromedriver.sh similarity index 100% rename from scripts/get_chromedriver.sh rename to tests/scripts/get_chromedriver.sh diff --git a/scripts/get_geckdriver.sh b/tests/scripts/get_geckdriver.sh similarity index 100% rename from scripts/get_geckdriver.sh rename to tests/scripts/get_geckdriver.sh diff --git a/scripts/get_selenium.sh b/tests/scripts/get_selenium.sh similarity index 100% rename from scripts/get_selenium.sh rename to tests/scripts/get_selenium.sh diff --git a/scripts/selenium_connect.sh b/tests/scripts/selenium_connect.sh similarity index 100% rename from scripts/selenium_connect.sh rename to tests/scripts/selenium_connect.sh diff --git a/scripts/setup_linux_env.sh b/tests/scripts/setup_linux_env.sh similarity index 100% rename from scripts/setup_linux_env.sh rename to tests/scripts/setup_linux_env.sh diff --git a/scripts/setup_osx_env.sh b/tests/scripts/setup_osx_env.sh similarity index 100% rename from scripts/setup_osx_env.sh rename to tests/scripts/setup_osx_env.sh diff --git a/scripts/test_setup.sh b/tests/scripts/test_setup.sh similarity index 57% rename from scripts/test_setup.sh rename to tests/scripts/test_setup.sh index 4220923f3..e9ddf561f 100755 --- a/scripts/test_setup.sh +++ b/tests/scripts/test_setup.sh @@ -11,13 +11,13 @@ function check_command { fi } -check_command scripts/get_geckdriver.sh +check_command tests/scripts/get_geckdriver.sh sleep 5 -check_command scripts/get_selenium.sh +check_command tests/scripts/get_selenium.sh sleep 5 -check_command scripts/get_chromedriver.sh +check_command tests/scripts/get_chromedriver.sh sleep 10 -check_command scripts/selenium_connect.sh +check_command tests/scripts/selenium_connect.sh sleep 10 exit $EXIT_STATUS