Skip to content

Commit

Permalink
fix(combo-box): fix arrow icon not show in Solar when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
bualoy-napat authored Nov 30, 2021
1 parent cd7fb0c commit 55c1008
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
flex-shrink: 0;
}

&[disabled] [part~=selection-badge] {
opacity: 0.4;
}

.ie-scrollbars();
.mozilla-scrollbars();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,23 @@ describe('combo-box/Template', () => {
expect(styles.minWidth).to.equal('0px', 'min width is not reset');
});
});
describe('readonly and disabled attributes test', () => {
it('Input should be disabled when disabled attribute is set', async () => {
const el = await fixture('<ef-combo-box disabled></ef-combo-box>');
const input = el.shadowRoot.querySelector('[part=input]');

await elementUpdated(el);

expect(input.disabled).to.be.equal(true)
});

it('Input should be readonly when readonly attribute is set', async () => {
const el = await fixture('<ef-combo-box readonly></ef-combo-box>');
const input = el.shadowRoot.querySelector('[part=input]');

await elementUpdated(el);

expect(input.readonly).to.be.equal(true)
});
})
});
1 change: 1 addition & 0 deletions packages/elements/src/combo-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,7 @@ export class ComboBox<T extends DataItem = ItemData> extends ControlElement {
transparent
.placeholder="${this.placeholder}"
.readonly="${this.readonly}"
.disabled="${this.disabled}"
.value="${inputValue}"
@value-changed="${this.onInputValueChanged}"></ef-text-field>
${this.selectionBadgeTemplate}
Expand Down
12 changes: 12 additions & 0 deletions packages/solar-theme/src/custom-elements/ef-combo-box.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,16 @@
min-width: @size;
margin-top: 0;
}
&[disabled] {
[part~=icon] {
opacity: 0.4;
color: @button-disabled-text-color;
}

[part~=button-toggle] {
& when (@variant = pearl) {
border-color: @input-disabled-border-color;
}
}
}
}

0 comments on commit 55c1008

Please sign in to comment.