Added tests for author-colors (local+global), line-numbers (local+global), font (global)

This commit is contained in:
mluto 2013-01-27 21:49:30 +01:00
parent 48432d2b09
commit c7b83928b0
3 changed files with 158 additions and 1 deletions

View file

@ -5,7 +5,7 @@ describe("font select", function(){
this.timeout(60000); this.timeout(60000);
}); });
it("makes text monospace", function(done) { it("makes text monospace locally", function(done) {
var inner$ = helper.padInner$; var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$; var chrome$ = helper.padChrome$;
@ -27,4 +27,29 @@ describe("font select", function(){
done(); 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();
});
});
}); });

View file

@ -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();
});
});
});

View file

@ -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();
});
});
});