forked from openlp/openlp
Changed variable names to camelCase and added parameter for Jenkins JS tests
This commit is contained in:
parent
14f53eef89
commit
b42034de47
@ -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
|
||||
|
@ -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')
|
||||
|
@ -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",
|
||||
|
@ -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};
|
||||
|
Loading…
Reference in New Issue
Block a user