Browse Source
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
fix-components-from-defs
William DA SILVA
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
17 additions and
1 deletions
-
packages/core/src/dom_components/view/ComponentView.ts
-
packages/core/test/specs/dom_components/view/ComponentView.ts
|
|
|
@ -241,7 +241,7 @@ TComp> { |
|
|
|
const hoveredCls = `${ppfx}hovered`; |
|
|
|
const noPointerCls = `${ppfx}no-pointer`; |
|
|
|
const pointerInitCls = `${ppfx}pointer-init`; |
|
|
|
const toRemove = [selectedCls, selectedParentCls, freezedCls, hoveredCls, noPointerCls]; |
|
|
|
const toRemove = [selectedCls, selectedParentCls, freezedCls, hoveredCls, noPointerCls, pointerInitCls]; |
|
|
|
const selCls = extHl && !opts.noExtHl ? '' : selectedCls; |
|
|
|
this.$el.removeClass(toRemove.join(' ')); |
|
|
|
const actualCls = el.getAttribute('class') || ''; |
|
|
|
|
|
|
|
@ -143,4 +143,20 @@ describe('ComponentView', () => { |
|
|
|
const result = model.getAttributes(); |
|
|
|
expect(result.class).toEqual(undefined); |
|
|
|
}); |
|
|
|
|
|
|
|
test('updateStatus removes previous classes and adds new ones', () => { |
|
|
|
model.addClass('selected'); |
|
|
|
|
|
|
|
model.set('locked', true); |
|
|
|
view.updateStatus(); |
|
|
|
expect(view.el.getAttribute('class')).toEqual('no-pointer'); |
|
|
|
|
|
|
|
model.set('locked', false); |
|
|
|
view.updateStatus(); |
|
|
|
expect(view.el.getAttribute('class')).toEqual('pointer-init'); |
|
|
|
|
|
|
|
model.set('locked'); |
|
|
|
view.updateStatus(); |
|
|
|
expect(view.el.getAttribute('class')).toEqual(''); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|