Changing radio input value when pressing space on it
Are you requesting a feature or reporting a bug?
Bug
What is the current behavior?
When a radio button is selected and you press space on it, the value of the radio button changes. The input state is toggled (checkt gets unchecked and vice versa).
What is the expected behavior?
The value does not change, but the state is toggled.
How would you reproduce the current behavior (if this is a bug)?
See test code below.
Provide the test code and the tested page URL (if applicable)
Tested page:
<!doctype html>
<html>
<head>
<title>Input radio test</title>
</head>
<body>
<input type="radio" id="radio-button" value="1234" name="radio-button" />
</body>
</html>
(I saved this file as index.html and served it with http-server . --cors -p 6000)
Test code
import { Selector } from 'testcafe';
fixture('radio button tests')
.page('http://localhost:6000');
test('radio button', async t => {
await t
.click('#radio-button')
.pressKey('space');
await t
.expect(Selector('#radio-button').value).eql('1234')
});
I would expect the test to pass, but it sais:
Running tests in:
- Chrome 64.0.3282 / Linux 0.0.0
radio button tests
✖ radio button
1) AssertionError: expected '1234 1234' to deeply equal '1234'
Browser: Chrome 64.0.3282 / Linux 0.0.0
7 | await t
8 | .click('#radio-button')
9 | .pressKey('space');
10 |
11 | await t
> 12 | .expect(Selector('#radio-button').value).eql('1234')
13 |});
at <anonymous> (minimal-setup/test.js:12:50)
1/1 failed (4s)
This also happens with checkbox elements
Specify your
- operating system: Ubuntu 16.04
- testcafe version: 0.19.0
- node.js version: 8.9.4
Hello @Satans-Kruemelmonster ,
Thank you for the provided tested page and test code. I have reproduced the issue. We will investigate it and update this thread as soon as we have any results.
Hi. Any update on this issue?
I'm also having a problem when using pressKey("space") the onChange event target value (e.target.value) is returning
"VALUE<SPACE>VALUE"
this is preventing us from adding certain keyboard navigation integration tests for accessibility purposes
Test code:
await t
.expect(accountsPage.submitButton.hasAttribute("disabled"))
.ok()
.debug()
.pressKey("tab")
.debug()
.pressKey("space")
.debug()
.expect(accountsPage.submitButton.hasAttribute("disabled"))
.notOk()
.pressKey("tab tab enter")
.expect(getPageUrl())
.contains("/confirm");
Thank you for sharing your use-case. We didn't manage to address this issue yet. Once we have any news, we will post them here.
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.