mirror of
https://github.com/apache/superset.git
synced 2024-09-06 22:07:34 -04:00
fix(dashboard): chart doesn't resize when tab switch (#22009)
This commit is contained in:
parent
ead2834a77
commit
309c064cc8
@ -22,6 +22,7 @@ import {
|
|||||||
getChartAliasBySpec,
|
getChartAliasBySpec,
|
||||||
} from 'cypress/utils';
|
} from 'cypress/utils';
|
||||||
import { TABBED_DASHBOARD } from 'cypress/utils/urls';
|
import { TABBED_DASHBOARD } from 'cypress/utils/urls';
|
||||||
|
import { expandFilterOnLeftPanel } from './utils';
|
||||||
|
|
||||||
const TREEMAP = { name: 'Treemap', viz: 'treemap' };
|
const TREEMAP = { name: 'Treemap', viz: 'treemap' };
|
||||||
const FILTER_BOX = { name: 'Region Filter', viz: 'filter_box' };
|
const FILTER_BOX = { name: 'Region Filter', viz: 'filter_box' };
|
||||||
@ -91,6 +92,7 @@ describe('Dashboard tabs', () => {
|
|||||||
cy.get('@row-level-tabs').last().click();
|
cy.get('@row-level-tabs').last().click();
|
||||||
waitForChartLoad(LINE_CHART);
|
waitForChartLoad(LINE_CHART);
|
||||||
cy.getBySel('grid-container').find('.line').should('be.visible');
|
cy.getBySel('grid-container').find('.line').should('be.visible');
|
||||||
|
cy.get('@row-level-tabs').first().click();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('should send new queries when tab becomes visible', () => {
|
it.skip('should send new queries when tab becomes visible', () => {
|
||||||
@ -166,4 +168,30 @@ describe('Dashboard tabs', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should update size when switch tab', () => {
|
||||||
|
cy.get('@top-level-tabs')
|
||||||
|
.last()
|
||||||
|
.click()
|
||||||
|
.should('have.class', 'ant-tabs-tab-active');
|
||||||
|
|
||||||
|
expandFilterOnLeftPanel();
|
||||||
|
|
||||||
|
cy.wait(1000);
|
||||||
|
|
||||||
|
cy.get('@top-level-tabs')
|
||||||
|
.first()
|
||||||
|
.click()
|
||||||
|
.should('have.class', 'ant-tabs-tab-active');
|
||||||
|
|
||||||
|
cy.wait(1000);
|
||||||
|
|
||||||
|
cy.get("[data-test-viz-type='treemap'] .chart-container").then(
|
||||||
|
$chartContainer => {
|
||||||
|
expect($chartContainer.get(0).scrollWidth).eq(
|
||||||
|
$chartContainer.get(0).offsetWidth,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -190,7 +190,9 @@ class Chart extends React.Component {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
nextProps.width !== this.props.width ||
|
nextProps.width !== this.props.width ||
|
||||||
nextProps.height !== this.props.height
|
nextProps.height !== this.props.height ||
|
||||||
|
nextProps.width !== this.state.width ||
|
||||||
|
nextProps.height !== this.state.height
|
||||||
) {
|
) {
|
||||||
clearTimeout(this.resizeTimeout);
|
clearTimeout(this.resizeTimeout);
|
||||||
this.resizeTimeout = setTimeout(this.resize, RESIZE_TIMEOUT);
|
this.resizeTimeout = setTimeout(this.resize, RESIZE_TIMEOUT);
|
||||||
|
Loading…
Reference in New Issue
Block a user