From 97dd938bfa63482f7220765de369f445a0fd18d7 Mon Sep 17 00:00:00 2001 From: Georgy Berezhnoy Date: Sun, 11 Apr 2021 21:42:32 +0300 Subject: [PATCH] Fix #1640 --- src/components/modules/tools.ts | 8 ++++++-- test/cypress/tests/modules/Tools.spec.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/modules/tools.ts b/src/components/modules/tools.ts index fdd7c12e..27c04ff8 100644 --- a/src/components/modules/tools.ts +++ b/src/components/modules/tools.ts @@ -359,18 +359,22 @@ export default class Tools extends Module { } if (Array.isArray(tool.enabledBlockTunes)) { - tool.tunes = new ToolsCollection( + const userTunes = new ToolsCollection( tool.enabledBlockTunes.map(name => [name, this.blockTunes.get(name)]) ); + tool.tunes = new ToolsCollection([...userTunes, ...this.blockTunes.internalTools]); + return; } if (Array.isArray(this.config.tunes)) { - tool.tunes = new ToolsCollection( + const userTunes = new ToolsCollection( this.config.tunes.map(name => [name, this.blockTunes.get(name)]) ); + tool.tunes = new ToolsCollection([...userTunes, ...this.blockTunes.internalTools]); + return; } diff --git a/test/cypress/tests/modules/Tools.spec.ts b/test/cypress/tests/modules/Tools.spec.ts index 24a884f8..ff57b6a5 100644 --- a/test/cypress/tests/modules/Tools.spec.ts +++ b/test/cypress/tests/modules/Tools.spec.ts @@ -204,12 +204,20 @@ describe('Tools module', () => { expect(Array.from(module.blockTools.values()).every(tool => tool.isBlock())).to.be.true; }); + it('Block Tools should contain default tunes', () => { + let tool = module.blockTools.get('blockTool'); + + expect(tool.tunes.has('deleteTune')).to.be.true; + expect(tool.tunes.has('moveUpTune')).to.be.true; + expect(tool.tunes.has('moveDownTune')).to.be.true; + }); + it('Block Tools should contain tunes in correct order', () => { let tool = module.blockTools.get('blockTool'); expect(tool.tunes.has('blockTune')).to.be.true; expect(tool.tunes.has('blockTune2')).to.be.true; - expect(Array.from(tool.tunes.keys())).to.be.deep.eq(['blockTune2', 'blockTune']); + expect(Array.from(tool.tunes.keys())).to.be.deep.eq(['blockTune2', 'blockTune', 'moveUpTune', 'deleteTune', 'moveDownTune']); tool = module.blockTools.get('withSuccessfulPrepare');