Bugfix for #2770
This commit is contained in:
parent
deb5c5f4b3
commit
46cf26481e
@ -410,7 +410,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
||||
*/
|
||||
extractLineNumbers = function(element) {
|
||||
var foundLineNumbers = [];
|
||||
if (element.nodeName == 'SPAN' && element.getAttribute('class').indexOf('os-line-number') > -1) {
|
||||
if (element.nodeName == 'SPAN' && element.getAttribute('class') && element.getAttribute('class').indexOf('os-line-number') > -1) {
|
||||
foundLineNumbers.push(element.getAttribute('data-line-number'));
|
||||
element.parentNode.removeChild(element);
|
||||
} else {
|
||||
|
@ -158,6 +158,17 @@ describe('pdf', function () {
|
||||
"margin": [0,10,0,0]
|
||||
}));
|
||||
expect(JSON.stringify(pdfmake[2])).toBe(emptyline);
|
||||
})
|
||||
});
|
||||
|
||||
it('does not break with non-line-break SPANs', function () {
|
||||
var inHtml = "<ol><li>Test line 1<span>empty span</span></li></ol>",
|
||||
numberedHtml = lineNumberingService.insertLineNumbers(inHtml, 80);
|
||||
|
||||
var instance = PdfMakeConverter.createInstance();
|
||||
var pdfmake = instance.convertHTML(numberedHtml, 'outside');
|
||||
|
||||
// the actual result is's the point here; only that it doesn't throw an exception
|
||||
expect(JSON.stringify(pdfmake[0])).toBe(emptyline);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user