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