mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
chore: miscellaneous fixes to docs, style, and tests (#6705)
* docs(icon): Better description for Icon.prototype.setVisible Also tweak description of getBlock. * docs(blocks): Fix typo in description of BlockDefinition * chore(tests): Factor out common goog:chromeOptions * chore(build): Minor style fixes
This commit is contained in:
committed by
GitHub
parent
fccf8e436e
commit
3be3d4a6ff
@@ -14,7 +14,7 @@ goog.declareModuleId('Blockly.blocks');
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A block definition. For now this very lose, but it can potentially
|
* A block definition. For now this very loose, but it can potentially
|
||||||
* be refined e.g. by replacing this typedef with a class definition.
|
* be refined e.g. by replacing this typedef with a class definition.
|
||||||
*/
|
*/
|
||||||
export type BlockDefinition = AnyDuringMigration;
|
export type BlockDefinition = AnyDuringMigration;
|
||||||
|
|||||||
@@ -179,14 +179,14 @@ export abstract class Icon {
|
|||||||
// No-op on base class.
|
// No-op on base class.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show or hide the icon.
|
* Show or hide the bubble.
|
||||||
*
|
*
|
||||||
* @param _visible True if the icon should be visible.
|
* @param _visible True if the bubble should be visible.
|
||||||
*/
|
*/
|
||||||
setVisible(_visible: boolean) {}
|
setVisible(_visible: boolean) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the block this icon is attached to.
|
* @returns The block this icon is attached to.
|
||||||
*/
|
*/
|
||||||
protected getBlock(): BlockSvg {
|
protected getBlock(): BlockSvg {
|
||||||
if (!this.block_) {
|
if (!this.block_) {
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ function stripApacheLicense() {
|
|||||||
// Closure Compiler preserves dozens of Apache licences in the Blockly code.
|
// Closure Compiler preserves dozens of Apache licences in the Blockly code.
|
||||||
// Remove these if they belong to Google or MIT.
|
// Remove these if they belong to Google or MIT.
|
||||||
// MIT's permission to do this is logged in Blockly issue #2412.
|
// MIT's permission to do this is logged in Blockly issue #2412.
|
||||||
return gulp.replace(new RegExp(licenseRegex, "g"), '\n\n\n\n');
|
return gulp.replace(new RegExp(licenseRegex, 'g'), '\n\n\n\n');
|
||||||
// Replace with the same number of lines so that source-maps are not affected.
|
// Replace with the same number of lines so that source-maps are not affected.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ function generateMessages(done) {
|
|||||||
--input_file ${path.join('msg', 'messages.js')} \
|
--input_file ${path.join('msg', 'messages.js')} \
|
||||||
--output_dir ${path.join('msg', 'json')} \
|
--output_dir ${path.join('msg', 'json')} \
|
||||||
--quiet`;
|
--quiet`;
|
||||||
execSync(jsToJsonCmd, { stdio: 'inherit' });
|
execSync(jsToJsonCmd, {stdio: 'inherit'});
|
||||||
|
|
||||||
console.log(`
|
console.log(`
|
||||||
Regenerated several flies in msg/json/. Now run
|
Regenerated several flies in msg/json/. Now run
|
||||||
@@ -591,7 +591,7 @@ function getChunkOptions() {
|
|||||||
/**
|
/**
|
||||||
* RegExp that globally matches path.sep (i.e., "/" or "\").
|
* RegExp that globally matches path.sep (i.e., "/" or "\").
|
||||||
*/
|
*/
|
||||||
const pathSepRegExp = new RegExp(path.sep.replace(/\\/, '\\\\'), "g");
|
const pathSepRegExp = new RegExp(path.sep.replace(/\\/, '\\\\'), 'g');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for calling the Closure Compiler, establishing
|
* Helper method for calling the Closure Compiler, establishing
|
||||||
|
|||||||
@@ -42,22 +42,23 @@ async function runGeneratorsInBrowser(outputDir) {
|
|||||||
var options = {
|
var options = {
|
||||||
capabilities: {
|
capabilities: {
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
|
'goog:chromeOptions': {
|
||||||
|
args: ['--allow-file-access-from-files'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
services: ['selenium-standalone']
|
services: ['selenium-standalone']
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run in headless mode on Github Actions.
|
// Run in headless mode on Github Actions.
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
options.capabilities['goog:chromeOptions'] = {
|
options.capabilities['goog:chromeOptions'].args.push(
|
||||||
args: ['--headless', '--no-sandbox', '--disable-dev-shm-usage', '--allow-file-access-from-files']
|
'--headless', '--no-sandbox', '--disable-dev-shm-usage',);
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
// --disable-gpu is needed to prevent Chrome from hanging on Linux with
|
// --disable-gpu is needed to prevent Chrome from hanging on Linux with
|
||||||
// NVIDIA drivers older than v295.20. See
|
// NVIDIA drivers older than v295.20. See
|
||||||
// https://github.com/google/blockly/issues/5345 for details.
|
// https://github.com/google/blockly/issues/5345 for details.
|
||||||
options.capabilities['goog:chromeOptions'] = {
|
options.capabilities['goog:chromeOptions'].args.push('--disable-gpu');
|
||||||
args: ['--allow-file-access-from-files', '--disable-gpu']
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = 'file://' + __dirname + '/index.html';
|
var url = 'file://' + __dirname + '/index.html';
|
||||||
|
|||||||
@@ -21,27 +21,25 @@ async function runMochaTestsInBrowser() {
|
|||||||
const options = {
|
const options = {
|
||||||
capabilities: {
|
capabilities: {
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
|
'goog:chromeOptions': {
|
||||||
|
args: ['--allow-file-access-from-files'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
services: [
|
services: [
|
||||||
['selenium-standalone'],
|
['selenium-standalone'],
|
||||||
],
|
],
|
||||||
logLevel: 'warn',
|
logLevel: 'warn',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run in headless mode on Github Actions.
|
// Run in headless mode on Github Actions.
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
options.capabilities['goog:chromeOptions'] = {
|
options.capabilities['goog:chromeOptions'].args.push(
|
||||||
args: [
|
'--headless', '--no-sandbox', '--disable-dev-shm-usage',);
|
||||||
'--headless', '--no-sandbox', '--disable-dev-shm-usage',
|
|
||||||
'--allow-file-access-from-files',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
// --disable-gpu is needed to prevent Chrome from hanging on Linux with
|
// --disable-gpu is needed to prevent Chrome from hanging on Linux with
|
||||||
// NVIDIA drivers older than v295.20. See
|
// NVIDIA drivers older than v295.20. See
|
||||||
// https://github.com/google/blockly/issues/5345 for details.
|
// https://github.com/google/blockly/issues/5345 for details.
|
||||||
options.capabilities['goog:chromeOptions'] = {
|
options.capabilities['goog:chromeOptions'].args.push('--disable-gpu');
|
||||||
args: ['--allow-file-access-from-files', '--disable-gpu'],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = 'file://' + posixPath(__dirname) + '/index.html';
|
const url = 'file://' + posixPath(__dirname) + '/index.html';
|
||||||
|
|||||||
Reference in New Issue
Block a user