This commit is contained in:
mluto 2013-02-25 00:00:15 -08:00
commit 71ad6bc250
12 changed files with 401 additions and 11 deletions

View file

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

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

View file

@ -0,0 +1,68 @@
describe("ignoring global settings", function(){
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb);
this.timeout(60000);
});
// 1. Ignore global settings
// 2. change linenumbers globally
// 3. Un-Ingore global settings
// 4. change author-colors
// 5. Check for *same* linenumbers and *changed* author-colors
it("tries to ignore global settings", function(done) {
var outer$ = helper.padOuter$;
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
this.timeout(15000);
//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");
var $colorsGlobalCheckbox = chrome$("#options-global-colorscheck");
var $ignoreGlobalCheckbox = chrome$("#options-ignore-global");
//get the current status of the linenumbers
var oldValue_lines = outer$("#sidediv").hasClass("sidedivhidden");
var oldValue_color = inner$("body").hasClass("authorColors");
//ignore global settings
$ignoreGlobalCheckbox.attr('selected','selected');
$ignoreGlobalCheckbox.prop('checked', false); // make sure it's unchecked
$ignoreGlobalCheckbox.change();
$ignoreGlobalCheckbox.click(); // check it
//change linenumbers
$linesCheckbox.attr('selected','selected');
$linesCheckbox.change();
$linesCheckbox.click();
// wait for the server-event to come..
setTimeout(function() {
//unignore global settings
$ignoreGlobalCheckbox.attr('selected','selected');
$ignoreGlobalCheckbox.change();
$ignoreGlobalCheckbox.click();
//change colors
$colorsGlobalCheckbox.attr('selected','selected');
$colorsGlobalCheckbox.change();
$colorsGlobalCheckbox.click();
}, 2500);
helper.waitFor(function(){
return inner$("body").hasClass("authorColors") == !oldValue_color;
}, 10000).always(function(){
var newValue_lines = outer$("#sidediv").hasClass("sidedivhidden");
var newValue_color = inner$("body").hasClass("authorColors");
expect(newValue_color).not.to.be(oldValue_color);
expect(newValue_lines).to.be(oldValue_lines);
done();
});
});
});