This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from kristw/kristw-cherry-sep11
Cherry-picks: Update more chart types and css output optimization.
- Loading branch information
Showing
32 changed files
with
2,942 additions
and
1,134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
superset/assets/spec/javascripts/visualizations/table_spec.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import $ from 'jquery'; | ||
import '../../helpers/browser'; | ||
import tableVis from '../../../src/visualizations/table'; | ||
|
||
describe('table viz', () => { | ||
const div = '<div id="slice-container"><div class="dataTables_wrapper"></div></div>'; | ||
const baseSlice = { | ||
selector: '#slice-container', | ||
formData: { | ||
metrics: ['count'], | ||
timeseries_limit_metric: null, | ||
}, | ||
datasource: { | ||
verbose_map: {}, | ||
}, | ||
getFilters: () => ({}), | ||
removeFilter() {}, | ||
addFilter() {}, | ||
height: () => 0, | ||
}; | ||
const basePayload = { | ||
data: { | ||
records: [ | ||
{ gender: 'boy', count: 39245 }, | ||
{ gender: 'girl', count: 36446 }, | ||
], | ||
columns: ['gender', 'count'], | ||
}, | ||
}; | ||
|
||
it('renders into a container', () => { | ||
$('body').html(div); | ||
const container = $(baseSlice.selector); | ||
expect(container.length).to.equal(1); | ||
}); | ||
|
||
it('renders header and body datatables in container', () => { | ||
$('body').html(div); | ||
const container = $(baseSlice.selector); | ||
|
||
expect(container.find('.dataTable').length).to.equal(0); | ||
tableVis(baseSlice, basePayload); | ||
expect(container.find('.dataTable').length).to.equal(2); | ||
|
||
const tableHeader = container.find('.dataTable')[0]; | ||
expect($(tableHeader).find('thead tr').length).to.equal(1); | ||
expect($(tableHeader).find('th').length).to.equal(2); | ||
|
||
const tableBody = container.find('.dataTable')[1]; | ||
expect($(tableBody).find('tbody tr').length).to.equal(2); | ||
expect($(tableBody).find('th').length).to.equal(2); | ||
}); | ||
|
||
it('hides the sort by column', () => { | ||
$('body').html(div); | ||
const slice = { ...baseSlice }; | ||
slice.formData = { ...baseSlice.formData, | ||
timeseries_limit_metric: { | ||
label: 'SUM(sum_boys)', | ||
}, | ||
}; | ||
const payload = { | ||
data: { | ||
records: [ | ||
{ gender: 'boy', count: 39245, 'SUM(sum_boys)': 48133355 }, | ||
{ gender: 'girl', count: 36446, 'SUM(sum_boys)': 0 }, | ||
], | ||
columns: ['gender', 'count', 'SUM(sum_boys)'], | ||
}, | ||
}; | ||
tableVis(slice, payload); | ||
|
||
const container = $(slice.selector); | ||
const tableHeader = container.find('.dataTable')[0]; | ||
expect($(tableHeader).find('th').length).to.equal(2); | ||
}); | ||
|
||
it('works with empty list for sort by', () => { | ||
$('body').html(div); | ||
const slice = { ...baseSlice }; | ||
slice.formData = { ...baseSlice.formData, | ||
timeseries_limit_metric: [], | ||
}; | ||
const payload = { | ||
data: { | ||
records: [ | ||
{ gender: 'boy', count: 39245, 'SUM(sum_boys)': 48133355 }, | ||
{ gender: 'girl', count: 36446, 'SUM(sum_boys)': 0 }, | ||
], | ||
columns: ['gender', 'count', 'SUM(sum_boys)'], | ||
}, | ||
}; | ||
tableVis(slice, payload); | ||
|
||
const container = $(slice.selector); | ||
const tableBody = container.find('.dataTable')[1]; | ||
expect($(tableBody).find('th').length).to.equal(3); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.