2012-11-21 23:22:01 +01:00
|
|
|
function deletecookie(name) {
|
|
|
|
document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
|
|
}
|
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
describe("Language select and change", function(){
|
2012-11-21 23:22:01 +01:00
|
|
|
// Destroy language cookies
|
|
|
|
deletecookie("language", null);
|
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//create a new pad before each test run
|
|
|
|
beforeEach(function(cb){
|
|
|
|
helper.newPad(cb);
|
|
|
|
this.timeout(60000);
|
|
|
|
});
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-21 23:22:01 +01:00
|
|
|
// Destroy language cookies
|
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
it("makes text german", function(done) {
|
|
|
|
var inner$ = helper.padInner$;
|
|
|
|
var chrome$ = helper.padChrome$;
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//click on the settings button to make settings visible
|
|
|
|
var $settingsButton = chrome$(".buttonicon-settings");
|
|
|
|
$settingsButton.click();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//click the language button
|
|
|
|
var $language = chrome$("#languagemenu");
|
|
|
|
var $languageoption = $language.find("[value=de]");
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//select german
|
|
|
|
$languageoption.attr('selected','selected');
|
|
|
|
$language.change();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-21 23:22:01 +01:00
|
|
|
helper.waitFor(function() {
|
2012-12-23 17:07:26 +01:00
|
|
|
return chrome$(".buttonicon-bold").parent()[0]["title"] == "Fett (Strg-B)";
|
2012-11-21 23:22:01 +01:00
|
|
|
})
|
2012-11-18 20:11:16 +01:00
|
|
|
.done(function(){
|
2012-11-13 01:23:34 +01:00
|
|
|
//get the value of the bold button
|
|
|
|
var $boldButton = chrome$(".buttonicon-bold").parent();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//get the title of the bold button
|
|
|
|
var boldButtonTitle = $boldButton[0]["title"];
|
2012-11-21 23:22:01 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//check if the language is now german
|
|
|
|
expect(boldButtonTitle).to.be("Fett (Strg-B)");
|
|
|
|
done();
|
2012-11-18 19:55:13 +01:00
|
|
|
});
|
2012-11-13 01:23:34 +01:00
|
|
|
});
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
it("makes text English", function(done) {
|
|
|
|
var inner$ = helper.padInner$;
|
|
|
|
var chrome$ = helper.padChrome$;
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//click on the settings button to make settings visible
|
|
|
|
var $settingsButton = chrome$(".buttonicon-settings");
|
|
|
|
$settingsButton.click();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//click the language button
|
|
|
|
var $language = chrome$("#languagemenu");
|
|
|
|
var $languageoption = $language.find("[value=en]");
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//select german
|
|
|
|
$languageoption.attr('selected','selected');
|
|
|
|
$language.change();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-21 23:22:01 +01:00
|
|
|
//get the value of the bold button
|
|
|
|
var $boldButton = chrome$(".buttonicon-bold").parent();
|
|
|
|
|
|
|
|
helper.waitFor(function() { return $boldButton[0]["title"] != "Fett (Strg-B)";})
|
2012-11-18 20:11:16 +01:00
|
|
|
.done(function(){
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//get the value of the bold button
|
|
|
|
var $boldButton = chrome$(".buttonicon-bold").parent();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//get the title of the bold button
|
|
|
|
var boldButtonTitle = $boldButton[0]["title"];
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-13 01:23:34 +01:00
|
|
|
//check if the language is now English
|
|
|
|
expect(boldButtonTitle).to.be("Bold (Ctrl-B)");
|
|
|
|
done();
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-18 19:55:13 +01:00
|
|
|
});
|
2012-11-13 01:23:34 +01:00
|
|
|
});
|
2012-12-23 17:07:26 +01:00
|
|
|
|
|
|
|
it("changes direction when picking an rtl lang", 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();
|
|
|
|
|
|
|
|
//click the language button
|
|
|
|
var $language = chrome$("#languagemenu");
|
|
|
|
var $languageoption = $language.find("[value=ar]");
|
|
|
|
|
|
|
|
//select arabic
|
|
|
|
$languageoption.attr('selected','selected');
|
|
|
|
$language.change();
|
|
|
|
|
|
|
|
helper.waitFor(function() {
|
|
|
|
return chrome$("html")[0]["dir"] != 'ltr';
|
|
|
|
})
|
|
|
|
.done(function(){
|
|
|
|
// check if the document's direction was changed
|
|
|
|
expect(chrome$("html")[0]["dir"]).to.be("rtl");
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2012-11-21 19:14:05 +01:00
|
|
|
|
2012-11-21 23:22:01 +01:00
|
|
|
});
|