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

Combobox: multiple fixes. #674

Closed
wants to merge 11 commits into from
Closed
1 change: 1 addition & 0 deletions Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ define([
}
this.dropDown.focus();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be there.

}.bind(this));
};
}),
Expand Down
1 change: 1 addition & 0 deletions Combobox/Combobox.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
attach-point="inputNode,focusNode"
autocomplete="off" autocorrect="off" autocapitalize="none"
aria-autocomplete="list"
aria-expanded="{{opened}}"
type="text"
readonly="{{this._inputReadOnly ? 'readonly' : ''}}"
placeholder="{{searchPlaceHolder}}">
Expand Down
37 changes: 37 additions & 0 deletions tests/unit/Combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,43 @@ define([
return d;
},

"inputNode: aria-expanded attribute on open/close popup": function () {
var combo = new Combobox({labelAttr: "name"});
var dataSource = new Memory(
{idProperty: "name",
data: [
{ name: "Japan", sales: 900, profit: 100, region: "Asia" },
{ name: "France", sales: 500, profit: 50, region: "EU" },
{ name: "Germany", sales: 450, profit: 48, region: "EU" },
{ name: "UK", sales: 700, profit: 60, region: "EU" },
{ name: "USA", sales: 2000, profit: 250, region: "America" },
{ name: "Canada", sales: 600, profit: 30, region: "America" },
{ name: "Brazil", sales: 450, profit: 30, region: "America" },
{ name: "China", sales: 500, profit: 40, region: "Asia" }
]});
combo.source = dataSource;
container.appendChild(combo);
combo.attachedCallback();
combo.deliver();

var d = this.async(2000);
console.log(combo.inputNode);
assert.strictEqual(combo.inputNode.getAttribute("aria-expanded"), "false",
"aria-expanded - popup is closed: " + combo.id);

combo.openDropDown().then(d.rejectOnError(function () {
assert.strictEqual(combo.inputNode.getAttribute("aria-expanded"), "true",
"aria-expanded - popup is open: " + combo.id);
combo.closeDropDown();
setTimeout(d.callback(function () {
assert.strictEqual(combo.inputNode.getAttribute("aria-expanded"), "false",
"aria-expanded - popup is closed: " + combo.id);
}), 200);
}));

return d;
},

Copy link
Member

@wkeese wkeese Dec 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this error after running grunt test:remote (with this changeset only):

× internet explorer 11 on Windows 8.1 - unit tests - deliteful/Combobox: programatic - inputNode: aria-expanded attribute on open/close popup (0.046s)
AssertionError: aria-expanded - popup is open: HasDropDown_233: expected 'false' to equal 'true'
No stack or location

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this happens only in IE11?
IIRC, there were some issues with events and IE, so some other tests were disabled for this environment.

// Test case for #509: initialization of Combobox after List rendering is ready.
// "initialization with List rendering after Combobox initialization": function () {
// var combo = new Combobox(); // single selection mode
Expand Down