mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-12 17:53:24 +00:00
Backport #40334 by @SudhanshuMatrix Markdown renders `[X]` as a checked task like `[x]`, but parts of the frontend only recognize lowercase `x`. - Clicking a `[X]` checkbox now unchecks it instead of failing. - Pressing Enter on a `- [X]` line in the editor continues the list with `- [ ] ` instead of dropping the checkbox. Assisted-by: Claude Code:claude-opus-5-5 Co-authored-by: Shudhanshu Singh <sudhanshuwriterblc@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
11 lines
563 B
TypeScript
11 lines
563 B
TypeScript
import {toggleTasklistCheckbox} from './tasklist.ts';
|
|
|
|
test('toggleTasklistCheckbox', () => {
|
|
expect(toggleTasklistCheckbox('- [ ] task', 3, true)).toEqual('- [x] task');
|
|
expect(toggleTasklistCheckbox('- [x] task', 3, false)).toEqual('- [ ] task');
|
|
expect(toggleTasklistCheckbox('- [X] task', 3, false)).toEqual('- [ ] task');
|
|
expect(toggleTasklistCheckbox('- [ ] task', 0, true)).toBeNull();
|
|
expect(toggleTasklistCheckbox('- [ ] task', 99, true)).toBeNull();
|
|
expect(toggleTasklistCheckbox('😀 - [ ] task', 8, true)).toEqual('😀 - [x] task');
|
|
});
|