Skip to content

Commit 954a37a

Browse files
fix: ensure the pointer-init class is removed when updating the "locked" state (#6312)
fix: ensure the pointer init class is removed when updating locked status
1 parent 392d6c8 commit 954a37a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/core/src/dom_components/view/ComponentView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ TComp> {
241241
const hoveredCls = `${ppfx}hovered`;
242242
const noPointerCls = `${ppfx}no-pointer`;
243243
const pointerInitCls = `${ppfx}pointer-init`;
244-
const toRemove = [selectedCls, selectedParentCls, freezedCls, hoveredCls, noPointerCls];
244+
const toRemove = [selectedCls, selectedParentCls, freezedCls, hoveredCls, noPointerCls, pointerInitCls];
245245
const selCls = extHl && !opts.noExtHl ? '' : selectedCls;
246246
this.$el.removeClass(toRemove.join(' '));
247247
const actualCls = el.getAttribute('class') || '';

packages/core/test/specs/dom_components/view/ComponentView.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,20 @@ describe('ComponentView', () => {
143143
const result = model.getAttributes();
144144
expect(result.class).toEqual(undefined);
145145
});
146+
147+
test('updateStatus removes previous classes and adds new ones', () => {
148+
model.addClass('selected');
149+
150+
model.set('locked', true);
151+
view.updateStatus();
152+
expect(view.el.getAttribute('class')).toEqual('no-pointer');
153+
154+
model.set('locked', false);
155+
view.updateStatus();
156+
expect(view.el.getAttribute('class')).toEqual('pointer-init');
157+
158+
model.set('locked');
159+
view.updateStatus();
160+
expect(view.el.getAttribute('class')).toEqual('');
161+
});
146162
});

0 commit comments

Comments
 (0)