Low hanging lint frontend tests (#4695)

* lint: low hanging specs/alphabet.js

* lint: low hanging specs/authorship_of_editions.js

* lint: low hanging specs/bold.js

* lint: low hanging specs/caret.js

* lint: low hanging specs/change_user_color.js

* lint: low hanging specs/change_user_name.js

* lint: low hanging specs/chat.js

* lint: low hanging specs/chat_load_messages.js

* lint: low hanging specs/clear_authorship_colors.js

* lint: low hanging specs/delete.js

* lint: low hanging specs/drag_and_drop.js

* lint: low hanging specs/embed_value.js

* lint: low hanging specs/enter.js

* lint: low hanging specs/font_type.js

* lint: low hanging specs/helper.js

* lint: low hanging specs/importexport.js

* lint: low hanging specs/importindents.js

* lint: low hanging specs/indentation.js

* lint: low hanging specs/italic.js

* lint: low hanging specs/language.js

* lint: low hanging specs/multiple_authors_clear_authorship_colors.js

* lint: low hanging specs/ordered_list.js

* lint: low hanging specs/pad_modal.js

* lint: low hanging specs/redo.js

* lint: low hanging specs/responsiveness.js

* lint: low hanging specs/select_formatting_buttons.js

* lint: low hanging specs/strikethrough.js

* lint: low hanging specs/timeslider.js

* lint: low hanging specs/timeslider_labels.js

* lint: low hanging specs/timeslider_numeric_padID.js

* lint: low hanging specs/timeslider_revisions.js

* lint: low hanging specs/undo.js

* lint: low hanging specs/unordered_list.js

* lint: low hanging specs/xxauto_reconnect.js

* lint: attempt to do remote_runner.js

* lint: helper linting

* lint: rate limit linting

* use constructor for Event to make eslint happier

* for squash: lint fix refinements

* for squash: lint fix refinements

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
This commit is contained in:
John McLear 2021-02-01 20:23:14 +00:00 committed by GitHub
parent 759e2aaec3
commit 915849b319
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 595 additions and 357 deletions

View file

@ -1,3 +1,5 @@
'use strict';
describe('indentation button', function () {
// create a new pad before each test run
beforeEach(function (cb) {
@ -7,7 +9,6 @@ describe('indentation button', function () {
it('indent text with keypress', function (done) {
const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first();
@ -15,7 +16,7 @@ describe('indentation button', function () {
// select this text element
$firstTextElement.sendkeys('{selectall}');
const e = inner$.Event(helper.evtType);
const e = new inner$.Event(helper.evtType);
e.keyCode = 9; // tab :|
inner$('#innerdocbody').trigger(e);
@ -56,9 +57,9 @@ describe('indentation button', function () {
});
});
it("indents text with spaces on enter if previous line ends with ':', '[', '(', or '{'", function (done) {
it('indents text with spaces on enter if previous line ends ' +
"with ':', '[', '(', or '{'", function (done) {
const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// type a bit, make a line break and type again
const $firstTextElement = inner$('div').first();
@ -77,7 +78,8 @@ describe('indentation button', function () {
// curly braces
const $lineWithCurlyBraces = inner$('div').first().next().next().next();
$lineWithCurlyBraces.sendkeys('{{}');
pressEnter(); // cannot use sendkeys('{enter}') here, browser does not read the command properly
// cannot use sendkeys('{enter}') here, browser does not read the command properly
pressEnter();
const $lineAfterCurlyBraces = inner$('div').first().next().next().next().next();
expect($lineAfterCurlyBraces.text()).to.match(/\s{4}/); // tab === 4 spaces
@ -106,9 +108,9 @@ describe('indentation button', function () {
});
});
it("appends indentation to the indent of previous line if previous line ends with ':', '[', '(', or '{'", function (done) {
it('appends indentation to the indent of previous line if previous line ends ' +
"with ':', '[', '(', or '{'", function (done) {
const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// type a bit, make a line break and type again
const $firstTextElement = inner$('div').first();
@ -124,13 +126,15 @@ describe('indentation button', function () {
$lineWithColon.sendkeys(':');
pressEnter();
const $lineAfterColon = inner$('div').first().next();
expect($lineAfterColon.text()).to.match(/\s{6}/); // previous line indentation + regular tab (4 spaces)
// previous line indentation + regular tab (4 spaces)
expect($lineAfterColon.text()).to.match(/\s{6}/);
done();
});
});
it("issue #2772 shows '*' when multiple indented lines receive a style and are outdented", async function () {
it("issue #2772 shows '*' when multiple indented lines " +
' receive a style and are outdented', async function () {
const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
@ -182,7 +186,6 @@ describe('indentation button', function () {
var $indentButton = testHelper.$getPadChrome().find(".buttonicon-indent");
$indentButton.click();
//ace creates a new dom element when you press a button, so just get the first text element again
var newFirstTextElement = $inner.find("div").first();
// is there a list-indent class element now?
@ -220,7 +223,6 @@ describe('indentation button', function () {
$outdentButton.click();
$outdentButton.click();
//ace creates a new dom element when you press a button, so just get the first text element again
var newFirstTextElement = $inner.find("div").first();
// is there a list-indent class element now?
@ -267,7 +269,9 @@ describe('indentation button', function () {
//get the second text element out of the inner iframe
setTimeout(function(){ // THIS IS REALLY BAD
var secondTextElement = $('iframe').contents().find('iframe').contents().find('iframe').contents().find('body > div').get(1); // THIS IS UGLY
var secondTextElement = $('iframe').contents()
.find('iframe').contents()
.find('iframe').contents().find('body > div').get(1); // THIS IS UGLY
// is there a list-indent class element now?
var firstChild = secondTextElement.children(":first");
@ -282,7 +286,10 @@ describe('indentation button', function () {
expect(isLI).to.be(true);
//get the first text element out of the inner iframe
var thirdTextElement = $('iframe').contents().find('iframe').contents().find('iframe').contents().find('body > div').get(2); // THIS IS UGLY TOO
var thirdTextElement = $('iframe').contents()
.find('iframe').contents()
.find('iframe').contents()
.find('body > div').get(2); // THIS IS UGLY TOO
// is there a list-indent class element now?
var firstChild = thirdTextElement.children(":first");
@ -300,9 +307,9 @@ describe('indentation button', function () {
});*/
});
function pressEnter() {
const pressEnter = () => {
const inner$ = helper.padInner$;
const e = inner$.Event(helper.evtType);
const e = new inner$.Event(helper.evtType);
e.keyCode = 13; // enter :|
inner$('#innerdocbody').trigger(e);
}
};