Merge branch 'develop' of github.com:ether/etherpad-lite into develop

This commit is contained in:
John McLear 2020-06-05 23:08:58 +00:00
commit 56cc2dca4c
12 changed files with 1113 additions and 687 deletions

View file

@ -126,3 +126,80 @@ describe("assign ordered list", function(){
}
});
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$;
//get the first text element out of the inner iframe
var $firstTextElement = inner$("div").first();
//select this text element
$firstTextElement.sendkeys('{selectall}');
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
$insertorderedlistButton.click();
var e = inner$.Event(helper.evtType);
e.keyCode = 9; // tab
inner$("#innerdocbody").trigger(e);
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);
});
});
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$;
//get the first text element out of the inner iframe
var $firstTextElement = inner$("div").first();
//select this text element
$firstTextElement.sendkeys('{selectall}');
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
$insertorderedlistButton.click();
var $indentButton = chrome$(".buttonicon-indent");
$indentButton.click(); // make it indented twice
expect(inner$("div").first().find(".list-number2").length === 1).to.be(true);
var $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);
});
});

View file

@ -0,0 +1,67 @@
describe("timeslider", function(){
var padId = 735773577357+(Math.round(Math.random()*1000));
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb, padId);
this.timeout(60000);
});
it("Makes sure the export URIs are as expected when the padID is numeric", function(done) {
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
// make some changes to produce 100 revisions
var revs = 10;
this.timeout(60000);
for(var i=0; i < revs; i++) {
setTimeout(function() {
// enter 'a' in the first text element
inner$("div").first().sendkeys('a');
}, 100);
}
setTimeout(function() {
// go to timeslider
$('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider');
setTimeout(function() {
var timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
var $sliderBar = timeslider$('#ui-slider-bar');
var latestContents = timeslider$('#padcontent').text();
// Expect the date and time to be shown
// Click somewhere on the timeslider
var e = new jQuery.Event('mousedown');
e.clientX = e.pageX = 150;
e.clientY = e.pageY = 45;
$sliderBar.trigger(e);
e = new jQuery.Event('mousedown');
e.clientX = e.pageX = 150;
e.clientY = e.pageY = 40;
$sliderBar.trigger(e);
e = new jQuery.Event('mousedown');
e.clientX = e.pageX = 150;
e.clientY = e.pageY = 50;
$sliderBar.trigger(e);
$sliderBar.trigger('mouseup')
setTimeout(function() {
// expect URI to be similar to
// http://192.168.1.48:9001/p/2/2/export/html
// http://192.168.1.48:9001/p/735773577399/0/export/html
var exportLink = timeslider$('#exporthtmla').attr('href');
var checkVal = padId + "/0/export/html";
var includesCorrectURI = exportLink.indexOf(checkVal);
expect(includesCorrectURI).to.not.be(-1);
done();
}, 400);
}, 2000);
}, 2000);
});
});

View file

@ -33,3 +33,146 @@ describe("assign unordered list", function(){
});
});
describe("unassign unordered list", function(){
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb);
this.timeout(60000);
});
it("insert unordered list text then remove by clicking list again", function(done){
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var originalText = inner$("div").first().text();
var $insertunorderedlistButton = chrome$(".buttonicon-insertunorderedlist");
$insertunorderedlistButton.click();
helper.waitFor(function(){
var newText = inner$("div").first().text();
if(newText === originalText){
return inner$("div").first().find("ul li").length === 1;
}
}).done(function(){
// remove indentation by bullet and ensure text string remains the same
$insertunorderedlistButton.click();
helper.waitFor(function(){
var isList = inner$("div").find("ul").length === 1;
// sohuldn't be list
return (isList === false);
}).done(function(){
done();
});
});
});
});
describe("keep unordered list on enter key", function(){
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb);
this.timeout(60000);
});
it("Keeps the unordered list on enter for the new line", function(done){
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var $insertorderedlistButton = chrome$(".buttonicon-insertunorderedlist");
$insertorderedlistButton.click();
//type a bit, make a line break and type again
var $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 hasULElement = $newSecondLine.find("ul li").length === 1;
console.log($newSecondLine.find("ul").length);
expect(hasULElement).to.be(true);
expect($newSecondLine.text()).to.be("line 2");
done();
});
});
});
describe("Pressing Tab in an UL 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$;
//get the first text element out of the inner iframe
var $firstTextElement = inner$("div").first();
//select this text element
$firstTextElement.sendkeys('{selectall}');
var $insertorderedlistButton = chrome$(".buttonicon-insertunorderedlist");
$insertorderedlistButton.click();
var e = inner$.Event(helper.evtType);
e.keyCode = 9; // tab
inner$("#innerdocbody").trigger(e);
expect(inner$("div").first().find(".list-bullet2").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-bullet1").length === 1;
}).done(done);
});
});
describe("Pressing indent/outdent button in an UL 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$;
//get the first text element out of the inner iframe
var $firstTextElement = inner$("div").first();
//select this text element
$firstTextElement.sendkeys('{selectall}');
var $insertunorderedlistButton = chrome$(".buttonicon-insertunorderedlist");
$insertunorderedlistButton.click();
var $indentButton = chrome$(".buttonicon-indent");
$indentButton.click(); // make it indented twice
expect(inner$("div").first().find(".list-bullet2").length === 1).to.be(true);
var $outdentButton = chrome$(".buttonicon-outdent");
$outdentButton.click(); // make it deindented to 1
helper.waitFor(function(){
return inner$("div").first().find(".list-bullet1").length === 1;
}).done(done);
});
});