diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/blob_viewers/rich_viewer_spec.js')
-rw-r--r-- | spec/frontend/vue_shared/components/blob_viewers/rich_viewer_spec.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/frontend/vue_shared/components/blob_viewers/rich_viewer_spec.js b/spec/frontend/vue_shared/components/blob_viewers/rich_viewer_spec.js index 6acd1f51a86..1f3029435ee 100644 --- a/spec/frontend/vue_shared/components/blob_viewers/rich_viewer_spec.js +++ b/spec/frontend/vue_shared/components/blob_viewers/rich_viewer_spec.js @@ -1,3 +1,4 @@ +import { nextTick } from 'vue'; import { shallowMount } from '@vue/test-utils'; import { handleBlobRichViewer } from '~/blob/viewer'; import RichViewer from '~/vue_shared/components/blob_viewers/rich_viewer.vue'; @@ -21,16 +22,24 @@ describe('Blob Rich Viewer component', () => { } beforeEach(() => { + const execImmediately = (callback) => callback(); + jest.spyOn(window, 'requestIdleCallback').mockImplementation(execImmediately); + createComponent(); }); + it('listens to requestIdleCallback', () => { + expect(window.requestIdleCallback).toHaveBeenCalled(); + }); + it('renders the passed content without transformations', () => { expect(wrapper.html()).toContain(content); }); - it('renders the richViewer if one is present', () => { + it('renders the richViewer if one is present', async () => { const richViewer = '<div class="js-pdf-viewer"></div>'; createComponent('pdf', richViewer); + await nextTick(); expect(wrapper.html()).toContain(richViewer); }); |