Skip to content

Commit 0290f8a

Browse files
committed
fix(test): update toggleHeading test for cursor selection behavior
toggleHeading uses toggleLinkedStyle, which now supports cursor selections. Update the test to expect true (style applied) instead of false (rejected).
1 parent 8a03c46 commit 0290f8a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

packages/super-editor/src/extensions/heading/heading.test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ describe('Heading Extension', () => {
5656
});
5757

5858
describe('toggleHeading', () => {
59-
it('should return false for an empty selection', () => {
59+
it('should apply heading with a cursor (empty) selection', () => {
6060
tr.setSelection(TextSelection.create(tr.doc, 1)); // Cursor selection
6161
const result = editor.commands.toggleHeading({ level: 1 });
6262

63-
expect(result).toBe(false);
64-
const styleId = editor.state.doc.content.content[0].attrs.paragraphProperties?.styleId ?? null;
65-
expect(styleId).toBeNull();
63+
expect(result).toBe(true);
64+
expect(editor.state.doc.content.content[0].attrs.paragraphProperties?.styleId).toBe('Heading1');
6665
});
6766

6867
it('should toggle heading on for a paragraph', () => {

0 commit comments

Comments
 (0)