mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
lint: Run eslint --fix
on bin/
and tests/
This commit is contained in:
parent
0625739cb8
commit
b8d07a42eb
78 changed files with 4319 additions and 4599 deletions
|
@ -1,204 +1,180 @@
|
|||
describe("assign ordered list", function(){
|
||||
//create a new pad before each test run
|
||||
beforeEach(function(cb){
|
||||
describe('assign ordered list', function () {
|
||||
// create a new pad before each test run
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad(cb);
|
||||
this.timeout(60000);
|
||||
});
|
||||
|
||||
it("inserts ordered list text", function(done){
|
||||
var inner$ = helper.padInner$;
|
||||
var chrome$ = helper.padChrome$;
|
||||
it('inserts ordered list text', function (done) {
|
||||
const inner$ = helper.padInner$;
|
||||
const chrome$ = helper.padChrome$;
|
||||
|
||||
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
|
||||
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
|
||||
$insertorderedlistButton.click();
|
||||
|
||||
helper.waitFor(function(){
|
||||
return inner$("div").first().find("ol li").length === 1;
|
||||
}).done(done);
|
||||
helper.waitFor(() => inner$('div').first().find('ol li').length === 1).done(done);
|
||||
});
|
||||
|
||||
context('when user presses Ctrl+Shift+N', function() {
|
||||
context('and pad shortcut is enabled', function() {
|
||||
beforeEach(function() {
|
||||
context('when user presses Ctrl+Shift+N', function () {
|
||||
context('and pad shortcut is enabled', function () {
|
||||
beforeEach(function () {
|
||||
makeSureShortcutIsEnabled('cmdShiftN');
|
||||
triggerCtrlShiftShortcut('N');
|
||||
});
|
||||
|
||||
it('inserts unordered list', function(done) {
|
||||
helper.waitFor(function() {
|
||||
return helper.padInner$('div').first().find('ol li').length === 1;
|
||||
}).done(done);
|
||||
it('inserts unordered list', function (done) {
|
||||
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(done);
|
||||
});
|
||||
});
|
||||
|
||||
context('and pad shortcut is disabled', function() {
|
||||
beforeEach(function() {
|
||||
context('and pad shortcut is disabled', function () {
|
||||
beforeEach(function () {
|
||||
makeSureShortcutIsDisabled('cmdShiftN');
|
||||
triggerCtrlShiftShortcut('N');
|
||||
});
|
||||
|
||||
it('does not insert unordered list', function(done) {
|
||||
helper.waitFor(function() {
|
||||
return helper.padInner$('div').first().find('ol li').length === 1;
|
||||
}).done(function() {
|
||||
expect().fail(function() { return 'Unordered list inserted, should ignore shortcut' });
|
||||
}).fail(function() {
|
||||
it('does not insert unordered list', function (done) {
|
||||
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(() => {
|
||||
expect().fail(() => 'Unordered list inserted, should ignore shortcut');
|
||||
}).fail(() => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('when user presses Ctrl+Shift+1', function() {
|
||||
context('and pad shortcut is enabled', function() {
|
||||
beforeEach(function() {
|
||||
context('when user presses Ctrl+Shift+1', function () {
|
||||
context('and pad shortcut is enabled', function () {
|
||||
beforeEach(function () {
|
||||
makeSureShortcutIsEnabled('cmdShift1');
|
||||
triggerCtrlShiftShortcut('1');
|
||||
});
|
||||
|
||||
it('inserts unordered list', function(done) {
|
||||
helper.waitFor(function() {
|
||||
return helper.padInner$('div').first().find('ol li').length === 1;
|
||||
}).done(done);
|
||||
it('inserts unordered list', function (done) {
|
||||
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(done);
|
||||
});
|
||||
});
|
||||
|
||||
context('and pad shortcut is disabled', function() {
|
||||
beforeEach(function() {
|
||||
context('and pad shortcut is disabled', function () {
|
||||
beforeEach(function () {
|
||||
makeSureShortcutIsDisabled('cmdShift1');
|
||||
triggerCtrlShiftShortcut('1');
|
||||
});
|
||||
|
||||
it('does not insert unordered list', function(done) {
|
||||
helper.waitFor(function() {
|
||||
return helper.padInner$('div').first().find('ol li').length === 1;
|
||||
}).done(function() {
|
||||
expect().fail(function() { return 'Unordered list inserted, should ignore shortcut' });
|
||||
}).fail(function() {
|
||||
it('does not insert unordered list', function (done) {
|
||||
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(() => {
|
||||
expect().fail(() => 'Unordered list inserted, should ignore shortcut');
|
||||
}).fail(() => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
xit("issue #1125 keeps the numbered list on enter for the new line - EMULATES PASTING INTO A PAD", function(done){
|
||||
var inner$ = helper.padInner$;
|
||||
var chrome$ = helper.padChrome$;
|
||||
xit('issue #1125 keeps the numbered list on enter for the new line - EMULATES PASTING INTO A PAD', function (done) {
|
||||
const inner$ = helper.padInner$;
|
||||
const chrome$ = helper.padChrome$;
|
||||
|
||||
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
|
||||
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
|
||||
$insertorderedlistButton.click();
|
||||
|
||||
//type a bit, make a line break and type again
|
||||
var $firstTextElement = inner$("div span").first();
|
||||
// type a bit, make a line break and type again
|
||||
const $firstTextElement = inner$('div span').first();
|
||||
$firstTextElement.sendkeys('line 1');
|
||||
$firstTextElement.sendkeys('{enter}');
|
||||
$firstTextElement.sendkeys('line 2');
|
||||
$firstTextElement.sendkeys('{enter}');
|
||||
|
||||
helper.waitFor(function(){
|
||||
return inner$("div span").first().text().indexOf("line 2") === -1;
|
||||
}).done(function(){
|
||||
var $newSecondLine = inner$("div").first().next();
|
||||
var hasOLElement = $newSecondLine.find("ol li").length === 1;
|
||||
helper.waitFor(() => inner$('div span').first().text().indexOf('line 2') === -1).done(() => {
|
||||
const $newSecondLine = inner$('div').first().next();
|
||||
const hasOLElement = $newSecondLine.find('ol li').length === 1;
|
||||
expect(hasOLElement).to.be(true);
|
||||
expect($newSecondLine.text()).to.be("line 2");
|
||||
var hasLineNumber = $newSecondLine.find("ol").attr("start") === 2;
|
||||
expect($newSecondLine.text()).to.be('line 2');
|
||||
const hasLineNumber = $newSecondLine.find('ol').attr('start') === 2;
|
||||
expect(hasLineNumber).to.be(true); // This doesn't work because pasting in content doesn't work
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
var triggerCtrlShiftShortcut = function(shortcutChar) {
|
||||
var inner$ = helper.padInner$;
|
||||
var e = inner$.Event(helper.evtType);
|
||||
var triggerCtrlShiftShortcut = function (shortcutChar) {
|
||||
const inner$ = helper.padInner$;
|
||||
const e = inner$.Event(helper.evtType);
|
||||
e.ctrlKey = true;
|
||||
e.shiftKey = true;
|
||||
e.which = shortcutChar.toString().charCodeAt(0);
|
||||
inner$("#innerdocbody").trigger(e);
|
||||
}
|
||||
inner$('#innerdocbody').trigger(e);
|
||||
};
|
||||
|
||||
var makeSureShortcutIsDisabled = function(shortcut) {
|
||||
var makeSureShortcutIsDisabled = function (shortcut) {
|
||||
helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = false;
|
||||
}
|
||||
var makeSureShortcutIsEnabled = function(shortcut) {
|
||||
};
|
||||
var makeSureShortcutIsEnabled = function (shortcut) {
|
||||
helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = true;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
describe("Pressing Tab in an OL increases and decreases indentation", function(){
|
||||
//create a new pad before each test run
|
||||
beforeEach(function(cb){
|
||||
describe('Pressing Tab in an OL increases and decreases indentation', function () {
|
||||
// create a new pad before each test run
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad(cb);
|
||||
this.timeout(60000);
|
||||
});
|
||||
|
||||
it("indent and de-indent list item with keypress", function(done){
|
||||
var inner$ = helper.padInner$;
|
||||
var chrome$ = helper.padChrome$;
|
||||
it('indent and de-indent list item with keypress', function (done) {
|
||||
const inner$ = helper.padInner$;
|
||||
const chrome$ = helper.padChrome$;
|
||||
|
||||
//get the first text element out of the inner iframe
|
||||
var $firstTextElement = inner$("div").first();
|
||||
// get the first text element out of the inner iframe
|
||||
const $firstTextElement = inner$('div').first();
|
||||
|
||||
//select this text element
|
||||
// select this text element
|
||||
$firstTextElement.sendkeys('{selectall}');
|
||||
|
||||
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
|
||||
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
|
||||
$insertorderedlistButton.click();
|
||||
|
||||
var e = inner$.Event(helper.evtType);
|
||||
const e = inner$.Event(helper.evtType);
|
||||
e.keyCode = 9; // tab
|
||||
inner$("#innerdocbody").trigger(e);
|
||||
inner$('#innerdocbody').trigger(e);
|
||||
|
||||
expect(inner$("div").first().find(".list-number2").length === 1).to.be(true);
|
||||
expect(inner$('div').first().find('.list-number2').length === 1).to.be(true);
|
||||
e.shiftKey = true; // shift
|
||||
e.keyCode = 9; // tab
|
||||
inner$("#innerdocbody").trigger(e);
|
||||
|
||||
helper.waitFor(function(){
|
||||
return inner$("div").first().find(".list-number1").length === 1;
|
||||
}).done(done);
|
||||
inner$('#innerdocbody').trigger(e);
|
||||
|
||||
helper.waitFor(() => inner$('div').first().find('.list-number1').length === 1).done(done);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe("Pressing indent/outdent button in an OL increases and decreases indentation and bullet / ol formatting", function(){
|
||||
//create a new pad before each test run
|
||||
beforeEach(function(cb){
|
||||
describe('Pressing indent/outdent button in an OL increases and decreases indentation and bullet / ol formatting', function () {
|
||||
// create a new pad before each test run
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad(cb);
|
||||
this.timeout(60000);
|
||||
});
|
||||
|
||||
it("indent and de-indent list item with indent button", function(done){
|
||||
var inner$ = helper.padInner$;
|
||||
var chrome$ = helper.padChrome$;
|
||||
it('indent and de-indent list item with indent button', function (done) {
|
||||
const inner$ = helper.padInner$;
|
||||
const chrome$ = helper.padChrome$;
|
||||
|
||||
//get the first text element out of the inner iframe
|
||||
var $firstTextElement = inner$("div").first();
|
||||
// get the first text element out of the inner iframe
|
||||
const $firstTextElement = inner$('div').first();
|
||||
|
||||
//select this text element
|
||||
// select this text element
|
||||
$firstTextElement.sendkeys('{selectall}');
|
||||
|
||||
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
|
||||
const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist');
|
||||
$insertorderedlistButton.click();
|
||||
|
||||
var $indentButton = chrome$(".buttonicon-indent");
|
||||
const $indentButton = chrome$('.buttonicon-indent');
|
||||
$indentButton.click(); // make it indented twice
|
||||
|
||||
expect(inner$("div").first().find(".list-number2").length === 1).to.be(true);
|
||||
expect(inner$('div').first().find('.list-number2').length === 1).to.be(true);
|
||||
|
||||
var $outdentButton = chrome$(".buttonicon-outdent");
|
||||
const $outdentButton = chrome$('.buttonicon-outdent');
|
||||
$outdentButton.click(); // make it deindented to 1
|
||||
|
||||
helper.waitFor(function(){
|
||||
return inner$("div").first().find(".list-number1").length === 1;
|
||||
}).done(done);
|
||||
|
||||
helper.waitFor(() => inner$('div').first().find('.list-number1').length === 1).done(done);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue