fix: copy to Clipboard order (#16299)

* copy to Clipboard order

* centralized copyToClipboard

* fixed table order

* fixed tests

* added colnames to all viz types

* added colnames to all viz types

* added colnames to all viz types
This commit is contained in:
AAfghahi
2021-08-24 17:47:09 -04:00
committed by GitHub
parent e71c6e60e4
commit 631ad02a76
10 changed files with 84 additions and 38 deletions

View File

@@ -46,15 +46,18 @@ describe('utils/common', () => {
describe('prepareCopyToClipboardTabularData', () => {
it('converts empty array', () => {
const array = [];
expect(prepareCopyToClipboardTabularData(array)).toEqual('');
const column = [];
expect(prepareCopyToClipboardTabularData(array, column)).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',
const column = ['column1', 'column2', 'column3'];
console.log(prepareCopyToClipboardTabularData(array, column));
expect(prepareCopyToClipboardTabularData(array, column)).toEqual(
'lorem\tipsum\t\ndolor\tsit\tamet\n',
);
});
});