mirror of
https://github.com/apache/superset.git
synced 2026-04-11 04:15:33 +00:00
Add copy to clipboard buttons in explore and sqllab (#6461)
* Add copy to clipboard buttons in explore and sqllab * Eslint fixes * Review changes: deconstruct props, extract function to utils, add tests
This commit is contained in:
committed by
Hugh A. Miles II
parent
fc8acf27c8
commit
eb408d71c4
@@ -1,4 +1,4 @@
|
||||
import { isTruthy, optionFromValue } from '../../../src/utils/common';
|
||||
import { isTruthy, optionFromValue, prepareCopyToClipboardTabularData } from '../../../src/utils/common';
|
||||
|
||||
describe('utils/common', () => {
|
||||
describe('isTruthy', () => {
|
||||
@@ -48,4 +48,17 @@ describe('utils/common', () => {
|
||||
expect(optionFromValue(5)).toEqual({ value: 5, label: '5' });
|
||||
});
|
||||
});
|
||||
describe('prepareCopyToClipboardTabularData', () => {
|
||||
it('converts empty array', () => {
|
||||
const array = [];
|
||||
expect(prepareCopyToClipboardTabularData(array)).toEqual('');
|
||||
});
|
||||
it('converts non empty array', () => {
|
||||
const array = [
|
||||
{ column1: 'lorem', column2: 'ipsum' },
|
||||
{ column1: 'dolor', column2: 'sit', column3: 'amet' },
|
||||
];
|
||||
expect(prepareCopyToClipboardTabularData(array)).toEqual('lorem\tipsum\ndolor\tsit\tamet\n');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user