mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
fix 'window.ResizeObserver is not a constructor' issue
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
parent
5d29b7b6f7
commit
242d459685
903
web/ui/react-app/package-lock.json
generated
903
web/ui/react-app/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -24,11 +24,9 @@
|
||||||
"codemirror-promql": "^0.17.0",
|
"codemirror-promql": "^0.17.0",
|
||||||
"css.escape": "^1.5.1",
|
"css.escape": "^1.5.1",
|
||||||
"downshift": "^3.4.8",
|
"downshift": "^3.4.8",
|
||||||
"enzyme-to-json": "^3.6.2",
|
|
||||||
"i": "^0.3.6",
|
"i": "^0.3.6",
|
||||||
"jquery": "^3.5.1",
|
"jquery": "^3.5.1",
|
||||||
"jquery.flot.tooltip": "^0.9.0",
|
"jquery.flot.tooltip": "^0.9.0",
|
||||||
"jsdom": "^17.0.0",
|
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"moment-timezone": "^0.5.23",
|
"moment-timezone": "^0.5.23",
|
||||||
"popper.js": "^1.14.3",
|
"popper.js": "^1.14.3",
|
||||||
|
@ -85,7 +83,9 @@
|
||||||
"@typescript-eslint/eslint-plugin": "4.x",
|
"@typescript-eslint/eslint-plugin": "4.x",
|
||||||
"@typescript-eslint/parser": "4.x",
|
"@typescript-eslint/parser": "4.x",
|
||||||
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
||||||
|
"canvas": "^2.8.0",
|
||||||
"enzyme": "^3.11.0",
|
"enzyme": "^3.11.0",
|
||||||
|
"enzyme-to-json": "^3.6.2",
|
||||||
"eslint": "7.x",
|
"eslint": "7.x",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-config-react-app": "^6.0.0",
|
"eslint-config-react-app": "^6.0.0",
|
||||||
|
|
|
@ -9,6 +9,20 @@ describe('Graph', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
jest.spyOn(window, 'requestAnimationFrame').mockImplementation((cb: any) => cb());
|
jest.spyOn(window, 'requestAnimationFrame').mockImplementation((cb: any) => cb());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// fix coming from https://github.com/maslianok/react-resize-detector#testing-with-enzyme-and-jest
|
||||||
|
beforeEach(() => {
|
||||||
|
window.ResizeObserver = jest.fn().mockImplementation(() => ({
|
||||||
|
observe: jest.fn(),
|
||||||
|
unobserve: jest.fn(),
|
||||||
|
disconnect: jest.fn(),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.ResizeObserver = ResizeObserver;
|
||||||
|
jest.restoreAllMocks();
|
||||||
|
});
|
||||||
describe('data is returned', () => {
|
describe('data is returned', () => {
|
||||||
const props: any = {
|
const props: any = {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class Graph extends PureComponent<GraphProps, GraphState> {
|
||||||
selectedExemplarLabels: { exemplar: {}, series: {} },
|
selectedExemplarLabels: { exemplar: {}, series: {} },
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidUpdate(prevProps: GraphProps) {
|
componentDidUpdate(prevProps: GraphProps): void {
|
||||||
const { data, stacked, useLocalTime, showExemplars } = this.props;
|
const { data, stacked, useLocalTime, showExemplars } = this.props;
|
||||||
if (prevProps.data !== data) {
|
if (prevProps.data !== data) {
|
||||||
this.selectedSeriesIndexes = [];
|
this.selectedSeriesIndexes = [];
|
||||||
|
@ -134,7 +134,9 @@ class Graph extends PureComponent<GraphProps, GraphState> {
|
||||||
this.destroyPlot();
|
this.destroyPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
plot = (data: (GraphSeries | GraphExemplar)[] = [...this.state.chartData.series, ...this.state.chartData.exemplars]) => {
|
plot = (
|
||||||
|
data: (GraphSeries | GraphExemplar)[] = [...this.state.chartData.series, ...this.state.chartData.exemplars]
|
||||||
|
): void => {
|
||||||
if (!this.chartRef.current) {
|
if (!this.chartRef.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue