fix: FilterBox select lose focus when focused (#12114)

This commit is contained in:
Jesse Yang 2020-12-18 00:45:27 -08:00 committed by GitHub
parent 1cf4a1b3ea
commit af130ea5e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 19 deletions

View File

@ -65,27 +65,21 @@ describe('Dashboard filter', () => {
cy.wait(aliases); cy.wait(aliases);
}); });
}); });
xit('should apply filter', () => {
cy.get('.Select__control input[type=text]') it('should apply filter', () => {
.first() cy.get('.Select__placeholder:first').click();
.should('be.visible')
.focus();
// should open the filter indicator // should open the filter indicator
cy.get('[data-test="filter"]') cy.get('svg[data-test="filter"]')
.should('be.visible', { timeout: 10000 }) .should('be.visible')
.should(nodes => { .should(nodes => {
expect(nodes).to.have.length(9); // this part was not working, xit-ed expect(nodes).to.have.length(9);
}); });
cy.get('[data-test="chart-container"]').find('svg').should('be.visible'); cy.get('.Select__control:first input[type=text]').type('So', {
force: true,
cy.get('.Select__control input[type=text]').first().focus().blur(); delay: 100,
});
cy.get('.Select__control input[type=text]')
.first()
.focus()
.type('So', { force: true, delay: 100 });
cy.get('.Select__menu').first().contains('South Asia').click(); cy.get('.Select__menu').first().contains('South Asia').click();

View File

@ -19,6 +19,9 @@
"eslint-plugin-cypress": "^2.11.1" "eslint-plugin-cypress": "^2.11.1"
}, },
"nyc": { "nyc": {
"reporter": ["html", "json"] "reporter": [
"html",
"json"
]
} }
} }

View File

@ -102,7 +102,7 @@ const Styles = styled.div`
overflow: visible; overflow: visible;
`; `;
class FilterBox extends React.Component { class FilterBox extends React.PureComponent {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
@ -424,7 +424,6 @@ class FilterBox extends React.Component {
render() { render() {
const { instantFiltering } = this.props; const { instantFiltering } = this.props;
return ( return (
<Styles> <Styles>
{this.renderDateFilter()} {this.renderDateFilter()}