From b42034de475f94b93cbb5e0f994231cd01355bd6 Mon Sep 17 00:00:00 2001 From: Nico Opiyo Date: Mon, 1 Jul 2019 20:45:08 +0300 Subject: [PATCH] Changed variable names to camelCase and added parameter for Jenkins JS tests --- openlp/core/display/html/display.js | 18 +++++++++--------- openlp/plugins/alerts/lib/alertsmanager.py | 8 ++++---- package.json | 2 +- tests/js/test_display.js | 18 +++++++++--------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index 566938877..6e84c63a7 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -405,11 +405,11 @@ var Display = { /** * Display an alert * @param {string} text - The alert text - * @param {string} JSON object - The settings for the alert object e.g '{"background_color": "rgb(255, 85, 0)", - * "location": 1, "font_face": "Open Sans Condensed", "font_size": 90, "font_color": "rgb(255, 255, 255)", + * @param {string} JSON object - The settings for the alert object e.g '{"backgroundColor": "rgb(255, 85, 0)", + * "location": 1, "fontFace": "Open Sans Condensed", "fontSize": 90, "fontColor": "rgb(255, 255, 255)", * "timeout": 10, "repeat": 2, "scroll": true}' */ - alert: function (text, alert_settings) { + alert: function (text, alertSettings) { var alertBackground = $('#alert-background')[0]; var alertText = $('#alert')[0]; if (text == "") { @@ -420,9 +420,9 @@ var Display = { Display.addAlertToQueue(text, alert_settings); } } - var settings = JSON.parse(alert_settings); + var settings = JSON.parse(alertSettings); this._alertSettings = settings; - Display.setAlertText(text, settings.font_color, settings.font_face, settings.font_size); + Display.setAlertText(text, settings.fontColor, settings.fontFace, settings.fontSize); Display.setAlertLocation(settings.location); /* Check if the alert is a queued alert */ if (Display._alertState !== AlertState.DisplayingFromQueue) { @@ -432,7 +432,7 @@ var Display = { alertBackground.addEventListener('transitionend', Display.alertTransitionEndEvent, false); alertText.addEventListener('animationend', Display.alertAnimationEndEvent, false); - Display.showAlertBackground(settings.background_color); + Display.showAlertBackground(settings.backgroundColor); }, /** * Add an alert to the alert queue @@ -448,12 +448,12 @@ var Display = { * Set Alert Text * @param {string} text - The alert text to display */ - setAlertText: function (text, color, font_face, font_size) { + setAlertText: function (text, color, fontFace, fontSize) { var alertText = $("#alert")[0]; alertText.textContent = text; alertText.style.color = color; - alertText.style.fontFamily = font_face; - alertText.style.fontSize = font_size + "pt"; + alertText.style.fontFamily = fontFace; + alertText.style.fontSize = fontSize + "pt"; }, /** * The alertTransitionEndEvent called after a transition has ended diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 60adb1beb..641a6595e 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -92,11 +92,11 @@ class AlertsManager(QtCore.QObject, RegistryBase, LogMixin, RegistryProperties): # Put alert settings together in dict that will be passed to Display in Javascript alert_settings = { - 'background_color': rgb_background_color, + 'backgroundColor': rgb_background_color, 'location': Settings().value('alerts/location'), - 'font_face': Settings().value('alerts/font face'), - 'font_size': Settings().value('alerts/font size'), - 'font_color': rgb_font_color, + 'fontFace': Settings().value('alerts/font face'), + 'fontSize': Settings().value('alerts/font size'), + 'fontColor': rgb_font_color, 'timeout': Settings().value('alerts/timeout'), 'repeat': Settings().value('alerts/repeat'), 'scroll': Settings().value('alerts/scroll') diff --git a/package.json b/package.json index 12d5d5747..cc659f8e4 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "phantomjs-prebuilt": "^2.1.16" }, "scripts": { - "test": "karma start" + "test": "karma start --single-run" }, "author": "OpenLP Developers", "license": "GPL-3.0-or-later", diff --git a/tests/js/test_display.js b/tests/js/test_display.js index aebfd8d28..1a83edd80 100644 --- a/tests/js/test_display.js +++ b/tests/js/test_display.js @@ -168,14 +168,14 @@ describe("Display.alert", function () { alertText.setAttribute("id","alert"); alertBackground.appendChild(alertText); settings = '{ \ - "location": 1, "font_face": "Segoe UI, Tahoma, Geneva, Verdana, sans-serif", \ - "font_size": 40, "font_color": "#ffffff", "background_color": "#660000", \ + "location": 1, "fontFace": "Segoe UI, Tahoma, Geneva, Verdana, sans-serif", \ + "fontSize": 40, "fontColor": "#ffffff", "backgroundColor": "#660000", \ "timeout": 5, "repeat": 1, "scroll": true \ }'; }); it("should return null if called without any text", function () { - expect(Display.alert("",settings)).toBeNull(); + expect(Display.alert("", settings)).toBeNull(); }); it("should set the correct alert text", function () { @@ -330,8 +330,8 @@ describe("Display.showAlertText", function () { alertText.setAttribute("id", "alert"); document.body.appendChild(alertText); settings = { - "location": 2, "font_face": "Tahoma", "font_size": 40, - "font_color": "rgb(255, 255, 255)", "background_color": "rgb(102, 0, 0)", + "location": 2, "fontFace": "Tahoma", "fontSize": 40, + "fontColor": "rgb(255, 255, 255)", "backgroundColor": "rgb(102, 0, 0)", "timeout": 0.01, "repeat": 1, "scroll": true }; Display._transitionState = TransitionState.EntranceTransition; @@ -399,8 +399,8 @@ describe("Display.addAlertToQueue", function () { Display._alerts = []; Display._alertState = AlertState.Displaying; settings = '{ \ - "location": 1, "font_face": "Segoe UI, Tahoma, Geneva, Verdana, sans-serif", \ - "font_size": 40, "font_color": "#ffffff", "background_color": "#660000", \ + "location": 1, "fontFace": "Segoe UI, Tahoma, Geneva, Verdana, sans-serif", \ + "fontSize": 40, "fontColor": "#ffffff", "backgroundColor": "#660000", \ "timeout": 5, "repeat": 1, "scrolling_text": true \ }'; var alertObject = {text: "Testing alert queue", settings: settings}; @@ -425,8 +425,8 @@ describe("Display.showNextAlert", function () { it("should call the alert function correctly if there is an alert in the queue", function () { var settings = { - "location": 2, "font_face": "Tahoma", "font_size": 40, - "font_color": "rgb(255, 255, 255)", "background_color": "rgb(102, 0, 0)", + "location": 2, "fontFace": "Tahoma", "fontSize": 40, + "fontColor": "rgb(255, 255, 255)", "backgroundColor": "rgb(102, 0, 0)", "timeout": 5, "repeat": 1, "scrolling_text": true }; var alertObject = {text: "Queued Alert", settings: settings};