-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add TextInput.setText #90
base: master
Are you sure you want to change the base?
Conversation
* @param newValue New value for this text input. | ||
*/ | ||
public void setText(String newValue) { | ||
getWrappedElement().sendKeys(getClearCharSequence() + newValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead the getClearCharSequence() +
should be added to TextInput.sendKeys
method. This way everybody who wants to change input value has no need to prepend it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would break backward compatibility and would be counterintuitive.
Also there may be situations when you don't want to clear anything, you just want to press a key.
Add some tests please |
There are tests for |
If you move logic of deleting text to setText method, you should move corresponding tests as well. |
@Test | ||
public void setTextShouldNotAddClearKeysForTextInputWithEmptyText() { | ||
when(webElement.getAttribute("value")).thenReturn(""); | ||
textInput.setText("qwerty"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is assertion for this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
👍 (just need to fix merge issue) |
@@ -37,6 +37,15 @@ public void sendKeys(CharSequence... keys) { | |||
} | |||
|
|||
/** | |||
* Sets this text input's value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps be explicit about using getClearCharSequence()
and not using clear()
?
No description provided.