mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 06:03:34 +01:00
tests: Ignore head tag on import / improved contentcollector tests
* fix accidental write to global variable properly show pending tests log test name in suite better log output for received/expected strings * cc tests: enable second nestedOL test * ignore the head tag on import
This commit is contained in:
parent
5673a76b38
commit
c5cf7ab144
4 changed files with 14 additions and 14 deletions
|
@ -203,17 +203,6 @@ async function doImport(req, res, padId) {
|
|||
if (!req.directDatabaseAccess) {
|
||||
text = await fsp_readFile(destFile, 'utf8');
|
||||
|
||||
/*
|
||||
* The <title> tag needs to be stripped out, otherwise it is appended to the
|
||||
* pad.
|
||||
*
|
||||
* Moreover, when using LibreOffice to convert the file, some classes are
|
||||
* added to the <title> tag. This is a quick & dirty way of matching the
|
||||
* title and comment it out independently on the classes that are set on it.
|
||||
*/
|
||||
text = text.replace('<title', '<!-- <title');
|
||||
text = text.replace('</title>', '</title>-->');
|
||||
|
||||
// node on windows has a delay on releasing of the file lock.
|
||||
// We add a 100ms delay to work around this
|
||||
if (os.type().indexOf('Windows') > -1) {
|
||||
|
|
|
@ -36,7 +36,7 @@ exports.setPadHTML = async (pad, html) => {
|
|||
// below the last line of an import
|
||||
$('body').append('<p></p>');
|
||||
|
||||
const doc = $('html')[0];
|
||||
const doc = $('body')[0];
|
||||
apiLogger.debug('html:');
|
||||
apiLogger.debug(html);
|
||||
|
||||
|
|
|
@ -56,6 +56,12 @@ const testImports = {
|
|||
expectedText: '\t1. should be 1\n\ttest\n\t2. should be 2\n\n'
|
||||
}
|
||||
*/
|
||||
'ignoreAnyTagsOutsideBody': {
|
||||
description: 'Content outside body should be ignored',
|
||||
input: '<html><head><title>title</title><style></style></head><body>empty<br></body></html>',
|
||||
expectedHTML: '<!DOCTYPE HTML><html><body>empty<br><br></body></html>',
|
||||
expectedText: 'empty\n\n',
|
||||
},
|
||||
};
|
||||
|
||||
describe(__filename, function () {
|
||||
|
|
|
@ -107,7 +107,12 @@ const tests = {
|
|||
noteToSelf: "<p></p>should create a line break but not break numbering -- This is what I can't get working!",
|
||||
disabled: true,
|
||||
},
|
||||
|
||||
ignoreAnyTagsOutsideBody: {
|
||||
description: 'Content outside body should be ignored',
|
||||
html: '<html><head><title>title</title><style></style></head><body>empty<br></body></html>',
|
||||
expectedLineAttribs: ['+5'],
|
||||
expectedText: ['empty'],
|
||||
},
|
||||
};
|
||||
|
||||
describe(__filename, function () {
|
||||
|
@ -122,7 +127,7 @@ describe(__filename, function () {
|
|||
|
||||
it(testObj.description, function (done) {
|
||||
const $ = cheerio.load(testObj.html); // Load HTML into Cheerio
|
||||
const doc = $('html')[0]; // Creates a dom-like representation of HTML
|
||||
const doc = $('body')[0]; // Creates a dom-like representation of HTML
|
||||
// Create an empty attribute pool
|
||||
const apool = new AttributePool();
|
||||
// Convert a dom tree into a list of lines and attribute liens
|
||||
|
|
Loading…
Reference in a new issue