Skip to content
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

fix: fixed expanding disabled select #6776

Merged
merged 2 commits into from Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/ui/select-element.js
Expand Up @@ -144,7 +144,7 @@ function createChildren (children, parent) {
export function expandOptionList (select) {
const selectChildren = select.children;

if (!selectChildren.length)
if (!selectChildren.length || select.disabled)
return;

//NOTE: check is option list expanded
Expand Down
14 changes: 14 additions & 0 deletions test/functional/fixtures/regression/gh-5616/pages/index.html
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>gh-5616</title>
</head>
<body>
<select disabled>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</body>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-5616/test.js
@@ -0,0 +1,5 @@
describe('[Regression](GH-5616)', function () {
it('Element "select" shouldn\'t be opened', function () {
return runTests('testcafe-fixtures/index.js');
});
});
@@ -0,0 +1,9 @@
import { Selector } from 'testcafe';

fixture`Click on "select" element`
.page('http://localhost:3000/fixtures/regression/gh-5616/pages/index.html');

test('Element "select" shouldn\'t be opened', async (t) => {
await t.click('select');
await t.expect(Selector('option').filterVisible().count).eql(0);
});