From: Bill Erickson Date: Thu, 9 Aug 2018 14:20:54 +0000 (-0400) Subject: LP#1775719 Modify array check for Phantomjs; reduce logging; X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6d98ced94170e96ae69a7c4baa3e80377b8de04f;p=Evergreen.git LP#1775719 Modify array check for Phantomjs; reduce logging; PhantomJS doesn't support the handy [1,2,3].includes(1) function, so replace it with the tried-and-true indexOf(); Avoid logging errors on failure to connect to the shared offline worker when running within phantomjs. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- diff --git a/Open-ILS/web/js/ui/default/staff/services/lovefield.js b/Open-ILS/web/js/ui/default/staff/services/lovefield.js index cfd787fc36..561f900af7 100644 --- a/Open-ILS/web/js/ui/default/staff/services/lovefield.js +++ b/Open-ILS/web/js/ui/default/staff/services/lovefield.js @@ -33,7 +33,10 @@ angular.module('egCoreMod') } service.worker.onerror = function(err) { - console.error('Error loading shared worker', err); + // avoid spamming unit test runner on failure to connect. + if (!navigator.userAgent.match(/PhantomJS/)) { + console.error('Error loading shared worker', err); + } service.cannotConnect = true; } @@ -108,7 +111,7 @@ angular.module('egCoreMod') // Create and connect to the give schema service.connectToSchema = function(schema) { - if (service.connectedSchemas.includes(schema)) { + if (service.connectedSchemas.indexOf(schema) >= 0) { // already connected return $q.when(); }