Skip to content

Commit

Permalink
refactor: . Extract helper verifyModalHTML() to remove repetition
Browse files Browse the repository at this point in the history
  • Loading branch information
claremacrae committed May 16, 2024
1 parent aeffe82 commit 94ed5c9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/ui/EditTask.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,25 +528,23 @@ describe('Edit Modal HTML snapshot tests', () => {
resetSettings();
});

it('should match snapshot', () => {
updateSettings({ provideAccessKeys: true });
function verifyModalHTML() {
const task = taskFromLine({ line: '- [ ] absolutely to do', path: '' });
const onSubmit = () => {};
const allTasks = [task];
const { container } = renderAndCheckModal(task, onSubmit, allTasks);

const prettyHTML = prettifyHTML(container.innerHTML);
verifyWithFileExtension(prettyHTML, 'html');
}

it('should match snapshot', () => {
updateSettings({ provideAccessKeys: true });
verifyModalHTML();
});

it('should match snapshot - without access keys', () => {
updateSettings({ provideAccessKeys: false });
const task = taskFromLine({ line: '- [ ] absolutely to do', path: '' });
const onSubmit = () => {};
const allTasks = [task];
const { container } = renderAndCheckModal(task, onSubmit, allTasks);

const prettyHTML = prettifyHTML(container.innerHTML);
verifyWithFileExtension(prettyHTML, 'html');
verifyModalHTML();
});
});

0 comments on commit 94ed5c9

Please sign in to comment.