Skip to content

Commit

Permalink
added testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Oct 16, 2024
1 parent 7fdc441 commit 612e421
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/cypress/tests/ui/toolbox.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,47 @@ describe('Toolbox', function () {
.find('.ce-popover-item__secondary-title')
.should('not.exist');
});

it('should display shortcut for the item if tool exports toolbox as an one item object', function () {
/**
* Mock of Tool with conversionConfig
*/
class ToolWithOneToolboxItems extends ToolMock {
/**
* Specify toolbox with several items related to one tool
*/
public static get toolbox(): ToolboxConfig {
return {
icon: '',
title: 'tool',
}
}
}

cy.createEditor({
tools: {
oneToolboxItemTool: {
class: ToolWithOneToolboxItems,
shortcut: 'CMD+SHIFT+L',
},
},
});

cy.get('[data-cy=editorjs]')
.find('.ce-paragraph')
.click()
.type('Some text')
.type('/'); // call a shortcut for toolbox

/**
* Secondary title (shortcut) should exist for toolbox item of the tool
*/
/* eslint-disable-next-line cypress/require-data-selectors */
cy.get('.ce-popover')
.find('.ce-popover-item[data-item-name="oneToolboxItemTool"]')
.first()
.find('.ce-popover-item__secondary-title')
.should('exist');
});
});
});

0 comments on commit 612e421

Please sign in to comment.