mirror of
https://github.com/google/blockly.git
synced 2026-01-12 11:27:14 +01:00
* chore(deps): Update closure/goog/base.js, add goog.js
- Update base.js from the latest version (20220502.0.0).
- Also copy over goog.js, which provides access to a suitable subset
of goog.* via an importable module).
* chore(build): Split gulpfiles/config.js exports object
This makes it possible for entries to depend on each other.
* chore(build): build config consistency
- Reorder entries in gulpfiles.config.js to better match order they
are used.
- Have update_metadata.sh reference config.js and vice versa.
* refactor(build): Move deps.js (+ deps.mocha.js) from test/ to build/
Once we start using tsc, deps.js will be created based on the ouptut
of tsc rather than the raw source in core/. Since tsc will need to
be run before running closure-make-deps and also before trying to
load blockly_uncompressed.js, it doesn't really make sense to check
in deps.js; it's better to re-create as needed.
To reduce inconvenience, a new "prepare" script is added to
package.json which will run the buildDeps gulp target automaticaly
when one runs npm install.
* refactor(build): Always build from TypeScript sources
- Add buildJavaScript gulp task to use tsc to compile any .ts files
in core/ into build/src/core/ (and also copy any .js files that
are not yet migrated to TypeScript, which for now is all of them.
- Remove closure/goog from explicit inputs to tsc; it will find
the files it needs (e.g., goog.js) automatically.
- Have buildDeps, the playground, and all the tests that run in
uncompiled mode use build/src/core/ instead of core/ as their
input directory.
* feat(build): Add buildJavaScriptAndDeps gulp task
Have npm run build:deps (and npm run prepare) use a new gulp task,
buildJavaScriptAndDeps, to run tsc followed by closure-make-deps,
ensuring that deps.js is calculated based on the most recent code
in core/.
* fix(build): Fix implementation of flattenCorePaths
Even though this function is going away I want to remove it in
a separate PR so that we can revert easily if desired. But the
previous checked-in code was totally wrong. This version works.
* fix(build): Don't let checkinBuilt copy build/src/**
Now that we are putting a lot more stuff in build/ (specifically,
all the tsc output in build/src/), modify checkinBuilt so that it
only copies the specific things we want to check in (for now):
- _compressed.js build artifacts and their accompanying .js.maps
- the generated build/msg/js/*.js language files.
Unrelatedly, also fix safety-quoting of arguments for one execSync
call.
192 lines
7.3 KiB
HTML
192 lines
7.3 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="../../build/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>
|
|
<div id="failureMessages" style="display:none"></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>
|
|
mocha.setup({
|
|
ui: 'tdd',
|
|
failZero: true,
|
|
});
|
|
</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.libraryBlocks.colour');
|
|
goog.require('Blockly.libraryBlocks.logic');
|
|
goog.require('Blockly.libraryBlocks.lists');
|
|
goog.require('Blockly.libraryBlocks.loops');
|
|
goog.require('Blockly.libraryBlocks.math');
|
|
goog.require('Blockly.libraryBlocks.procedures');
|
|
goog.require('Blockly.libraryBlocks.texts');
|
|
goog.require('Blockly.libraryBlocks.variables');
|
|
goog.require('Blockly.libraryBlocks.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.commentDeserialization');
|
|
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.lists');
|
|
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>
|
|
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>
|