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,4 +1,6 @@
// WARNING: drag and drop is only simulated on these tests, so manual testing might also be necessary
'use strict';
// WARNING: drag and drop is only simulated on these tests, manual testing might also be necessary
describe('drag and drop', function () {
before(function (done) {
helper.newPad(() => {
@ -78,18 +80,19 @@ describe('drag and drop', function () {
});
/* ********************* Helper functions/constants ********************* */
var TARGET_LINE = 2;
var FIRST_SOURCE_LINE = 5;
const TARGET_LINE = 2;
const FIRST_SOURCE_LINE = 5;
var getLine = function (lineNumber) {
const getLine = (lineNumber) => {
const $lines = helper.padInner$('div');
return $lines.slice(lineNumber, lineNumber + 1);
};
var createScriptWithSeveralLines = function (done) {
const createScriptWithSeveralLines = (done) => {
// create some lines to be used on the tests
const $firstLine = helper.padInner$('div').first();
$firstLine.html('...<br>...<br>Target line []<br>...<br>...<br>Source line 1.<br>Source line 2.<br>');
$firstLine.html('...<br>...<br>Target line []<br>...<br>...<br>' +
'Source line 1.<br>Source line 2.<br>');
// wait for lines to be split
helper.waitFor(() => {
@ -98,7 +101,7 @@ describe('drag and drop', function () {
}).done(done);
};
var selectPartOfSourceLine = function () {
const selectPartOfSourceLine = () => {
const $sourceLine = getLine(FIRST_SOURCE_LINE);
// select 'line 1' from 'Source line 1.'
@ -106,14 +109,14 @@ describe('drag and drop', function () {
const end = start + 'line 1'.length;
helper.selectLines($sourceLine, $sourceLine, start, end);
};
var selectMultipleSourceLines = function () {
const selectMultipleSourceLines = () => {
const $firstSourceLine = getLine(FIRST_SOURCE_LINE);
const $lastSourceLine = getLine(FIRST_SOURCE_LINE + 1);
helper.selectLines($firstSourceLine, $lastSourceLine);
};
var dragSelectedTextAndDropItIntoMiddleOfLine = function (targetLineNumber) {
const dragSelectedTextAndDropItIntoMiddleOfLine = (targetLineNumber) => {
// dragstart: start dragging content
triggerEvent('dragstart');
@ -126,7 +129,7 @@ describe('drag and drop', function () {
triggerEvent('dragend');
};
var getHtmlFromSelectedText = function () {
const getHtmlFromSelectedText = () => {
const innerDocument = helper.padInner$.document;
const range = innerDocument.getSelection().getRangeAt(0);
@ -139,12 +142,12 @@ describe('drag and drop', function () {
return draggedHtml;
};
var triggerEvent = function (eventName) {
const event = helper.padInner$.Event(eventName);
const triggerEvent = (eventName) => {
const event = new helper.padInner$.Event(eventName);
helper.padInner$('#innerdocbody').trigger(event);
};
var moveSelectionIntoTarget = function (draggedHtml, targetLineNumber) {
const moveSelectionIntoTarget = (draggedHtml, targetLineNumber) => {
const innerDocument = helper.padInner$.document;
// delete original content