summaryrefslogtreecommitdiff
path: root/tests/frontend/specs/button_ordered_list.js
blob: ca7d755e9de15b6e43c5e209a4d586e07e3f6715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
describe("assign ordered list", function(){
  //create a new pad before each test run
  beforeEach(function(cb){
    helper.newPad(cb);
    this.timeout(60000);
  });

  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);
  });

  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$;

    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();
    });
  });
});