mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-25 04:00:33 +08:00
Make task list checkboxes clickable in the preview tab (#37010)
When a checkbox is toggled in the markup preview tab, the change is now synced back to the editor textarea. Extracted a `toggleTasklistCheckbox` helper to deduplicate the byte-offset toggle logic. --------- Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
This commit is contained in:
9
web_src/js/markup/tasklist.test.ts
Normal file
9
web_src/js/markup/tasklist.test.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
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('- [ ] task', 0, true)).toBeNull();
|
||||
expect(toggleTasklistCheckbox('- [ ] task', 99, true)).toBeNull();
|
||||
expect(toggleTasklistCheckbox('😀 - [ ] task', 8, true)).toEqual('😀 - [x] task');
|
||||
});
|
||||
Reference in New Issue
Block a user