-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into task/EMT141-Polic…
…y-UI-Route
- Loading branch information
Showing
17 changed files
with
561 additions
and
42 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
16 changes: 0 additions & 16 deletions
16
x-pack/legacy/plugins/canvas/public/lib/__tests__/clipboard.js
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
jest.mock('../../../../../../src/plugins/kibana_utils/public'); | ||
|
||
import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; | ||
import { setClipboardData, getClipboardData } from './clipboard'; | ||
import { LOCALSTORAGE_CLIPBOARD } from '../../common/lib/constants'; | ||
import { elements } from '../../__tests__/fixtures/workpads'; | ||
|
||
const set = jest.fn(); | ||
const get = jest.fn(); | ||
|
||
describe('clipboard', () => { | ||
beforeAll(() => { | ||
// @ts-ignore | ||
Storage.mockImplementation(() => ({ | ||
set, | ||
get, | ||
})); | ||
}); | ||
|
||
test('stores data to local storage', () => { | ||
setClipboardData(elements); | ||
|
||
expect(set).toBeCalledWith(LOCALSTORAGE_CLIPBOARD, JSON.stringify(elements)); | ||
}); | ||
|
||
test('gets data from local storage', () => { | ||
getClipboardData(); | ||
|
||
expect(get).toBeCalledWith(LOCALSTORAGE_CLIPBOARD); | ||
}); | ||
}); |
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,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; | ||
import { LOCALSTORAGE_CLIPBOARD } from '../../common/lib/constants'; | ||
import { getWindow } from './get_window'; | ||
|
||
let storage: Storage; | ||
|
||
const getStorage = (): Storage => { | ||
if (!storage) { | ||
storage = new Storage(getWindow().localStorage); | ||
} | ||
|
||
return storage; | ||
}; | ||
|
||
export const setClipboardData = (data: any) => { | ||
getStorage().set(LOCALSTORAGE_CLIPBOARD, JSON.stringify(data)); | ||
}; | ||
|
||
export const getClipboardData = () => getStorage().get(LOCALSTORAGE_CLIPBOARD); |
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
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
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.