Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-06 00:09:04 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-06 00:09:04 +0300
commit96e23b2017cbe56969771960f6c274c5d3599397 (patch)
treeb8b17da1ab080dd41fc64fc0262de2cf16754559 /spec/frontend/behaviors
parent2f1a81fd16ff9968d6b986f8a407d963bc2218f9 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/behaviors')
-rw-r--r--spec/frontend/behaviors/markdown/utils_spec.js18
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,
+ );
+ },
+ );
+});