Skip to content

Commit 1b8e776

Browse files
committed
chore: fixes
1 parent a73ff2f commit 1b8e776

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

packages/super-editor/src/components/context-menu/CellBackgroundPicker.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ const ensureCellSelection = () => {
3131
};
3232
3333
const handleSelect = (color) => {
34-
const value = color === 'none' ? null : color;
3534
ensureCellSelection();
36-
props.editor.commands.setCellBackground(value);
35+
if (color === 'none') {
36+
props.editor.commands.setCellAttr('background', null);
37+
} else {
38+
props.editor.commands.setCellBackground(color);
39+
}
3740
props.closePopover();
3841
};
3942
</script>

packages/super-editor/src/components/context-menu/tests/CellBackgroundPicker.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ describe('CellBackgroundPicker', () => {
4242
commands: {
4343
setCellSelection: vi.fn(),
4444
setCellBackground: vi.fn(),
45+
setCellAttr: vi.fn(),
4546
},
4647
};
4748
});
@@ -91,12 +92,14 @@ describe('CellBackgroundPicker', () => {
9192
expect(closePopover).toHaveBeenCalled();
9293
});
9394

94-
it('should map "none" to null for removing background', () => {
95+
it('should map "none" to setCellAttr(background, null) for removing background', () => {
9596
isCellSelection.mockReturnValue(true);
9697

9798
const wrapper = mountPicker();
9899
wrapper.findComponent({ name: 'IconGrid' }).vm.$emit('select', 'none');
99100

100-
expect(mockEditor.commands.setCellBackground).toHaveBeenCalledWith(null);
101+
expect(mockEditor.commands.setCellBackground).not.toHaveBeenCalled();
102+
expect(mockEditor.commands.setCellAttr).toHaveBeenCalledWith('background', null);
103+
expect(closePopover).toHaveBeenCalled();
101104
});
102105
});

0 commit comments

Comments
 (0)