From 6d98ced94170e96ae69a7c4baa3e80377b8de04f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 9 Aug 2018 10:20:54 -0400 Subject: [PATCH 1/1] 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 --- Open-ILS/web/js/ui/default/staff/services/lovefield.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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(); } -- 2.43.2