Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
webf
react-webf
Commits
d32aee44
Commit
d32aee44
authored
Jul 29, 2019
by
Mickaël Bourgier
Browse files
[TextField] Fix label and placeholder overlapping
parent
38837d26
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/TextField/TextField.js
View file @
d32aee44
...
...
@@ -59,6 +59,7 @@ class TextField extends Component {
(
value
!==
''
&&
value
!==
null
&&
value
!==
undefined
)
||
(
value
===
undefined
&&
valueIfUncontrolled
!==
''
)
||
focused
||
placeholder
||
type
===
'
date
'
||
type
===
'
time
'
});
...
...
src/TextField/TextField.test.js
View file @
d32aee44
...
...
@@ -54,5 +54,20 @@ describe('<TextField />', () => {
fireEvent
.
focus
(
input
);
expect
(
label
).
toHaveClass
(
labelUpClass
);
});
it
(
'
must be up when there is a placeholder
'
,
()
=>
{
const
labelUpClass
=
'
label-up-class
'
;
const
{
getByText
}
=
render
(
wrapToTest
()(
<
TextField
classes
=
{{
labelUp
:
labelUpClass
}}
label
=
'
Text field
'
placeholder
=
'
Placeholder
'
/>
)
);
expect
(
getByText
(
/Text field/
)).
toHaveClass
(
labelUpClass
);
});
});
});
src/TextField/demos/TextFieldProps.js
View file @
d32aee44
...
...
@@ -8,7 +8,7 @@ class TextFieldProps extends React.Component {
prenomField
:
''
,
errorField
:
'
Hello world !
'
,
disabledField
:
''
,
questionField
:
'
Réponse
'
questionField
:
''
};
handleChange
=
createCachedFunction
((
name
,
event
)
=>
{
...
...
@@ -54,6 +54,7 @@ class TextFieldProps extends React.Component {
<
Col
sm
>
<
TextField
label
=
'
Question ?
'
placeholder
=
'
Réponse...
'
value
=
{
questionField
}
disableUnderline
onChange
=
{
this
.
handleChange
(
'
questionField
'
)}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment