Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge apache 20191114a #81

Merged
merged 3 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 89 additions & 88 deletions superset/assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 13 additions & 7 deletions superset/assets/spec/javascripts/sqllab/TabbedSqlEditors_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('TabbedSqlEditors', () => {
'newEditorId',
];

const tables = [Object.assign({}, table[0], {
const tables = [Object.assign({}, table, {
dataPreviewQueryId: 'B1-VQU1zW',
queryEditorId: 'newEditorId',
})];
Expand All @@ -58,6 +58,7 @@ describe('TabbedSqlEditors', () => {
'B1-VQU1zW': {
id: 'B1-VQU1zW',
sqlEditorId: 'newEditorId',
tableName: 'ab_user',
},
};
const mockedProps = {
Expand Down Expand Up @@ -133,7 +134,7 @@ describe('TabbedSqlEditors', () => {
});
it('should update queriesArray and dataPreviewQueries', () => {
expect(wrapper.state().queriesArray.slice(-1)[0]).toBe(queries['B1-VQU1zW']);
expect(wrapper.state().dataPreviewQueries.slice(-1)[0]).toBe(queries['B1-VQU1zW']);
expect(wrapper.state().dataPreviewQueries.slice(-1)[0]).toEqual(queries['B1-VQU1zW']);
});
});
it('should rename Tab', () => {
Expand Down Expand Up @@ -171,16 +172,21 @@ describe('TabbedSqlEditors', () => {
.toBe(queryEditors[0]);
});
it('should handle select', () => {
const mockEvent = {
target: {
getAttribute: () => null,
},
};
wrapper = getWrapper();
sinon.spy(wrapper.instance(), 'newQueryEditor');
sinon.stub(wrapper.instance().props.actions, 'setActiveQueryEditor');
sinon.stub(wrapper.instance().props.actions, 'switchQueryEditor');

wrapper.instance().handleSelect('add_tab');
wrapper.instance().handleSelect('add_tab', mockEvent);
expect(wrapper.instance().newQueryEditor.callCount).toBe(1);

wrapper.instance().handleSelect('123');
expect(wrapper.instance().props.actions.setActiveQueryEditor.getCall(0).args[0].id)
.toContain(123);
// cannot switch to current tab, switchQueryEditor never gets called
wrapper.instance().handleSelect('dfsadfs', mockEvent);
expect(wrapper.instance().props.actions.switchQueryEditor.callCount).toEqual(0);
wrapper.instance().newQueryEditor.restore();
});
it('should render', () => {
Expand Down
Loading