mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 16:36:15 -04:00
basic test and hacked in stuff
This commit is contained in:
parent
62906d72a2
commit
e39e959347
2 changed files with 14 additions and 7 deletions
|
@ -76,6 +76,7 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas
|
|||
p: 1,
|
||||
pre: 1,
|
||||
li: 1,
|
||||
img: 1,
|
||||
};
|
||||
|
||||
_.each(hooks.callAll('ccRegisterBlockElements'), (element) => {
|
||||
|
@ -421,12 +422,10 @@ function makeContentCollector(collectStyles, abrowser, apool, domInterface, clas
|
|||
cls,
|
||||
node,
|
||||
});
|
||||
} else {
|
||||
// THIS SEEMS VERY HACKY! -- Please submit a better fix!
|
||||
delete state.lineAttributes.img;
|
||||
}
|
||||
// cc.doAttrib(state, 'image:foo.png');
|
||||
state.lineAttributes.img = 'foo.png';
|
||||
|
||||
if (tname == 'br') {
|
||||
} else if (tname == 'br') {
|
||||
this.breakLine = true;
|
||||
const tvalue = dom.nodeAttr(node, 'value');
|
||||
const induceLineBreak = hooks.callAll('collectContentLineBreak', {
|
||||
|
|
|
@ -15,6 +15,13 @@ const AttributePool = require('../../../src/static/js/AttributePool');
|
|||
const cheerio = require('../../../src/node_modules/cheerio');
|
||||
|
||||
const tests = {
|
||||
image: {
|
||||
description: 'Puts an image in the content',
|
||||
html: '<html><body><p>image</p><img src="fooo.png"></body></html>',
|
||||
expectedLineAttribs: ['+5', '*0*1*2+1'],
|
||||
expectedText: ['image', '*'],
|
||||
},
|
||||
/*
|
||||
nestedLi: {
|
||||
description: 'Complex nested Li',
|
||||
html: '<!doctype html><html><body><ol><li>one</li><li><ol><li>1.1</li></ol></li><li>two</li></ol></body></html>',
|
||||
|
@ -271,6 +278,7 @@ pre
|
|||
expectedLineAttribs: ['+f*0+2+2'],
|
||||
expectedText: ['Need more space s !']
|
||||
},
|
||||
*/
|
||||
};
|
||||
|
||||
describe(__filename, function () {
|
||||
|
@ -300,7 +308,7 @@ describe(__filename, function () {
|
|||
|
||||
// Check recieved text matches the expected text
|
||||
if (arraysEqual(recievedText[0], expectedText)) {
|
||||
// console.log("PASS: Recieved Text did match Expected Text\nRecieved:", recievedText[0], "\nExpected:", testObj.expectedText)
|
||||
console.log("PASS: Recieved Text did match Expected Text\nRecieved:", recievedText[0], "\nExpected:", testObj.expectedText)
|
||||
} else {
|
||||
console.error('FAIL: Recieved Text did not match Expected Text\nRecieved:', recievedText[0], '\nExpected:', testObj.expectedText);
|
||||
throw new Error();
|
||||
|
@ -308,7 +316,7 @@ describe(__filename, function () {
|
|||
|
||||
// Check recieved attributes matches the expected attributes
|
||||
if (arraysEqual(recievedAttributes, expectedAttributes)) {
|
||||
// console.log("PASS: Recieved Attributes matched Expected Attributes");
|
||||
console.log("PASS: Recieved Attributes matched Expected Attributes", recievedAttributes, expectedAttributes);
|
||||
done();
|
||||
} else {
|
||||
console.error('FAIL', test, testObj.description);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue