mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-01 05:12:13 +00:00
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>
10 lines
483 B
TypeScript
10 lines
483 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('- [ ] task', 0, true)).toBeNull();
|
|
expect(toggleTasklistCheckbox('- [ ] task', 99, true)).toBeNull();
|
|
expect(toggleTasklistCheckbox('😀 - [ ] task', 8, true)).toEqual('😀 - [x] task');
|
|
});
|