chore(rich-select): revert delegate of disabled on readonly for invoker

This commit is contained in:
Joren Broekema 2019-10-11 14:15:46 +02:00 committed by Thomas Allmer
parent 8c5ea8c1c4
commit abf82f61e6
3 changed files with 1 additions and 19 deletions

View file

@ -42,13 +42,6 @@ export class LionSelectInvoker extends LionButton {
this.type = 'button'; this.type = 'button';
} }
_requestUpdate(name, oldValue) {
super._requestUpdate(name, oldValue);
if (name === 'readOnly') {
this.disabled = this.readOnly;
}
}
_contentTemplate() { _contentTemplate() {
if (this.selectedElement) { if (this.selectedElement) {
const labelNodes = Array.from(this.selectedElement.querySelectorAll('*')); const labelNodes = Array.from(this.selectedElement.querySelectorAll('*'));

View file

@ -48,13 +48,6 @@ describe('lion-select-invoker', () => {
expect(el.getAttribute('tabindex')).to.equal('0'); expect(el.getAttribute('tabindex')).to.equal('0');
}); });
it('delegates the readonly attribute to disabled', async () => {
const el = await fixture(html`
<lion-select-invoker readonly></lion-select-invoker>
`);
expect(el.hasAttribute('disabled')).to.be.true;
});
describe('Subclassers', () => { describe('Subclassers', () => {
it('supports a custom _contentTemplate', async () => { it('supports a custom _contentTemplate', async () => {
const myTag = defineCE( const myTag = defineCE(

View file

@ -70,7 +70,7 @@ describe('lion-select-rich', () => {
expect(el._invokerNode.selectedElement).to.equal(el.querySelectorAll('lion-option')[1]); expect(el._invokerNode.selectedElement).to.equal(el.querySelectorAll('lion-option')[1]);
}); });
it('delegates readonly to the invoker, where disabled is added on top of this to disable opening', async () => { it('delegates readonly to the invoker', async () => {
const el = await fixture(html` const el = await fixture(html`
<lion-select-rich readonly> <lion-select-rich readonly>
<lion-options slot="input"> <lion-options slot="input">
@ -81,11 +81,7 @@ describe('lion-select-rich', () => {
`); `);
expect(el.hasAttribute('readonly')).to.be.true; expect(el.hasAttribute('readonly')).to.be.true;
// rich select is not disabled, so value is still serialized in forms when readonly
expect(el.hasAttribute('disabled')).to.be.false;
expect(el._invokerNode.hasAttribute('readonly')).to.be.true; expect(el._invokerNode.hasAttribute('readonly')).to.be.true;
// invoker node has disabled, to disable it from being clicked
expect(el._invokerNode.hasAttribute('disabled')).to.be.true;
}); });
}); });