From cc7f11560f59f9645cb0e6aaff1a1deab9c92406 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 11 Feb 2021 18:26:37 +0000 Subject: [PATCH] Fix OL list items not increasing (#4749) * tests: additional test coverage for OL items * parseInt means we can do a proper check * tests: use ol check value test for #4748 --- src/static/js/domline.js | 2 +- src/tests/frontend/specs/ordered_list.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 8667a022d..324e13535 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -101,7 +101,7 @@ domline.createDomLine = (nonEmpty, doesWrap, optBrowser, optDocument) => { postHtml = `${postHtml}`; } else { if (start) { // is it a start of a list with more than one item in? - if (start[1] === 1) { // if its the first one at this level? + if (Number.parseInt(start[1]) === 1) { // if its the first one at this level? // Add start class to DIV node lineClass = `${lineClass} ` + `list-start-${listType}`; } diff --git a/src/tests/frontend/specs/ordered_list.js b/src/tests/frontend/specs/ordered_list.js index ddca576e2..9fe647ebe 100644 --- a/src/tests/frontend/specs/ordered_list.js +++ b/src/tests/frontend/specs/ordered_list.js @@ -108,6 +108,21 @@ describe('ordered_list.js', function () { }); }); + it('issue #4748 keeps numbers increment on OL', function (done) { + this.timeout(5000); + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; + const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); + const $firstLine = inner$('div').first(); + $firstLine.sendkeys('{selectall}'); + $insertorderedlistButton.click(); + const $secondLine = inner$('div').first().next(); + $secondLine.sendkeys('{selectall}'); + $insertorderedlistButton.click(); + expect($secondLine.find('ol').attr('start') === 2); + done(); + }); + xit('issue #1125 keeps the numbered list on enter for the new line', function (done) { // EMULATES PASTING INTO A PAD const inner$ = helper.padInner$;