fix(explore): Prevent shared controls from checking feature flags outside React render (#21315)

This commit is contained in:
Cody Leff
2022-09-14 14:41:47 -04:00
committed by GitHub
parent 59ca7861c0
commit 2285ebe72e
21 changed files with 285 additions and 435 deletions

View File

@@ -18,6 +18,7 @@
*/
import React from 'react';
import userEvent from '@testing-library/user-event';
import { FeatureFlag } from '@superset-ui/core';
import {
render,
screen,
@@ -67,6 +68,14 @@ const adhocMetricB = {
optionName: 'def',
};
beforeAll(() => {
window.featureFlags = { [FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP]: true };
});
afterAll(() => {
window.featureFlags = {};
});
test('renders with default props', () => {
render(<DndMetricSelect {...defaultProps} />, { useDnd: true });
expect(screen.getByText('Drop column or metric here')).toBeInTheDocument();