mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
* [sql lab] fix position of 'save query' Popover The "Save Query" popover renders on the upper left corner as opposed to where it should (relative to the Save Query button). After a bit of research, it seems like Popover won't render in the right place when parents are absolute. I'm guessing this stopped working properly when I added the resizable panes. Anyhow, the solution here is to use a modal instead. * Fixing tests
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { FormControl } from 'react-bootstrap';
|
|
import { shallow } from 'enzyme';
|
|
import { describe, it } from 'mocha';
|
|
import { expect } from 'chai';
|
|
import SaveQuery from '../../../javascripts/SqlLab/components/SaveQuery';
|
|
import ModalTrigger from '../../../javascripts/components/ModalTrigger';
|
|
|
|
describe('SavedQuery', () => {
|
|
const mockedProps = {
|
|
dbId: 1,
|
|
schema: 'main',
|
|
sql: 'SELECT * FROM t',
|
|
defaultLabel: 'untitled',
|
|
animation: false,
|
|
};
|
|
it('is valid', () => {
|
|
expect(
|
|
React.isValidElement(<SaveQuery />),
|
|
).to.equal(true);
|
|
});
|
|
it('is valid with props', () => {
|
|
expect(
|
|
React.isValidElement(<SaveQuery {...mockedProps} />),
|
|
).to.equal(true);
|
|
});
|
|
it('has a ModalTrigger', () => {
|
|
const wrapper = shallow(<SaveQuery {...mockedProps} />);
|
|
expect(wrapper.find(ModalTrigger)).to.have.length(1);
|
|
});
|
|
it('has a cancel button', () => {
|
|
const wrapper = shallow(<SaveQuery {...mockedProps} />);
|
|
const modal = shallow(wrapper.instance().renderModalBody());
|
|
expect(modal.find('.cancelQuery')).to.have.length(1);
|
|
});
|
|
it('has 2 FormControls', () => {
|
|
const wrapper = shallow(<SaveQuery {...mockedProps} />);
|
|
const modal = shallow(wrapper.instance().renderModalBody());
|
|
expect(modal.find(FormControl)).to.have.length(2);
|
|
});
|
|
});
|