diff options
author | Stas Vilchik <stas-vilchik@users.noreply.github.com> | 2017-05-09 17:53:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-09 17:53:29 +0200 |
commit | 72e45fffdea16673f257cb80b40269e73ccffaba (patch) | |
tree | 5684e5790e20da795b6f4f10c4343e42386364fb /server/sonar-web/src/main/js/helpers/testUtils.js | |
parent | 56fd51b9750c20b1c502789c37632d3e60012b0f (diff) | |
download | sonarqube-72e45fffdea16673f257cb80b40269e73ccffaba.tar.gz sonarqube-72e45fffdea16673f257cb80b40269e73ccffaba.zip |
MMF-661 rework search (#2030)
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/testUtils.js')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/testUtils.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/testUtils.js b/server/sonar-web/src/main/js/helpers/testUtils.js index 96b718cc64b..4ae17931866 100644 --- a/server/sonar-web/src/main/js/helpers/testUtils.js +++ b/server/sonar-web/src/main/js/helpers/testUtils.js @@ -26,6 +26,11 @@ export const mockEvent = { export const click = (element, event = {}) => element.simulate('click', { ...mockEvent, ...event }); +export const clickOutside = (event = {}) => { + const dispatchedEvent = new MouseEvent('click', event); + window.dispatchEvent(dispatchedEvent); +}; + export const submit = element => element.simulate('submit', { preventDefault() {} @@ -41,3 +46,11 @@ export const keydown = keyCode => { const event = new KeyboardEvent('keydown', { keyCode }); document.dispatchEvent(event); }; + +export const elementKeydown = (element, keyCode) => { + element.simulate('keydown', { + currentTarget: { element }, + keyCode, + preventDefault() {} + }); +}; |