This commit is contained in:
Tobias Hößl 2016-12-14 22:26:48 +01:00
parent deb5c5f4b3
commit 46cf26481e
2 changed files with 13 additions and 2 deletions

View File

@ -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 {

View File

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