Files
blockly/tests/mocha/index.html
Maribeth Bottorff 88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00

235 lines
7.7 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" />
</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>
<div id="failureMessages" style="display: none"></div>
<!-- Load mocha et al. before bootstrapping so that we can safely
goog.require() the test modules that make calls to (e.g.)
suite() at the top level. -->
<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>
mocha.setup({
ui: 'tdd',
failZero: true,
});
var BLOCKLY_BOOTSTRAP_OPTIONS = {
loadCompressed: false,
depsFiles: ['build/deps.js', 'build/deps.mocha.js'],
requires: [
// Blockly modules needed by tests.
'Blockly',
'Blockly.libraryBlocks',
'Blockly.Dart',
'Blockly.Dart.texts',
'Blockly.JavaScript',
'Blockly.JavaScript.texts',
'Blockly.Lua',
'Blockly.Lua.texts',
'Blockly.PHP',
'Blockly.PHP.texts',
'Blockly.Python',
'Blockly.Python.texts',
// Test modules.
'Blockly.test.astNode',
'Blockly.test.blockJson',
'Blockly.test.blocks',
'Blockly.test.comments',
'Blockly.test.commentDeserialization',
'Blockly.test.connectionChecker',
'Blockly.test.connectionDb',
'Blockly.test.connection',
'Blockly.test.contextMenuItem',
'Blockly.test.cursor',
'Blockly.test.dropdown',
'Blockly.test.event',
'Blockly.test.eventBlockChange',
'Blockly.test.eventBlockCreate',
'Blockly.test.eventBlockDelete',
'Blockly.test.eventBlockDrag',
'Blockly.test.eventBlockMove',
'Blockly.test.eventBubbleOpen',
'Blockly.test.eventClick',
'Blockly.test.eventCommentChange',
'Blockly.test.eventCommentCreate',
'Blockly.test.eventCommentDelete',
'Blockly.test.eventCommentMove',
'Blockly.test.eventMarkerMove',
'Blockly.test.eventSelected',
'Blockly.test.eventThemeChange',
'Blockly.test.eventToolboxItemSelect',
'Blockly.test.eventTrashcanOpen',
'Blockly.test.eventVarCreate',
'Blockly.test.eventVarDelete',
'Blockly.test.eventVarRename',
'Blockly.test.eventViewportChange',
'Blockly.test.extensions',
'Blockly.test.fieldAngle',
'Blockly.test.fieldCheckbox',
'Blockly.test.fieldColour',
'Blockly.test.fieldDropdown',
'Blockly.test.fieldImage',
'Blockly.test.fieldLabelSerialization',
'Blockly.test.fieldLabel',
'Blockly.test.fieldMultiline',
'Blockly.test.fieldNumber',
'Blockly.test.fieldRegistry',
'Blockly.test.fieldTest',
'Blockly.test.fieldTextInput',
'Blockly.test.fieldVariable',
'Blockly.test.flyout',
'Blockly.test.generator',
'Blockly.test.gesture',
'Blockly.test.icon',
'Blockly.test.input',
'Blockly.test.insertionMarker',
'Blockly.test.insertionMarkerManager',
'Blockly.test.jsoDeserialization',
'Blockly.test.jsoSerialization',
'Blockly.test.json',
'Blockly.test.keydown',
'Blockly.test.lists',
'Blockly.test.logicTernary',
'Blockly.test.metrics',
'Blockly.test.mutator',
'Blockly.test.names',
'Blockly.test.procedureMap',
'Blockly.test.procedures',
'Blockly.test.registry',
'Blockly.test.renderManagement',
'Blockly.test.serialization',
'Blockly.test.shortcutRegistry',
'Blockly.test.touch',
'Blockly.test.theme',
'Blockly.test.toolbox',
'Blockly.test.tooltip',
'Blockly.test.trashcan',
'Blockly.test.utils',
'Blockly.test.variableMap',
'Blockly.test.variableModel',
'Blockly.test.variables',
'Blockly.test.widgetDiv',
'Blockly.test.workspaceComment',
'Blockly.test.workspaceSvg',
'Blockly.test.workspace',
'Blockly.test.xml',
'Blockly.test.zoomControls',
],
additionalScripts: [
'build/msg/en.js',
'tests/playgrounds/screenshot.js',
'node_modules/@blockly/dev-tools/dist/index.js',
],
};
</script>
<script src="../bootstrap.js"></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 type="module">
// Wait for Blockly to finish loading before running tests.
import '../bootstrap_done.mjs';
let runner = mocha.run(function (failures) {
var failureDiv = document.getElementById('failureCount');
failureDiv.setAttribute('tests_failed', failures);
});
runner.on('fail', function (test, err) {
const msg = document.createElement('p');
msg.textContent = `"${test.fullTitle()}" failed: ${err.message}`;
const div = document.getElementById('failureMessages');
div.appendChild(msg);
});
</script>
</body>
</html>