Merge branch 'next' into tunes-label-alias

This commit is contained in:
Tanya Fomina 2022-12-12 21:48:15 +02:00
commit d9949ca383
3 changed files with 61 additions and 1 deletions

View file

@ -4,6 +4,10 @@
- `Improvement`*Menu Config* — Property `label` renamed to `title`.
### 2.26.2
- `Fix`*Menu Config* — Installed tunes are rendered above default tunes again.
### 2.26.1
- `Improvement`*Menu Config* — Now it becomes possible to create toggle groups.

View file

@ -654,8 +654,8 @@ export default class Block extends EventsDispatcher<BlockEvents> {
/** Common tunes: combination of default tunes (move up, move down, delete) and third-party tunes connected via tunes api */
const commonTunes = [
...this.defaultTunesInstances.values(),
...this.tunesInstances.values(),
...this.defaultTunesInstances.values(),
].map(tuneInstance => tuneInstance.render());
[tunesDefinedInTool, commonTunes].flat().forEach(rendered => {

View file

@ -160,6 +160,9 @@ describe('Editor Tunes Api', () => {
},
];
}
/** Save method stub */
public save(): void {}
}
cy.createEditor({
@ -178,8 +181,61 @@ describe('Editor Tunes Api', () => {
.get('.ce-toolbar__settings-btn')
.click();
/** Check both tunes have correct text */
cy.get('[data-item-name=testTune1]').contains('Tune entry 1');
cy.get('[data-item-name=testTune2]').contains('Tune entry 2');
})
it('should display installed tunes above default tunes', () => {
/** Test tune that should appear be rendered in block tunes menu */
class TestTune {
/** Set Tool is Tune */
public static readonly isTune = true;
/** Tune's appearance in block settings menu */
public render(): TunesMenuConfig {
return [
{
icon: 'ICON',
label: 'Tune entry',
name: 'test-tune',
onActivate: (): void => { },
},
];
}
/** Save method stub */
public save(): void {}
}
cy.createEditor({
tools: {
testTune: TestTune,
},
tunes: [ 'testTune' ],
}).as('editorInstance');
cy.get('[data-cy=editorjs]')
.get('div.ce-block')
.type('some text')
.click();
cy.get('[data-cy=editorjs]')
.get('.ce-toolbar__settings-btn')
.click();
/** Check test tune is inserted at index 0 */
cy.get('[data-cy=editorjs]')
.get('.ce-settings .ce-popover__item')
.eq(0)
.should('have.attr', 'data-item-name', 'test-tune' );
/** Check default Move Up tune is inserted below the test tune */
cy.get('[data-cy=editorjs]')
.get('.ce-settings .ce-popover__item')
.eq(1)
.should('have.attr', 'data-item-name', 'move-up' );
});
});