From 145467523a3c8d6468f1ae7461134030a1053b15 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Wed, 11 Feb 2015 10:55:43 +0700 Subject: [PATCH] test(boot): set the progress to null at the start Increasing test coverage --- src/boot/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/boot/index.js b/src/boot/index.js index 6cf019631..01c438def 100644 --- a/src/boot/index.js +++ b/src/boot/index.js @@ -26,15 +26,16 @@ let mode = data.mode || 'comingSoon' /* istanbul ignore else - we can check that by functional tests */ if (loadModule[mode]) { let context = new LoadingContext() + boot.setProgress(null) + context.onprogress = function(loaded, total) { + boot.setProgress(loaded / total) + } context.use(function() { loadModule[mode](function(loadedModule) { boot.hide() loadedModule.main() }) }) - context.onprogress = function(loaded, total) { - boot.setProgress(loaded / total) - } } else { console.error('Invalid mode:', mode) }