|
|
@ -535,7 +535,6 @@ describe('ParserHtml', () => { |
|
|
const result = [ |
|
|
const result = [ |
|
|
{ |
|
|
{ |
|
|
tagName: 'div', |
|
|
tagName: 'div', |
|
|
attributes: {}, |
|
|
|
|
|
type: 'text', |
|
|
type: 'text', |
|
|
test: { |
|
|
test: { |
|
|
prop1: 'value1', |
|
|
prop1: 'value1', |
|
|
@ -553,7 +552,6 @@ describe('ParserHtml', () => { |
|
|
const result = [ |
|
|
const result = [ |
|
|
{ |
|
|
{ |
|
|
tagName: 'div', |
|
|
tagName: 'div', |
|
|
attributes: {}, |
|
|
|
|
|
type: 'text', |
|
|
type: 'text', |
|
|
test: ['value1', 'value2'], |
|
|
test: ['value1', 'value2'], |
|
|
components: { type: 'textnode', content: 'test2 ' }, |
|
|
components: { type: 'textnode', content: 'test2 ' }, |
|
|
@ -655,7 +653,7 @@ describe('ParserHtml', () => { |
|
|
expect(obj.parse(str, null, { preParser }).html).toEqual([result]); |
|
|
expect(obj.parse(str, null, { preParser }).html).toEqual([result]); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
test.only('parsing as document', () => { |
|
|
test('parsing as document', () => { |
|
|
const str = ` |
|
|
const str = ` |
|
|
<!DOCTYPE html> |
|
|
<!DOCTYPE html> |
|
|
<html class="cls-html" lang="en" data-gjs-htmlp="true"> |
|
|
<html class="cls-html" lang="en" data-gjs-htmlp="true"> |
|
|
@ -672,13 +670,13 @@ describe('ParserHtml', () => { |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |
|
|
`;
|
|
|
`;
|
|
|
// asDocument: true
|
|
|
|
|
|
console.log(obj.parse(str, null, { asDocument: true })); |
|
|
|
|
|
expect(obj.parse(str, null, { asDocument: true })).toEqual({ |
|
|
expect(obj.parse(str, null, { asDocument: true })).toEqual({ |
|
|
doctype: '<!DOCTYPE html>', |
|
|
doctype: '<!DOCTYPE html>', |
|
|
root: { classes: ['cls-html'], attributes: { lang: 'en' }, htmlp: true }, |
|
|
root: { classes: ['cls-html'], attributes: { lang: 'en' }, htmlp: true }, |
|
|
head: { |
|
|
head: { |
|
|
type: 'head', |
|
|
type: 'head', |
|
|
|
|
|
tagName: 'head', |
|
|
headp: true, |
|
|
headp: true, |
|
|
classes: ['cls-head'], |
|
|
classes: ['cls-head'], |
|
|
components: [ |
|
|
components: [ |
|
|
|