You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The input should be rendered with disabled attribute
What is actually happening?
The input is not rendered at all
Additional comments
When <ElSelect /> is disabled, the input is not rendered. This causes a lot of issues in unit tests and breaks patterns often followed by testing-library, namely
getByLabelText queries are not working, because the id from the label's for attribute is assigned to the input, which is not rendered - it becomes hard to find <ElSelect /> elements in the document without using explicit testid attributes
Assertions like expect(select).toBeDisabled are not working, because the input is not rendered
Apart from that, recent changes to the dom structure of this component also caused these to not work
getByDisplayValue is not working, because the value is not assigned to the input element inside the <ElSelect />
getByPlaceholderText is not working, because the placeholder is rendered as a span element, instead of being an attribute on the input element
getByPlaceholderText is not working when there is a value selected, because then the placeholder is not displayed in the dom
The text was updated successfully, but these errors were encountered:
btea
linked a pull request
Oct 4, 2024
that will
close
this issue
Bug Type:
Component
Environment
3.5.10
2.8.4
any
Vite
Reproduction
Related Component
el-select
Reproduction Link
Element Plus Playground
Steps to reproduce
Add a disabled prop to the select component
What is Expected?
The input should be rendered with disabled attribute
What is actually happening?
The input is not rendered at all
Additional comments
When
<ElSelect />
is disabled, the input is not rendered. This causes a lot of issues in unit tests and breaks patterns often followed by testing-library, namelygetByLabelText
queries are not working, because the id from the label's for attribute is assigned to the input, which is not rendered - it becomes hard to find<ElSelect />
elements in the document without using explicit testid attributesexpect(select).toBeDisabled
are not working, because the input is not renderedApart from that, recent changes to the dom structure of this component also caused these to not work
getByDisplayValue
is not working, because the value is not assigned to the input element inside the<ElSelect />
getByPlaceholderText
is not working, because the placeholder is rendered as a span element, instead of being an attribute on the input elementgetByPlaceholderText
is not working when there is a value selected, because then the placeholder is not displayed in the domThe text was updated successfully, but these errors were encountered: