From 155a895604ae5ff6ec1ad0a6b5fa57782cf8f198 Mon Sep 17 00:00:00 2001 From: Tom Briles Date: Wed, 3 Jul 2019 09:04:14 -0700 Subject: [PATCH] Test for Issue-3620: space in the HTML for an unordered list creates an extra list item --- tests/frontend/specs/importexport.js | 300 +++++++++++++-------------- 1 file changed, 149 insertions(+), 151 deletions(-) diff --git a/tests/frontend/specs/importexport.js b/tests/frontend/specs/importexport.js index 2dc002ba0..bfad11469 100644 --- a/tests/frontend/specs/importexport.js +++ b/tests/frontend/specs/importexport.js @@ -52,125 +52,127 @@ describe("import functionality", function(){ return exportresults } - xit("import a pad with newlines from txt", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var textWithNewLines = 'imported text\nnewline' - importrequest(textWithNewLines,importurl,"txt") + it("import a pad with newlines from txt", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var textWithNewLines = 'imported text\nnewline'; + importrequest(textWithNewLines, importurl, "txt"); helper.waitFor(function(){ - return expect(getinnertext()).to.be('imported text\nnewline\n
\n') - }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be("imported text
newline

") - expect(results[1][1]).to.be("imported text\nnewline\n\n") - done() - }) - xit("import a pad with newlines from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithNewLines = 'htmltext
newline' - importrequest(htmlWithNewLines,importurl,"html") + return getinnertext().includes('imported text'); + }).done(function() { + expect(getinnertext()).to.be('imported text\nnewline\n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be("\r\nimported text
newline
\r\n"); + expect(results[1][1]).to.be("imported text\nnewline\n"); + done(); + }); + }); + it("import a pad with newlines from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithNewLines = 'htmltext
newline'; + importrequest(htmlWithNewLines, importurl, "html"); helper.waitFor(function(){ - return expect(getinnertext()).to.be('htmltext\nnewline\n
\n') - }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be("htmltext
newline

") - expect(results[1][1]).to.be("htmltext\nnewline\n\n") - done() + return getinnertext().includes('htmltext'); + }).done(function() { + expect(getinnertext()).to.be('htmltext\nnewline\n
\n') + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be("\r\nhtmltext
newline

\r\n"); + expect(results[1][1]).to.be("htmltext\nnewline\n\n"); + done(); + }); }) - xit("import a pad with attributes from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithNewLines = 'htmltext
newline' - importrequest(htmlWithNewLines,importurl,"html") + it("import a pad with attributes from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithNewLines = 'htmltext
newline'; + importrequest(htmlWithNewLines,importurl,"html"); helper.waitFor(function(){ - return expect(getinnertext()).to.be('htmltext\nnewline\n
\n') + return getinnertext().includes(''); + }).done(function() { + expect(getinnertext()).to.be('htmltext\nnewline\n
\n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\nhtmltext
newline

\r\n'); + expect(results[1][1]).to.be('htmltext\nnewline\n\n'); + done(); }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('htmltext
newline

') - expect(results[1][1]).to.be('htmltext\nnewline\n\n') - done() }) - xit("import a pad with bullets from html", function(done){ + it("import a pad with bullets from html", function(done){ var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
    • bullet2 line 2
' + var htmlWithBullets = '
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
    • bullet2 line 2
' importrequest(htmlWithBullets,importurl,"html") helper.waitFor(function(){ - return expect(getinnertext()).to.be('\ -
  • bullet line 1
\n\ -
  • bullet line 2
\n\ -
  • bullet2 line 1
\n\ -
  • bullet2 line 2
\n\ -
\n') - }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
    • bullet2 line 2

') - expect(results[1][1]).to.be('\t* bullet line 1\n\t* bullet line 2\n\t\t* bullet2 line 1\n\t\t* bullet2 line 2\n\n') - done() - }) - xit("import a pad with bullets and newlines from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

    • bullet2 line 2
' - importrequest(htmlWithBullets,importurl,"html") + return getinnertext().includes('bullet line 1'); + }).done(function() { + expect(getinnertext()).to.be( + '
  • bullet line 1
\n' + + '
  • bullet line 2
\n' + + '
  • bullet2 line 1
\n' + + '
  • bullet2 line 2
\n' + + '
\n') + var results = exportfunc(helper.padChrome$.window.location.href) + expect(results[0][1]).to.be('\r\n
  • bullet line 1
  • ' + + '
  • bullet line 2
    • bullet2 line 1
    • ' + + '
    • bullet2 line 2

\r\n') + expect(results[1][1]).to.be('\t* bullet line 1\n\t* bullet line 2\n\t\t* bullet2 line 1\n\t\t* bullet2 line 2\n\n') + done(); + }); + }); + it("import a pad with bullets and newlines from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithBullets = '
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

    • bullet2 line 2
'; + importrequest(htmlWithBullets,importurl,"html"); helper.waitFor(function(){ - return expect(getinnertext()).to.be('\ -
  • bullet line 1
\n\ -
\n\ -
  • bullet line 2
\n\ -
  • bullet2 line 1
\n\ -
\n\ -
  • bullet2 line 2
\n\ -
\n') - }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

    • bullet2 line 2

') - expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t* bullet2 line 2\n\n') - done() - }) - xit("import a pad with bullets and newlines and attributes from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

        • bullet4 line 2 bisu
        • bullet4 line 2 bs
        • bullet4 line 2 uuis
' - importrequest(htmlWithBullets,importurl,"html") + return getinnertext().includes('list-bullet1'); + }).done(function() { + expect(getinnertext()).to.be('
  • bullet line 1
\n
\n
  • bullet line 2
\n
  • bullet2 line 1
\n
\n
  • bullet2 line 2
\n
\n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

    • bullet2 line 2

\r\n'); + expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t* bullet2 line 2\n\n'); + done(); + }); + }); + it("import a pad with bullets and newlines and attributes from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithBullets = '
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

        • bullet4 line 2 bisu
        • bullet4 line 2 bs
        • bullet4 line 2 uuis
'; + importrequest(htmlWithBullets,importurl,"html"); helper.waitFor(function(){ - return expect(getinnertext()).to.be('\ + return getinnertext().includes('list-bullet1'); + }).done(function() { + expect(getinnertext()).to.be('\
  • bullet line 1
\n\
\n\
  • bullet line 2
\n\
  • bullet2 line 1
\n
\n\
  • bullet4 line 2 bisu
\n\
  • bullet4 line 2 bs
\n\
  • bullet4 line 2 uuis
\n\ -
\n') - }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

        • bullet4 line 2 bisu
        • bullet4 line 2 bs
        • bullet4 line 2 uuis

') - expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t\t\t* bullet4 line 2 bisu\n\t\t\t\t* bullet4 line 2 bs\n\t\t\t\t* bullet4 line 2 uuis\n\n') - done() - }) - xit("import a pad with nested bullets from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
        • bullet4 line 2
        • bullet4 line 2
        • bullet4 line 2
      • bullet3 line 1
  • bullet2 line 1
' - importrequest(htmlWithBullets,importurl,"html") - var oldtext=getinnertext() +
\n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

        • bullet4 line 2 bisu
        • bullet4 line 2 bs
        • bullet4 line 2 uuis

\r\n'); + expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t\t\t* bullet4 line 2 bisu\n\t\t\t\t* bullet4 line 2 bs\n\t\t\t\t* bullet4 line 2 uuis\n\n'); + done(); + }); + }); + it("import a pad with nested bullets from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithBullets = '
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
        • bullet4 line 2
        • bullet4 line 2
        • bullet4 line 2
      • bullet3 line 1
  • bullet2 line 1
'; + importrequest(htmlWithBullets,importurl,"html"); + var oldtext = getinnertext(); helper.waitFor(function(){ - return oldtext != getinnertext() -// return expect(getinnertext()).to.be('\ -//
  • bullet line 1
\n\ -//
  • bullet line 2
\n\ -//
  • bullet2 line 1
\n\ -//
  • bullet4 line 2
\n\ -//
  • bullet4 line 2
\n\ -//
  • bullet4 line 2
\n\ -//
\n') - }) - - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
        • bullet4 line 2
        • bullet4 line 2
        • bullet4 line 2
      • bullet3 line 1
  • bullet2 line 1

') - expect(results[1][1]).to.be('\t* bullet line 1\n\t* bullet line 2\n\t\t* bullet2 line 1\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t* bullet3 line 1\n\t* bullet2 line 1\n\n') - done() - }) - xit("import a pad with 8 levels of bullets and newlines and attributes from html", function(done){ + return getinnertext().includes('list-bullet1'); + }).done(function() { + expect(getinnertext()).to.be('
  • bullet line 1
\n
  • bullet line 2
\n
  • bullet2 line 1
\n
  • bullet4 line 2
\n
  • bullet4 line 2
\n
  • bullet4 line 2
\n
  • bullet3 line 1
\n
  • bullet2 line 1
\n
\n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
  • bullet line 1
  • bullet line 2
    • bullet2 line 1
        • bullet4 line 2
        • bullet4 line 2
        • bullet4 line 2
      • bullet3 line 1
  • bullet2 line 1

\r\n'); + expect(results[1][1]).to.be('\t* bullet line 1\n\t* bullet line 2\n\t\t* bullet2 line 1\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t\t* bullet4 line 2\n\t\t\t* bullet3 line 1\n\t* bullet2 line 1\n\n'); + done(); + }); + }); + it("import a pad with 8 levels of bullets and newlines and attributes from html", function(done){ var importurl = helper.padChrome$.window.location.href+'/import' var htmlWithBullets = '
  • bullet line 1

  • bullet line 2
    • bullet2 line 1

        • bullet4 line 2 bisu
        • bullet4 line 2 bs
        • bullet4 line 2 uuis
                • foo
                • foobar bs
          • foobar
    ' importrequest(htmlWithBullets,importurl,"html") helper.waitFor(function(){ - return expect(getinnertext()).to.be('\ + return getinnertext().includes('list-bullet1'); + }).done(function() { + expect(getinnertext()).to.be('\
    • bullet line 1
    \n\
    \n\
    • bullet line 2
    \n\
    • bullet2 line 1
    \n
    \n\ @@ -180,58 +182,54 @@ describe("import functionality", function(){
    • foo
    \n\
    • foobar bs
    \n\
    • foobar
    \n\ -
    \n') - }) - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('
    • bullet line 1

    • bullet line 2
      • bullet2 line 1

          • bullet4 line 2 bisu
          • bullet4 line 2 bs
          • bullet4 line 2 uuis
                  • foo
                  • foobar bs
            • foobar

    ') - expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t\t\t* bullet4 line 2 bisu\n\t\t\t\t* bullet4 line 2 bs\n\t\t\t\t* bullet4 line 2 uuis\n\t\t\t\t\t\t\t\t* foo\n\t\t\t\t\t\t\t\t* foobar bs\n\t\t\t\t\t* foobar\n\n') - done() - }) +
    \n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
    • bullet line 1

    • bullet line 2
      • bullet2 line 1

          • bullet4 line 2 bisu
          • bullet4 line 2 bs
          • bullet4 line 2 uuis
                  • foo
                  • foobar bs
            • foobar

    \r\n') ; + expect(results[1][1]).to.be('\t* bullet line 1\n\n\t* bullet line 2\n\t\t* bullet2 line 1\n\n\t\t\t\t* bullet4 line 2 bisu\n\t\t\t\t* bullet4 line 2 bs\n\t\t\t\t* bullet4 line 2 uuis\n\t\t\t\t\t\t\t\t* foo\n\t\t\t\t\t\t\t\t* foobar bs\n\t\t\t\t\t* foobar\n\n'); + done(); + }); + }); - xit("import a pad with ordered lists from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
    1. number 1 line 1
    1. number 2 line 2
    ' - importrequest(htmlWithBullets,importurl,"html") - -console.error(getinnertext()) - expect(getinnertext()).to.be('\ -
    1. number 1 line 1
    \n\ -
    1. number 2 line 2
    \n\ -
    \n') - var results = exportfunc(helper.padChrome$.window.location.href) - expect(results[0][1]).to.be('
    1. number 1 line 1
    1. number 2 line 2
    ') - expect(results[1][1]).to.be('') - done() - }) - xit("import a pad with ordered lists and newlines from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
    1. number 9 line 1

    1. number 10 line 2
      1. number 2 times line 1

      1. number 2 times line 2
    ' - importrequest(htmlWithBullets,importurl,"html") - expect(getinnertext()).to.be('\ -
    1. number 9 line 1
    \n\ -
    \n\ -
    1. number 10 line 2
    \n\ -
    1. number 2 times line 1
    \n\ -
    \n\ -
    1. number 2 times line 2
    \n\ -
    \n') - var results = exportfunc(helper.padChrome$.window.location.href) - console.error(results) - done() - }) - xit("import a pad with nested ordered lists and attributes and newlines from html", function(done){ - var importurl = helper.padChrome$.window.location.href+'/import' - var htmlWithBullets = '
    1. bold strikethrough italics underline line 1bold

    1. number 10 line 2
      1. number 2 times line 1

      1. number 2 times line 2
    ' - importrequest(htmlWithBullets,importurl,"html") - expect(getinnertext()).to.be('\ -
    1. bold strikethrough italics underline line 1bold
    \n\ -
    \n\ -
    1. number 10 line 2
    \n\ -
    1. number 2 times line 1
    \n\ -
    \n\ -
    1. number 2 times line 2
    \n\ -
    \n') - var results = exportfunc(helper.padChrome$.window.location.href) - console.error(results) - done() - }) -}) + it("import a pad with ordered lists from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithBullets = '
    1. number 1 line 1
    1. number 2 line 2
    '; + importrequest(htmlWithBullets,importurl,"html"); + helper.waitFor(function(){ + return getinnertext().includes('list-number1'); + }).done(function() { + expect(getinnertext()).to.be('
    1. number 1 line 1
    \n
    1. number 2 line 2
    \n
    \n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
    1. number 1 line 1
    2. number 2 line 2

    \r\n'); + expect(results[1][1]).to.be('\t1. number 1 line 1\n\t1. number 2 line 2\n\n'); + done(); + }); + }); + it("import a pad with ordered lists and newlines from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithBullets = '
    1. number 9 line 1

    1. number 10 line 2
      1. number 2 times line 1

      1. number 2 times line 2
    '; + importrequest(htmlWithBullets,importurl,"html"); + helper.waitFor(function(){ + return getinnertext().includes('list-number1'); + }).done(function() { + expect(getinnertext()).to.be('
    1. number 9 line 1
    \n
    \n
    1. number 10 line 2
    \n
    1. number 2 times line 1
    \n
    \n
    1. number 2 times line 2
    \n
    \n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
    1. number 9 line 1

    1. number 10 line 2
      1. number 2 times line 1

      1. number 2 times line 2

    \r\n'); + expect(results[1][1]).to.be('\t1. number 9 line 1\n\n\t1. number 10 line 2\n\t\t2. number 2 times line 1\n\n\t\t2. number 2 times line 2\n\n'); + done(); + }); + }); + it("import a pad with nested ordered lists and attributes and newlines from html", function(done){ + var importurl = helper.padChrome$.window.location.href+'/import'; + var htmlWithBullets = '
    1. bold strikethrough italics underline line 1bold

    1. number 10 line 2
      1. number 2 times line 1

      1. number 2 times line 2
    '; + importrequest(htmlWithBullets,importurl,"html"); + helper.waitFor(function(){ + return getinnertext().includes('list-number1'); + }).done(function() { + expect(getinnertext()).to.be('
    1. bold strikethrough italics underlineline1bold
    \n
    \n
    1. number 10 line 2
    \n
    1. number 2 times line 1
    \n
    \n
    1. number 2 times line 2
    \n
    \n'); + var results = exportfunc(helper.padChrome$.window.location.href); + expect(results[0][1]).to.be('\r\n
    1. bold strikethrough italics underlineline1bold

    1. number 10 line 2
      1. number 2 times line 1

      1. number 2 times line 2

    \r\n'); + expect(results[1][1]).to.be('\t1. bold strikethrough italics underlineline1bold\n\n\t1. number 10 line 2\n\t\t2. number 2 times line 1\n\n\t\t2. number 2 times line 2\n\n'); + done(); + }); + }); +});