mirror of
https://github.com/apache/superset.git
synced 2024-09-18 19:49:37 -04:00
fix(sqllab): missing zero values while copy-to-clipboard (#21153)
This commit is contained in:
parent
d41f44fcdf
commit
4e23d62d4f
@ -97,7 +97,7 @@ export function prepareCopyToClipboardTabularData(data, columns) {
|
|||||||
// JavaScript does not maintain the order of a mixed set of keys (i.e integers and strings)
|
// JavaScript does not maintain the order of a mixed set of keys (i.e integers and strings)
|
||||||
// the below function orders the keys based on the column names.
|
// the below function orders the keys based on the column names.
|
||||||
const key = columns[j].name || columns[j];
|
const key = columns[j].name || columns[j];
|
||||||
if (data[i][key]) {
|
if (key in data[i]) {
|
||||||
row[j] = data[i][key];
|
row[j] = data[i][key];
|
||||||
} else {
|
} else {
|
||||||
row[j] = data[i][parseFloat(key)];
|
row[j] = data[i][parseFloat(key)];
|
||||||
|
@ -59,6 +59,16 @@ describe('utils/common', () => {
|
|||||||
'lorem\tipsum\t\ndolor\tsit\tamet\n',
|
'lorem\tipsum\t\ndolor\tsit\tamet\n',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('includes 0 values', () => {
|
||||||
|
const array = [
|
||||||
|
{ column1: 0, column2: 0 },
|
||||||
|
{ column1: 1, column2: -1, 0: 0 },
|
||||||
|
];
|
||||||
|
const column = ['column1', 'column2', '0'];
|
||||||
|
expect(prepareCopyToClipboardTabularData(array, column)).toEqual(
|
||||||
|
'0\t0\t\n1\t-1\t0\n',
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('applyFormattingToTabularData', () => {
|
describe('applyFormattingToTabularData', () => {
|
||||||
it('does not mutate empty array', () => {
|
it('does not mutate empty array', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user