From 34eb93f565146667c97716091a685dec3cf38fc6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 26 Oct 2019 09:37:20 +0000 Subject: [PATCH] Fix shadows toggle button --- openlp/core/display/html/display.js | 2 +- tests/js/test_display.js | 50 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/openlp/core/display/html/display.js b/openlp/core/display/html/display.js index 1a55d8507..b2c519bd9 100644 --- a/openlp/core/display/html/display.js +++ b/openlp/core/display/html/display.js @@ -986,7 +986,7 @@ var Display = { default: mainStyle["justify-content"] = "center"; } - if (theme.hasOwnProperty('font_main_shadow_size')) { + if (theme.hasOwnProperty('font_main_shadow_size') && !!theme.font_main_shadow) { mainStyle["text-shadow"] = theme.font_main_shadow_color + " " + theme.font_main_shadow_size + "pt " + theme.font_main_shadow_size + "pt"; } diff --git a/tests/js/test_display.js b/tests/js/test_display.js index a8b50dfa1..10da0d66d 100644 --- a/tests/js/test_display.js +++ b/tests/js/test_display.js @@ -583,6 +583,56 @@ describe("Display.setTextSlides", function () { expect(slidesDiv.style['justify-content']).toEqual('center'); }) + it("should enable shadows", function () { + const slides = [ + { + "verse": "v1", + "text": "Amazing grace, how sweet the sound\nThat saved a wretch like me\n" + + "I once was lost, but now I'm found\nWas blind but now I see", + "footer": "Public Domain" + } + ]; + // + const theme = { + 'font_main_shadow': true, + 'font_main_shadow_color': "#000", + 'font_main_shadow_size': 5 + }; + spyOn(Display, "reinit"); + spyOn(Reveal, "slide"); + + Display.setTheme(theme); + Display.setTextSlides(slides); + + const slidesDiv = $(".text-slides")[0]; + expect(slidesDiv.style['text-shadow']).not.toEqual(''); + }) + + it("should not enable shadows", function () { + const slides = [ + { + "verse": "v1", + "text": "Amazing grace, how sweet the sound\nThat saved a wretch like me\n" + + "I once was lost, but now I'm found\nWas blind but now I see", + "footer": "Public Domain" + } + ]; + // + const theme = { + 'font_main_shadow': false, + 'font_main_shadow_color': "#000", + 'font_main_shadow_size': 5 + }; + spyOn(Display, "reinit"); + spyOn(Reveal, "slide"); + + Display.setTheme(theme); + Display.setTextSlides(slides); + + const slidesDiv = $(".text-slides")[0]; + expect(slidesDiv.style['text-shadow']).toEqual(''); + }) + it("should correctly set slide size position to theme size when adding a text slide", function () { const slides = [ {