diff --git a/tests/frontend/specs/font_type.js b/tests/frontend/specs/font_type.js index af90b865b..7a22cdfd0 100644 --- a/tests/frontend/specs/font_type.js +++ b/tests/frontend/specs/font_type.js @@ -5,7 +5,7 @@ describe("font select", function(){ this.timeout(60000); }); - it("makes text monospace", function(done) { + it("makes text monospace locally", function(done) { var inner$ = helper.padInner$; var chrome$ = helper.padChrome$; @@ -27,4 +27,29 @@ describe("font select", function(){ done(); }); + + it("makes text monospace globally", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + //click on the settings button to make settings visible + var $settingsButton = chrome$(".buttonicon-settings"); + $settingsButton.click(); + + //get the font menu and monospace option + var $viewfontmenu = chrome$("#global-viewfontmenu"); + var $monospaceoption = $viewfontmenu.find("[value=monospace]"); + + //select monospace and fire change event + $monospaceoption.attr('selected','selected'); + $viewfontmenu.change(); + + helper.waitFor(function(){ + return inner$("body").css("font-family").toLowerCase() == "monospace"; + }, 10000).always(function(){ + var newValue = inner$("body").css("font-family").toLowerCase(); + expect(newValue).to.be("monospace"); + done(); + }); + }); }); diff --git a/tests/frontend/specs/hide_author_colors.js b/tests/frontend/specs/hide_author_colors.js new file mode 100644 index 000000000..39c7b6ad2 --- /dev/null +++ b/tests/frontend/specs/hide_author_colors.js @@ -0,0 +1,66 @@ +describe("hiding author-colors", function(){ + //create a new pad before each test run + beforeEach(function(cb){ + helper.newPad(cb); + this.timeout(60000); + }); + + it("hides the author-colors locally", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + //click on the settings button to make settings visible + var $settingsButton = chrome$(".buttonicon-settings"); + $settingsButton.click(); + + //get the chat selector + var $colorsCheckbox = chrome$("#options-colorscheck"); + + //get the current status of the author-colors + var oldValue = inner$("body").hasClass("authorColors"); + + //select show author colors and fire change event + $colorsCheckbox.attr('selected','selected'); + $colorsCheckbox.change(); + $colorsCheckbox.click(); + + //get the current status of the author-colors + var newValue = inner$("body").hasClass("authorColors"); + + expect(oldValue).not.to.be(newValue); + expect(newValue).to.be($colorsCheckbox.prop("checked")); + + done(); + }); + + it("hides the author-colors globally", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + this.timeout(10000); + + //click on the settings button to make settings visible + var $settingsButton = chrome$(".buttonicon-settings"); + $settingsButton.click(); + + //get the chat selector + var $colorsCheckbox = chrome$("#options-global-colorscheck"); + + //get the current status of the author-colors + var oldValue = inner$("body").hasClass("authorColors"); + + //select show author colors and fire change event + $colorsCheckbox.attr('selected','selected'); + $colorsCheckbox.change(); + $colorsCheckbox.click(); + + helper.waitFor(function(){ + return inner$("body").hasClass("authorColors") == !oldValue; + }, 10000).always(function(){ + var newValue = inner$("body").hasClass("authorColors"); + expect(oldValue).not.to.be(newValue); + expect(newValue).to.be($colorsCheckbox.prop("checked")); + done(); + }); + }); +}); diff --git a/tests/frontend/specs/hide_line_numbers.js b/tests/frontend/specs/hide_line_numbers.js new file mode 100644 index 000000000..f74260da7 --- /dev/null +++ b/tests/frontend/specs/hide_line_numbers.js @@ -0,0 +1,66 @@ +describe("hiding linenumbers", function(){ + //create a new pad before each test run + beforeEach(function(cb){ + helper.newPad(cb); + this.timeout(60000); + }); + + it("hides the linenumbers locally", function(done) { + var outer$ = helper.padOuter$; + var chrome$ = helper.padChrome$; + + //click on the settings button to make settings visible + var $settingsButton = chrome$(".buttonicon-settings"); + $settingsButton.click(); + + //get the chat selector + var $linesCheckbox = chrome$("#options-linenoscheck"); + + //get the current status of the linenumbers + var oldValue = outer$("#sidediv").hasClass("sidedivhidden"); + + //select show linenumbers and fire change event + $linesCheckbox.attr('selected','selected'); + $linesCheckbox.change(); + $linesCheckbox.click(); + + //get the current status of the linenumbers + var newValue = outer$("#sidediv").hasClass("sidedivhidden"); + + expect(oldValue).not.to.be(newValue); + expect(newValue).to.be(!$linesCheckbox.prop("checked")); + + done(); + }); + + it("hides the linenumbers globally", function(done) { + var outer$ = helper.padOuter$; + var chrome$ = helper.padChrome$; + + this.timeout(10000); + + //click on the settings button to make settings visible + var $settingsButton = chrome$(".buttonicon-settings"); + $settingsButton.click(); + + //get the chat selector + var $linesCheckbox = chrome$("#options-global-linenoscheck"); + + //get the current status of the linenumbers + var oldValue = outer$("#sidediv").hasClass("sidedivhidden"); + + //select show linenumbers and fire change event + $linesCheckbox.attr('selected','selected'); + $linesCheckbox.change(); + $linesCheckbox.click(); + + helper.waitFor(function(){ + return outer$("#sidediv").hasClass("sidedivhidden") == !oldValue; + }, 10000).always(function(){ + var newValue = outer$("#sidediv").hasClass("sidedivhidden"); + expect(oldValue).not.to.be(newValue); + expect(newValue).to.be(!$linesCheckbox.prop("checked")); + done(); + }); + }); +});