etherpad-lite/tests/frontend/specs/button_ordered_list.js

48 lines
1.7 KiB
JavaScript
Raw Normal View History

2012-10-09 03:27:22 +02:00
describe("assign ordered list", function(){
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb);
2012-11-02 00:19:59 +01:00
this.timeout(60000);
2012-10-09 03:27:22 +02:00
});
it("insert ordered list text", function(done){
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
$insertorderedlistButton.click();
helper.waitFor(function(){
return inner$("div").first().find("ol li").length === 1;
}).done(done);
});
2012-11-13 17:05:05 +01:00
xit("issue #1125 keeps the numbered list on enter for the new line - EMULATES PASTING INTO A PAD", function(done){
2012-10-09 03:27:22 +02:00
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var $insertorderedlistButton = chrome$(".buttonicon-insertorderedlist");
$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 hasOLElement = $newSecondLine.find("ol li").length === 1;
console.log($newSecondLine.find("ol"));
expect(hasOLElement).to.be(true);
expect($newSecondLine.text()).to.be("line 2");
var hasLineNumber = $newSecondLine.find("ol").attr("start") === 2;
expect(hasLineNumber).to.be(true); // This doesn't work because pasting in content doesn't work
done();
});
});
});