diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-06 00:09:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-06 00:09:04 +0300 |
commit | 96e23b2017cbe56969771960f6c274c5d3599397 (patch) | |
tree | b8b17da1ab080dd41fc64fc0262de2cf16754559 /spec/frontend/behaviors | |
parent | 2f1a81fd16ff9968d6b986f8a407d963bc2218f9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/behaviors')
-rw-r--r-- | spec/frontend/behaviors/markdown/utils_spec.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/frontend/behaviors/markdown/utils_spec.js b/spec/frontend/behaviors/markdown/utils_spec.js new file mode 100644 index 00000000000..f4e7ca621d9 --- /dev/null +++ b/spec/frontend/behaviors/markdown/utils_spec.js @@ -0,0 +1,18 @@ +import { toggleMarkCheckboxes } from '~/behaviors/markdown/utils'; + +describe('toggleMarkCheckboxes', () => { + const rawMarkdown = `- [x] todo 1\n- [ ] todo 2`; + + it.each` + assertionName | sourcepos | checkboxChecked | expectedMarkdown + ${'marks'} | ${'2:1-2:12'} | ${true} | ${'- [x] todo 1\n- [x] todo 2'} + ${'unmarks'} | ${'1:1-1:12'} | ${false} | ${'- [ ] todo 1\n- [ ] todo 2'} + `( + '$assertionName the checkbox at correct position', + ({ sourcepos, checkboxChecked, expectedMarkdown }) => { + expect(toggleMarkCheckboxes({ rawMarkdown, sourcepos, checkboxChecked })).toEqual( + expectedMarkdown, + ); + }, + ); +}); |