Skip to content

Commit

Permalink
update CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vitPinchuk committed Oct 2, 2024
1 parent 15df4d6 commit 37cbe80
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,15 @@ describe('AutosizeCodeEditor', () => {
expect(onEditorDidMount).toHaveBeenCalledTimes(4);
});

it('Should render mini map button and show/hide map', async () => {
it('Should render mini map button and show/hide map if value more or equal 100 characters', async () => {
const onChange = jest.fn();
const onEditorDidMount = jest.fn();

render(getComponent({ onEditorDidMount, onChange }));
const valueIn1000Rows = Array.from(new Array(1000))
.map((value, index) => index)
.join('\n');

render(getComponent({ value: valueIn1000Rows, onEditorDidMount, onChange }));

/**
* Check paste button
Expand Down Expand Up @@ -289,6 +293,23 @@ describe('AutosizeCodeEditor', () => {
expect(onEditorDidMount).toHaveBeenCalledTimes(4);
});

it('Should not render mini map button if value less than 100 characters', async () => {
const onChange = jest.fn();
const onEditorDidMount = jest.fn();

/**
* 99 characters
*/
const value = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore';

render(getComponent({ value: value, onEditorDidMount, onChange }));

/**
* Check paste button
*/
expect(selectors.miniMapButton(true)).not.toBeInTheDocument();
});

it('Should open/close modal on toolbar button', async () => {
const onChange = jest.fn();
const onEditorDidMount = jest.fn();
Expand Down

0 comments on commit 37cbe80

Please sign in to comment.