diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2017-09-01 09:04:22 -0500 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-09-01 09:04:22 -0500 |
commit | 3145895fd573d223e559592e5cefb351f9d9323f (patch) | |
tree | d407095af6b0b4770eacb79d37c40e109b7bc8c4 | |
parent | 24ba47e13fe12a62d9a064cabcda447115b4e88b (diff) | |
download | gitlab-ce-3145895fd573d223e559592e5cefb351f9d9323f.tar.gz |
Tidy up specs
-rw-r--r-- | spec/javascripts/feature_highlight/feature_highlight_spec.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/javascripts/feature_highlight/feature_highlight_spec.js b/spec/javascripts/feature_highlight/feature_highlight_spec.js index 225229b7277..6abe8425ee7 100644 --- a/spec/javascripts/feature_highlight/feature_highlight_spec.js +++ b/spec/javascripts/feature_highlight/feature_highlight_spec.js @@ -1,8 +1,5 @@ import Cookies from 'js-cookie'; -import { - showPopover, - hidePopover, -} from '~/feature_highlight/feature_highlight_helper'; +import * as featureHighlightHelper from '~/feature_highlight/feature_highlight_helper'; import * as featureHighlight from '~/feature_highlight/feature_highlight'; describe('feature highlight', () => { @@ -30,20 +27,22 @@ describe('feature highlight', () => { it('setups popover content', () => { const $popoverContent = $('.feature-highlight-popover-content'); const outerHTML = $popoverContent.prop('outerHTML'); + expect($(selector).data('content')).toEqual(outerHTML); }); it('setups mouseenter', () => { - const showSpy = spyOn(showPopover, 'call'); + const showSpy = spyOn(featureHighlightHelper.showPopover, 'call'); $(selector).trigger('mouseenter'); expect(showSpy).toHaveBeenCalled(); }); it('setups debounced mouseleave', (done) => { - const hideSpy = spyOn(hidePopover, 'call'); + const hideSpy = spyOn(featureHighlightHelper.hidePopover, 'call'); $(selector).trigger('mouseleave'); + // Even though we've set the debounce to 0ms, setTimeout is needed for the debounce setTimeout(() => { expect(hideSpy).toHaveBeenCalled(); done(); @@ -54,6 +53,7 @@ describe('feature highlight', () => { $(selector).trigger('mouseenter'); const popoverId = $(selector).attr('aria-describedby'); const spyEvent = spyOnEvent(`#${popoverId} .dismiss-feature-highlight`, 'click'); + $(`#${popoverId} .dismiss-feature-highlight`).click(); expect(spyEvent).toHaveBeenTriggered(); }); |