md-select - include ng-reflect-open as an element attribute
Bug, feature request, or proposal:
It is not easy to verify or determine if an md-select's option window is displayed, or which of many md-select options are open even if one determines the .mat-select-panel is displayed. A child of the <md-select> is a <!--bindings={ "ng-reflect-open": "true" } -->. When the options window is closed, the value is "false". It would be good to move this binding into the <md-select> as an attribute: <md-select ng-reflect-open="true">
What is the use-case or motivation for changing an existing behavior?
For automation testers, it allows them to verify and make use of md-select elements in a programmatic manner in determining when a select window is open or closed.
Basic verification:
let stateSelect = element(by.css(md-select.state));
expect(stateSelect.getAttribute('ng-reflect-open')).toEqual('true');
Use in a page object model project (typescript example):
export class MdSelectModel {
constructor(public readonly mdSelect: ElementFinder) {}
readonly options: ElementFinder = $$('md-option');
readonly placeholder: ElementFinder = this.mdSelect.$('.mat-select-placeholder');
readonly value: ElementFinder = this.mdSelect.$('.mat-select-value');
// ...
isOpen(): protractor.Promise<string> {
return this.mdSelect.getAttribute('ng-reflect-open');
}
// ...
}
I always figured those ng-reflect-* are reserved for internal/debugging use...
What if .mat-select-open was added to md-select?
host: {
// ...
'[class.mat-select-open]': 'panelOpen'
}
They are and they're removed when you run the app in production mode. The proper way to do this is to use @ViewChild(MdSelect) and check the panelOpen property.
Closing as solution was mentioned above.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.