From c40435efb7d84bb7658060f188f960a23073d80a Mon Sep 17 00:00:00 2001 From: Jared Stoffan Date: Mon, 5 Apr 2021 15:36:35 -0700 Subject: [PATCH] chore(loading): Remove sub-header progress bar experience (#1348) --- src/lib/Preview.js | 17 +-- src/lib/Preview.scss | 1 - src/lib/PreviewUI.js | 37 ----- src/lib/ProgressBar.js | 127 ------------------ src/lib/ProgressBar.scss | 22 --- src/lib/__tests__/Preview-test.js | 38 ------ src/lib/__tests__/PreviewUI-test.js | 35 +---- src/lib/__tests__/ProgressBar-test.html | 1 - src/lib/__tests__/ProgressBar-test.js | 124 ----------------- src/lib/constants.js | 4 - src/lib/events.js | 2 - src/lib/viewers/box3d/Box3DViewer.js | 2 - .../box3d/__tests__/Box3DViewer-test.js | 9 -- src/lib/viewers/doc/DocBaseViewer.js | 4 +- .../doc/__tests__/DocBaseViewer-test.js | 1 - 15 files changed, 6 insertions(+), 418 deletions(-) delete mode 100644 src/lib/ProgressBar.js delete mode 100644 src/lib/ProgressBar.scss delete mode 100644 src/lib/__tests__/ProgressBar-test.html delete mode 100644 src/lib/__tests__/ProgressBar-test.js diff --git a/src/lib/Preview.js b/src/lib/Preview.js index 3c5a82c4b..ee0c7ab11 100644 --- a/src/lib/Preview.js +++ b/src/lib/Preview.js @@ -870,10 +870,9 @@ class Preview extends EventEmitter { // Update navigation this.ui.showNavigation(this.file.id, this.collection); - // Setup loading UI and progress bar + // Setup loading indicator this.ui.showLoadingIcon(this.file.extension); this.ui.showLoadingIndicator(); - this.ui.startProgressBar(); // Start the preview duration timer when the user starts to perceive preview's load const previewDurationTag = Timer.createTag(this.file.id, DURATION_METRIC); @@ -929,9 +928,6 @@ class Preview extends EventEmitter { // Whether the loading indicator should be shown this.options.showLoading = options.showLoading !== false; - // Whether the progress indicator should be shown - this.options.showProgress = options.showProgress !== false; - // Whether annotations v4 buttons should be shown in toolbar this.options.showAnnotationsControls = !!options.showAnnotationsControls; @@ -1264,12 +1260,6 @@ class Preview extends EventEmitter { case VIEWER_EVENT.load: this.finishLoading(data.data); break; - case VIEWER_EVENT.progressStart: - this.ui.startProgressBar(); - break; - case VIEWER_EVENT.progressEnd: - this.ui.finishProgressBar(); - break; case VIEWER_EVENT.error: // Do nothing since 'error' event was already caught, and will be emitted // as a 'preview_error' event @@ -1373,11 +1363,6 @@ class Preview extends EventEmitter { } } - // Finish the progress bar unless instructed not to - if (data.endProgress !== false) { - this.ui.finishProgressBar(); - } - // Programmatically focus on the viewer after it loads if (this.options.autoFocus && this.viewer && this.viewer.containerEl) { this.viewer.containerEl.focus(); diff --git a/src/lib/Preview.scss b/src/lib/Preview.scss index 6df3fe019..f2fbef167 100644 --- a/src/lib/Preview.scss +++ b/src/lib/Preview.scss @@ -2,5 +2,4 @@ @import 'loading'; @import 'navigation'; @import './Controls'; -@import './ProgressBar'; @import './VirtualScroller'; diff --git a/src/lib/PreviewUI.js b/src/lib/PreviewUI.js index 000985470..34d57bfdf 100644 --- a/src/lib/PreviewUI.js +++ b/src/lib/PreviewUI.js @@ -1,6 +1,5 @@ import LoadingIcon from './LoadingIcon'; import Notification from './Notification'; -import ProgressBar from './ProgressBar'; import shellTemplate from './shell.html'; import { CLASS_BOX_PREVIEW_BASE_HEADER, @@ -49,9 +48,6 @@ class PreviewUI { /** @property {HTMLElement} - Preview container element which houses the sidebar and content */ previewContainer; - /** @property {ProgressBar} - Progress bar instance */ - progressBar; - /** * Destroy preview container content. * @@ -59,10 +55,6 @@ class PreviewUI { * @return {void} */ cleanup() { - if (this.progressBar) { - this.progressBar.destroy(); - } - if (this.previewContainer) { this.previewContainer.removeEventListener('mousemove', this.mousemoveHandler); } @@ -131,11 +123,6 @@ class PreviewUI { this.destroyLoading(); } - // Setup progress bar - if (options.showProgress) { - this.progressBar = new ProgressBar(this.container); - } - // Attach keyboard events document.addEventListener('keydown', this.keydownHandler); @@ -274,30 +261,6 @@ class PreviewUI { this.previewContainer.classList.add(CLASS_PREVIEW_LOADED); } - /** - * Shows and starts a progress bar at the top of the preview. - * - * @public - * @return {void} - */ - startProgressBar() { - if (this.progressBar) { - this.progressBar.start(); - } - } - - /** - * Finishes and hides the top progress bar if present. - * - * @public - * @return {void} - */ - finishProgressBar() { - if (this.progressBar) { - this.progressBar.finish(); - } - } - /** * Setup notification * diff --git a/src/lib/ProgressBar.js b/src/lib/ProgressBar.js deleted file mode 100644 index 46ab46e54..000000000 --- a/src/lib/ProgressBar.js +++ /dev/null @@ -1,127 +0,0 @@ -import { - CLASS_IS_VISIBLE, - CLASS_BOX_PREVIEW_PROGRESS_BAR, - CLASS_BOX_PREVIEW_PROGRESS_BAR_CONTAINER, -} from './constants'; - -const PROGRESS_INTERVAL_MS = 150; - -class ProgressBar { - /** - * [constructor] - * - * @param {HTMLElement} mountEl - Element to mount progress bar to - * @return {ProgressBar} Instance of ProgressBar - */ - constructor(mountEl) { - this.mountEl = mountEl; - this.containerEl = document.createElement('div'); - this.containerEl.classList.add(CLASS_BOX_PREVIEW_PROGRESS_BAR_CONTAINER); - - this.progressBarEl = document.createElement('div'); - this.progressBarEl.classList.add(CLASS_BOX_PREVIEW_PROGRESS_BAR); - - this.containerEl.appendChild(this.progressBarEl); - this.mountEl.appendChild(this.containerEl); - } - - /** - * [destructor] - * - * @return {void} - */ - destroy() { - if (!this.progressBarEl) { - return; - } - - clearInterval(this.progressInterval); - - if (this.mountEl) { - this.mountEl.removeChild(this.containerEl); - } - - this.containerEl = null; - this.progressBarEl = null; - } - - /** - * Start progress bar loading. - * - * @public - * @return {void} - */ - start() { - this.showProgress(); - - this.progress = 0; - this.progressInterval = setInterval(() => { - // Randomly up to 80%, then slowly approaching 95 - if (this.progress >= 95) { - clearInterval(this.progressInterval); - return; - } - if (this.progress >= 80) { - this.progress += Math.random(); - } else { - this.progress += Math.random() * 5; - } - - this.updateProgress(this.progress); - }, PROGRESS_INTERVAL_MS); - } - - /** - * Finish progress bar loading and reset. - * - * @public - * @return {void} - */ - finish() { - // Hide progress bar, this animation finishesafter progress is updated to 100% - this.hideProgress(); - - // Stop updating progress bar and force progress to 100% - clearInterval(this.progressInterval); - this.updateProgress(100); - } - - /** - * Update progress. - * - * @private - * @param {number} progress - Progress percentage - * @return {void} - */ - updateProgress(progress) { - if (this.progressBarEl) { - this.progressBarEl.style.width = `${progress}%`; - } - } - - /** - * Show progress bar. - * - * @private - * @return {void} - */ - showProgress() { - if (this.progressBarEl) { - this.progressBarEl.classList.add(CLASS_IS_VISIBLE); - } - } - - /** - * Hide progress bar. - * - * @private - * @return {void} - */ - hideProgress() { - if (this.progressBarEl) { - this.progressBarEl.classList.remove(CLASS_IS_VISIBLE); - } - } -} - -export default ProgressBar; diff --git a/src/lib/ProgressBar.scss b/src/lib/ProgressBar.scss deleted file mode 100644 index 838fced57..000000000 --- a/src/lib/ProgressBar.scss +++ /dev/null @@ -1,22 +0,0 @@ -@import 'boxuiVariables'; - -.bp-progress-bar-container { - position: absolute; - width: 100%; - - .bp-header ~ & { - top: 48px; - } -} - -.bp-progress-bar { - width: 0%; - height: 3px; - background-color: $box-blue; - opacity: 0; - transition: opacity .3s ease-in, width .2s ease-in; - - &.bp-is-visible { - opacity: 1; - } -} diff --git a/src/lib/__tests__/Preview-test.js b/src/lib/__tests__/Preview-test.js index 8952a4009..6962447e8 100644 --- a/src/lib/__tests__/Preview-test.js +++ b/src/lib/__tests__/Preview-test.js @@ -1218,7 +1218,6 @@ describe('lib/Preview', () => { previewUIMock.expects('setup'); previewUIMock.expects('showLoadingIcon'); previewUIMock.expects('showLoadingIndicator'); - previewUIMock.expects('startProgressBar'); previewUIMock.expects('showNavigation'); previewUIMock.expects('setupNotification'); @@ -1320,15 +1319,6 @@ describe('lib/Preview', () => { expect(preview.options.showLoading).toBe(false); }); - test('should set whether to show progress indicators', () => { - preview.parseOptions(preview.previewOptions); - expect(preview.options.showProgress).toBe(true); - - preview.previewOptions.showProgress = false; - preview.parseOptions(preview.previewOptions); - expect(preview.options.showProgress).toBe(false); - }); - test('should set whether to skip load from the server and any server updates', () => { preview.parseOptions(preview.previewOptions); expect(preview.options.skipServerUpdate).toBe(false); @@ -1784,11 +1774,6 @@ describe('lib/Preview', () => { }); describe('handleViewerEvents()', () => { - beforeEach(() => { - jest.spyOn(preview.ui, 'startProgressBar').mockImplementation(); - jest.spyOn(preview.ui, 'finishProgressBar').mockImplementation(); - }); - test('should call download on download event', () => { jest.spyOn(preview, 'download').mockImplementation(); preview.handleViewerEvents({ event: VIEWER_EVENT.download }); @@ -1807,16 +1792,6 @@ describe('lib/Preview', () => { expect(preview.finishLoading).toBeCalled(); }); - test('should start progress bar on progressstart event', () => { - preview.handleViewerEvents({ event: VIEWER_EVENT.progressStart }); - expect(preview.ui.startProgressBar).toBeCalled(); - }); - - test('should finish progress bar on progressend event', () => { - preview.handleViewerEvents({ event: VIEWER_EVENT.progressEnd }); - expect(preview.ui.finishProgressBar).toBeCalled(); - }); - test('should emit viewerevent when event does not match', () => { jest.spyOn(preview, 'emit'); const data = { @@ -1867,7 +1842,6 @@ describe('lib/Preview', () => { stubs.emit = jest.spyOn(preview, 'emit'); stubs.logPreviewEvent = jest.spyOn(preview, 'logPreviewEvent'); stubs.prefetchNextFiles = jest.spyOn(preview, 'prefetchNextFiles'); - stubs.finishProgressBar = jest.spyOn(preview.ui, 'finishProgressBar').mockImplementation(); stubs.setupNotification = jest.spyOn(preview.ui, 'setupNotification').mockImplementation(); stubs.perf = { @@ -1970,18 +1944,6 @@ describe('lib/Preview', () => { expect(callPhantomSpy).toBeCalled(); }); - test('should postload if skipPostload is not true', () => { - preview.finishLoading(); - expect(stubs.finishProgressBar).toBeCalled(); - }); - - test('should skip postload if skipPostload is true', () => { - preview.finishLoading({ - endProgress: false, - }); - expect(stubs.finishProgressBar).not.toBeCalled(); - }); - test('should focus the viewer container', () => { preview.options.autoFocus = true; preview.viewer.containerEl = { diff --git a/src/lib/__tests__/PreviewUI-test.js b/src/lib/__tests__/PreviewUI-test.js index 382dd6be8..55cad40d2 100644 --- a/src/lib/__tests__/PreviewUI-test.js +++ b/src/lib/__tests__/PreviewUI-test.js @@ -23,7 +23,6 @@ describe('lib/PreviewUI', () => { options = { container: containerEl, showLoading: true, - showProgress: true, }; }); @@ -33,10 +32,9 @@ describe('lib/PreviewUI', () => { }); describe('cleanup()', () => { - test('should destroy progress bar, clean up shell, and remove event listeners', () => { + test('should clean up shell and remove event listeners', () => { const resultEl = ui.setup(options, handler, null, null, handler); - jest.spyOn(ui.progressBar, 'destroy'); const contentContainerEl = containerEl.querySelector(constants.SELECTOR_BOX_PREVIEW); sandbox .mock(contentContainerEl) @@ -49,26 +47,23 @@ describe('lib/PreviewUI', () => { ui.cleanup(); - expect(ui.progressBar.destroy).toBeCalled(); expect(resultEl).toBeEmptyDOMElement(); }); }); describe('setup()', () => { - test('should setup shell structure, header, progress bar, and loading state', () => { + test('should setup shell structure, header, and loading state', () => { const resultEl = ui.setup(options); expect(resultEl).toBe(containerEl.querySelector(constants.SELECTOR_BOX_PREVIEW_CONTAINER)); expect(resultEl).toContainSelector(constants.SELECTOR_BOX_PREVIEW_HEADER); - expect(resultEl).toContainSelector(constants.SELECTOR_BOX_PREVIEW_PROGRESS_BAR); // Check loading state expect(resultEl).toContainSelector(constants.SELECTOR_BOX_PREVIEW_ICON); }); - test('should not setup the progress bar or loading state if their respective option is false', () => { - const resultEl = ui.setup({ container: containerEl, showLoading: false, showProgress: false }); - expect(resultEl).not.toContainSelector(constants.SELECTOR_BOX_PREVIEW_PROGRESS_BAR); + test('should not setup the loading state if their respective option is false', () => { + const resultEl = ui.setup({ container: containerEl, showLoading: false }); expect(resultEl).not.toContainSelector(constants.SELECTOR_BOX_PREVIEW_ICON); }); @@ -232,28 +227,6 @@ describe('lib/PreviewUI', () => { }); }); - describe('startProgressBar()', () => { - test('should start the progress bar', () => { - ui.progressBar = { - start: jest.fn(), - }; - - ui.startProgressBar(); - expect(ui.progressBar.start).toBeCalled(); - }); - }); - - describe('finishProgressBar()', () => { - test('should finish the progress bar', () => { - ui.progressBar = { - finish: jest.fn(), - }; - - ui.finishProgressBar(); - expect(ui.progressBar.finish).toBeCalled(); - }); - }); - describe('showNotification()', () => { test('should show a notification message', () => { ui.notification = { diff --git a/src/lib/__tests__/ProgressBar-test.html b/src/lib/__tests__/ProgressBar-test.html deleted file mode 100644 index d4321cd9b..000000000 --- a/src/lib/__tests__/ProgressBar-test.html +++ /dev/null @@ -1 +0,0 @@ -
\ No newline at end of file diff --git a/src/lib/__tests__/ProgressBar-test.js b/src/lib/__tests__/ProgressBar-test.js deleted file mode 100644 index 5ee701903..000000000 --- a/src/lib/__tests__/ProgressBar-test.js +++ /dev/null @@ -1,124 +0,0 @@ -/* eslint-disable no-unused-expressions */ -import ProgressBar from '../ProgressBar'; - -const sandbox = sinon.createSandbox(); -let mountEl; -let progressBar; - -describe('lib/ProgressBar', () => { - beforeEach(() => { - fixture.load('__tests__/ProgressBar-test.html'); - mountEl = document.querySelector('.mount'); - progressBar = new ProgressBar(mountEl); - }); - - afterEach(() => { - fixture.cleanup(); - sandbox.verifyAndRestore(); - - if (progressBar && typeof progressBar.destroy() === 'function') { - progressBar.destroy(); - } - - progressBar = null; - }); - - describe('ProgressBar()', () => { - test('should set up progress bar structure', () => { - expect(progressBar.containerEl).toHaveClass('bp-progress-bar-container'); - expect(progressBar.progressBarEl).toHaveClass('bp-progress-bar'); - expect(progressBar.containerEl.children).toContain(progressBar.progressBarEl); - expect(progressBar.mountEl.children).toContain(progressBar.containerEl); - }); - }); - - describe('destroy()', () => { - test('should clear progress interval and unmount the progress bar', () => { - sandbox - .mock(window) - .expects('clearInterval') - .withArgs(progressBar.progressInterval); - progressBar.destroy(); - expect(mountEl.querySelector('.bp-progress-bar-container')).toBeNull(); - }); - }); - - describe('start()', () => { - let clock; - - beforeEach(() => { - clock = sinon.useFakeTimers(); - }); - - afterEach(() => { - clock.restore(); - }); - - test('should show the progress bar and set progress to 0', () => { - sandbox.mock(progressBar).expects('showProgress'); - jest.spyOn(window, 'setInterval'); - - progressBar.start(); - expect(progressBar.progress).toBe(0); - }); - - test('should set an interval to update progress', () => { - jest.spyOn(progressBar, 'showProgress'); - progressBar.start(); - - // Simulate one progress bar tick - clock.tick(151); - expect(progressBar.progress).not.toBe(0); - }); - - test('should clear the interval when progress is >= 95', () => { - jest.spyOn(progressBar, 'showProgress'); - sandbox - .mock(window) - .expects('clearInterval') - .withArgs(sinon.match.number); - - progressBar.start(); - progressBar.progress = 95; - - // Simulate one progress bar tick after we reach the limit - clock.tick(151); - }); - }); - - describe('finish()', () => { - test('should hide the progress bar, clear the interval, and update progress to 100', () => { - const mock = sandbox.mock(progressBar); - mock.expects('hideProgress'); - mock.expects('updateProgress').withArgs(100); - sandbox - .mock(window) - .expects('clearInterval') - .withArgs(progressBar.progressInterval); - progressBar.finish(); - }); - }); - - describe('updateProgress()', () => { - test("should update the progress bar element's width", () => { - const progress = 57; - progressBar.updateProgress(progress); - expect(progressBar.progressBarEl.style.width).toBe(`${progress}%`); - }); - }); - - describe('showProgress()', () => { - test('should show the progress bar', () => { - progressBar.showProgress(); - expect(progressBar.progressBarEl).toHaveClass('bp-is-visible'); - }); - }); - - describe('hideProgress()', () => { - test('should hide the progress bar', () => { - progressBar.progressBarEl.classList.add('bp-is-visible'); - progressBar.hideProgress(); - expect(progressBar.progressBarEl).not.toHaveClass('bp-is-visible'); - }); - }); -}); diff --git a/src/lib/constants.js b/src/lib/constants.js index cff9c9ecd..c2268906b 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -32,8 +32,6 @@ export const CLASS_BOX_PREVIEW_PRELOAD_OVERLAY = 'bp-preload-overlay'; export const CLASS_BOX_PREVIEW_PRELOAD_SPINNER = 'bp-preload-spinner'; export const CLASS_BOX_PREVIEW_PRELOAD_WRAPPER_DOCUMENT = 'bp-document-preload-wrapper'; export const CLASS_BOX_PREVIEW_PRELOAD_WRAPPER_PRESENTATION = 'bp-presentation-preload-wrapper'; -export const CLASS_BOX_PREVIEW_PROGRESS_BAR = 'bp-progress-bar'; -export const CLASS_BOX_PREVIEW_PROGRESS_BAR_CONTAINER = 'bp-progress-bar-container'; export const CLASS_BOX_PREVIEW_NOTIFICATION = 'bp-notification'; export const CLASS_BOX_PREVIEW_NOTIFICATION_WRAPPER = 'bp-notifications-wrapper'; export const CLASS_BOX_PREVIEW_TOGGLE_OVERLAY = 'bp-toggle-overlay'; @@ -73,9 +71,7 @@ export const SELECTOR_BOX_PREVIEW_HEADER_CONTAINER = `.${CLASS_BOX_PREVIEW_HEADE export const SELECTOR_BOX_PREVIEW_ICON = `.${CLASS_BOX_PREVIEW_ICON}`; export const SELECTOR_BOX_PREVIEW_LOGO_CUSTOM = `.${CLASS_BOX_PREVIEW_LOGO_CUSTOM}`; export const SELECTOR_BOX_PREVIEW_LOGO_DEFAULT = `.${CLASS_BOX_PREVIEW_LOGO_DEFAULT}`; -export const SELECTOR_BOX_PREVIEW_PROGRESS_BAR = `.${CLASS_BOX_PREVIEW_PROGRESS_BAR}`; export const SELECTOR_BOX_PREVIEW_NOTIFICATION = `.${CLASS_BOX_PREVIEW_NOTIFICATION}`; -export const SELECTOR_BOX_PREVIEW_THUMBNAILS_CONTAINER = `.${CLASS_BOX_PREVIEW_THUMBNAILS_CONTAINER}`; export const PERMISSION_DOWNLOAD = 'can_download'; export const PERMISSION_PREVIEW = 'can_preview'; diff --git a/src/lib/events.js b/src/lib/events.js index 7da834cb5..36ebdb641 100644 --- a/src/lib/events.js +++ b/src/lib/events.js @@ -9,8 +9,6 @@ export const VIEWER_EVENT = { notificationHide: 'notificationhide', // Hide notification modal. notificationShow: 'notificationshow', // Show notification modal. printSuccess: 'printsuccess', // When printing is successful - progressEnd: 'progressend', // Stop using loading indicator. - progressStart: 'progressstart', // Begin using loading indicator. reload: 'reload', // Reload preview. thumbnailsClose: 'thumbnailsClose', // When thumbnails sidebar closes thumbnailsOpen: 'thumbnailsOpen', // When thumbnails sidebar opens diff --git a/src/lib/viewers/box3d/Box3DViewer.js b/src/lib/viewers/box3d/Box3DViewer.js index 01bd2ff2c..06f8c217e 100644 --- a/src/lib/viewers/box3d/Box3DViewer.js +++ b/src/lib/viewers/box3d/Box3DViewer.js @@ -17,7 +17,6 @@ import { } from './box3DConstants'; import JS from './box3DAssets'; import './Box3D.scss'; -import { VIEWER_EVENT } from '../../events'; // Milliseconds to wait for model to load before cancelling Preview const LOAD_TIMEOUT = 50000; @@ -248,7 +247,6 @@ class Box3DViewer extends BaseViewer { handleContextRestored() { this.detachEventHandlers(); this.contextNotification.show('WebGL Context Restored'); - this.emit(VIEWER_EVENT.progressStart); this.previewUI.showLoadingIndicator(); this.postLoad(); } diff --git a/src/lib/viewers/box3d/__tests__/Box3DViewer-test.js b/src/lib/viewers/box3d/__tests__/Box3DViewer-test.js index 6aa30d125..bfcfdde21 100644 --- a/src/lib/viewers/box3d/__tests__/Box3DViewer-test.js +++ b/src/lib/viewers/box3d/__tests__/Box3DViewer-test.js @@ -16,7 +16,6 @@ import { EVENT_TOGGLE_VR, EVENT_WEBGL_CONTEXT_RESTORED, } from '../box3DConstants'; -import { VIEWER_EVENT } from '../../../events'; import { SELECTOR_BOX_PREVIEW_CONTENT } from '../../../constants'; const sandbox = sinon.createSandbox(); @@ -534,14 +533,6 @@ describe('lib/viewers/box3d/Box3DViewer', () => { }); describe('handleContextRestored()', () => { - test('should call emit() with params ["progressstart"]', () => { - jest.spyOn(box3d, 'emit').mockImplementation(); - - box3d.handleContextRestored(); - - expect(box3d.emit).toBeCalledWith(VIEWER_EVENT.progressStart); - }); - test('should call detachEventHandlers', () => { const detachHandlers = jest.spyOn(box3d, 'detachEventHandlers'); box3d.handleContextRestored(); diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 91a059811..d2100e4fe 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -1150,7 +1150,6 @@ class DocBaseViewer extends BaseViewer { this.emit(VIEWER_EVENT.load, { encoding: this.encoding, numPages: pagesCount, - endProgress: false, // Indicate that viewer will end progress later scale: currentScale, }); @@ -1207,10 +1206,9 @@ class DocBaseViewer extends BaseViewer { pageNum: pageNumber, }); - // Fire progressend event to hide progress bar and cleanup preload after a page is rendered + // Cleanup preload after a page is rendered if (!this.somePageRendered) { this.hidePreload(); - this.emit(VIEWER_EVENT.progressEnd); this.somePageRendered = true; if (this.options.enableThumbnailsSidebar) { diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index 11671ab0a..5d2d65de1 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -1892,7 +1892,6 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => { docBase.pagesinitHandler(); expect(stubs.emit).toBeCalledWith(VIEWER_EVENT.load, { encoding: docBase.encoding, - endProgress: false, numPages: 5, scale: 'unknown', });