Merge pull request #3142 from CatoTH/bugfix-diff-regression

Bugfix for regression introduced by #c912811bd37b70b897cdb0fdc50cbe51…
This commit is contained in:
Emanuel Schütze 2017-03-25 12:26:21 +01:00 committed by GitHub
commit e90266091f
2 changed files with 15 additions and 1 deletions

View File

@ -1078,7 +1078,7 @@ angular.module('OpenSlidesApp.motions.diff', ['OpenSlidesApp.motions.lineNumberi
});
diffUnnormalized = diffUnnormalized.replace(
/<del>((<BR CLASS="OS-LINE-BREAK">)?<span[^>]+OS-LINE-NUMBER.+?)<\/del>/gi,
/<del>((<BR CLASS="OS-LINE-BREAK">)?<span[^>]+OS-LINE-NUMBER[^>]+?>\s*<\/span>)<\/del>/gi,
function(found,tag) {
return tag.toLowerCase().replace(/> <\/span/gi, ">&nbsp;</span");
}

View File

@ -441,6 +441,20 @@ describe('linenumbering', function () {
expect(diff).toBe("<p><ins>Einfügung 1 </ins>...so frißt er Euch alle mit Haut und Haar<ins> und Augen und Därme und alles</ins>.</p>\n<p>Test</p>");
});
it('does not lose formattings when multiple lines are deleted', function () {
var before = '<p>' +
noMarkup(13) + 'diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd ' +
brMarkup(14) + 'gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>',
after= '<p>Test</p>';
var diff = diffService.diff(before, after).toLowerCase(),
expected = '<p class="delete">' +
noMarkup(13).replace(/&nbsp;/, "\u00A0") + 'diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd ' +
brMarkup(14).replace(/&nbsp;/, "\u00A0") + 'gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>' +
'<p class="insert">Test</p>';
expect(diff).toBe(expected.toLowerCase());
});
});
describe('ignoring line numbers', function () {