Skip to content

Commit

Permalink
Merge pull request #81 from lyft/merge_apache_20191114a
Browse files Browse the repository at this point in the history
Merge apache 20191114a
  • Loading branch information
Beto Dealmeida authored Nov 14, 2019
2 parents 3d598ce + 33f9c36 commit dd42e68
Show file tree
Hide file tree
Showing 27 changed files with 2,084 additions and 327 deletions.
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

0 comments on commit dd42e68

Please sign in to comment.