Files
blockly/tests/mocha/index.html
Christopher Allen 335ff199d7 refactor: Update uncompiled-mode dependency loading for playground, tests (#5715)
* chore: rename module Blockly.blocks.Lists to ....lists

All the other Blockly.blocks modules have lower-case names.  This
one being named with an upper-case initial appears to have been a
typo on my part.

This module name is not mentioned anywhere else in the source code
(though it will be soon!) so no other files need to be edited.
Further, it does not appear anywhere in the last release (which
before PR #5696) so it is not necessary to add an entry in
renamings.js for this change.

* chore(build): Rationalise deps.js, deps.mocha.js

* Include blocks/*.js (Blockly.blocks.*) in tests/deps.js, since
  these modules are used in the playground.  (They are goog.provide
  modules loaded via <script> tags, so their absence from deps.js
  does not cause errors - but it will when they are migrated to
  goog.module and must be loaded via goog.require.)

* Filter the entries in deps.mocha.js so that it includes only the
  additional mocha test modules (i.e. those not mentioned in deps.js
  already).

* refactor: Load blocks and generators using goog.require
2021-11-17 00:04:45 +00:00

184 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mocha Tests for Blockly</title>
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
<script src="../../blockly_uncompressed.js"></script>
<script src="../deps.mocha.js"></script>
<script src="../../msg/messages.js"></script>
</head>
<style>
#blocklyDiv {
height: 1000px;
position: fixed;
visibility: hidden;
width: 1000px;
}
</style>
<body>
<div id="mocha"></div>
<div id="failureCount" style="display:none" tests_failed="unset"></div>
<script src="../../node_modules/chai/chai.js"></script>
<script src="../../node_modules/mocha/mocha.js"></script>
<script src="../../node_modules/sinon/pkg/sinon.js"></script>
<script src="../../node_modules/@blockly/dev-tools/dist/index.js"></script>
<script>
mocha.setup({
ui: 'tdd'
});
</script>
<script>
// Require optional modules needed by tests.
goog.require('Blockly.Dart');
goog.require('Blockly.Dart.texts');
goog.require('Blockly.JavaScript');
goog.require('Blockly.JavaScript.texts');
goog.require('Blockly.Lua');
goog.require('Blockly.Lua.texts');
goog.require('Blockly.PHP');
goog.require('Blockly.PHP.texts');
goog.require('Blockly.Python');
goog.require('Blockly.Python.texts');
goog.require('Blockly.blocks.colour');
goog.require('Blockly.blocks.logic');
goog.require('Blockly.blocks.lists');
goog.require('Blockly.blocks.loops');
goog.require('Blockly.blocks.math');
goog.require('Blockly.blocks.procedures');
goog.require('Blockly.blocks.texts');
goog.require('Blockly.blocks.variables');
goog.require('Blockly.blocks.variablesDynamic');
// Run tests.
goog.require('Blockly.test.astNode');
goog.require('Blockly.test.blockChangeEvent');
goog.require('Blockly.test.blockCreateEvent');
goog.require('Blockly.test.blockJson');
goog.require('Blockly.test.blocks');
goog.require('Blockly.test.comments');
goog.require('Blockly.test.connectionChecker');
goog.require('Blockly.test.connectionDb');
goog.require('Blockly.test.connection');
goog.require('Blockly.test.contextMenuItem');
goog.require('Blockly.test.cursor');
goog.require('Blockly.test.dropdown');
goog.require('Blockly.test.event');
goog.require('Blockly.test.extensions');
goog.require('Blockly.test.fieldAngle');
goog.require('Blockly.test.fieldCheckbox');
goog.require('Blockly.test.fieldColour');
goog.require('Blockly.test.fieldDropdown');
goog.require('Blockly.test.fieldImage');
goog.require('Blockly.test.fieldLabelSerialization');
goog.require('Blockly.test.fieldLabel');
goog.require('Blockly.test.fieldMultiline');
goog.require('Blockly.test.fieldNumber');
goog.require('Blockly.test.fieldRegistry');
goog.require('Blockly.test.fieldTest');
goog.require('Blockly.test.fieldTextInput');
goog.require('Blockly.test.fieldVariable');
goog.require('Blockly.test.flyout');
goog.require('Blockly.test.generator');
goog.require('Blockly.test.gesture');
goog.require('Blockly.test.input');
goog.require('Blockly.test.insertionMarker');
goog.require('Blockly.test.jsoDeserialization');
goog.require('Blockly.test.jsoSerialization');
goog.require('Blockly.test.json');
goog.require('Blockly.test.keydown');
goog.require('Blockly.test.logicTernary');
goog.require('Blockly.test.metrics');
goog.require('Blockly.test.mutator');
goog.require('Blockly.test.names');
goog.require('Blockly.test.procedures');
goog.require('Blockly.test.registry');
goog.require('Blockly.test.serialization');
goog.require('Blockly.test.shortcutRegistry');
goog.require('Blockly.test.theme');
goog.require('Blockly.test.toolbox');
goog.require('Blockly.test.tooltip');
goog.require('Blockly.test.trashcan');
goog.require('Blockly.test.utils');
goog.require('Blockly.test.variableMap');
goog.require('Blockly.test.variableModel');
goog.require('Blockly.test.variables');
goog.require('Blockly.test.widgetDiv');
goog.require('Blockly.test.workspaceComment');
goog.require('Blockly.test.workspaceSvg');
goog.require('Blockly.test.workspace');
goog.require('Blockly.test.xml');
goog.require('Blockly.test.zoomControls');
</script>
<div id="blocklyDiv"></div>
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox-simple" style="display: none">
<block type="logic_compare">
<field name="OP">NEQ</field>
<value name="A">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
<value name="B">
<block type="math_number">
<field name="NUM">2</field>
</block>
</value>
</block>
<sep gap="20"></sep>
<button text="insert" callbackkey="insertConnectionRows"></button>
<label text="tooltips"></label>
</xml>
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox-categories" style="display: none">
<category name="First" css-container="something">
<block type="basic_block">
<field name="TEXT">FirstCategory-FirstBlock</field>
</block>
<block type="basic_block">
<field name="TEXT">FirstCategory-SecondBlock</field>
</block>
</category>
<category name="Second">
<block type="basic_block">
<field name="TEXT">SecondCategory-FirstBlock</field>
</block>
</category>
</xml>
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox-test" style="display: none">
<category name="First" expanded="true" categorystyle="logic_category">
<sep gap="-1"></sep>
<button text="insert" callbackkey="insertConnectionRows"></button>
<block type="stack_block"></block>
<block type="stack_block"></block>
</category>
<category name="Second">
<block type="stack_block"></block>
</category>
<sep toolboxitemid="separator" gap="-1"></sep>
<category name="Variables" custom="VARIABLE"></category>
<category name="NestedCategory" >
<category toolboxitemid="nestedCategory" name="NestedItemOne"></category>
</category>
<category name="lastItem"></category>
</xml>
<xml xmlns="https://developers.google.com/blockly/xml" id="gesture-test-toolbox" style="display: none">
<block type="test_field_block"></block>
</xml>
<script>
mocha.run(function(failures) {
var failureDiv = document.getElementById('failureCount');
failureDiv.setAttribute('tests_failed', failures);
});
</script>
</body>
</html>