Skip to content

Commit

Permalink
chore: missing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
marabesi committed Dec 17, 2022
1 parent 71abea6 commit 97c6139
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
30 changes: 29 additions & 1 deletion src/__test__/Settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import App from '../App';
import userEvent from '@testing-library/user-event';

describe('Settings', () => {
test.each([
it.each([
['foldGutter'],
['syntaxHighlighting'],
['history'],
Expand All @@ -18,6 +18,34 @@ describe('Settings', () => {
expect(getByText(option)).toBeInTheDocument();
});

it.each([
['foldGutter'],
['syntaxHighlighting'],
['highlightActiveLine'],
])('should mark option %s as true by default', (option: string) => {
const { getByTestId, getByLabelText } = render(<App/>);

fireEvent.click(getByTestId('settings'));

expect(getByLabelText(option)).toBeChecked();
});

it.each([
['history'],
['autocompletion'],
['closeBrackets'],
])('check option %s that is unchecked by default', async (option) => {
const { getByTestId, getByLabelText, getByText } = render(<App/>);

fireEvent.click(getByTestId('settings'));

expect(getByLabelText(option)).not.toBeChecked();

fireEvent.click(getByText(option));

expect(getByLabelText(option)).toBeChecked();
});

describe('editors font size', () => {
it('should use 12 as font size by default', () => {
const { getByTestId, getByDisplayValue } = render(<App/>);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/editor/default-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { EditorOptions, Option, Properties } from '../../../types/components/Edi
export const defaultOp: Option[] = [
{ title: 'foldGutter', active: true },
{ title: 'syntaxHighlighting', active : true },
{ title: 'history', active: false },
{ title: 'highlightActiveLine', active: true },
{ title: 'history', active: false },
{ title: 'autocompletion', active: false } ,
{ title: 'closeBrackets', active: false },
];
Expand Down

0 comments on commit 97c6139

Please sign in to comment.