|
|
|
@ -62,6 +62,37 @@ describe('HtmlGenerator', () => { |
|
|
|
}); |
|
|
|
expect(obj.build(m1)).toEqual('<article data-test1="value1" data-test2="value2" class="class1 class2"></article>'); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Build correctly component with id preserved when script is defined', () => { |
|
|
|
const m1 = comp.get('components').add({ |
|
|
|
tagName: 'article', |
|
|
|
}); |
|
|
|
m1.set('script', 'anything'); |
|
|
|
expect(obj.build(m1, { cleanId: true, em })).toEqual(`<article id="${m1.getId()}"></article>`); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Build correctly component with id preserved when script-export is defined', () => { |
|
|
|
const m1 = comp.get('components').add({ |
|
|
|
tagName: 'article', |
|
|
|
}); |
|
|
|
m1.set('script-export', 'anything'); |
|
|
|
expect(obj.build(m1, { cleanId: true, em })).toEqual(`<article id="${m1.getId()}"></article>`); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Build correctly component with id preserved when id is explicitly set ', () => { |
|
|
|
const m1 = comp.get('components').add({ |
|
|
|
tagName: 'article', |
|
|
|
}); |
|
|
|
m1.setId('i11'); |
|
|
|
expect(obj.build(m1, { cleanId: true, em })).toEqual(`<article id="i11"></article>`); |
|
|
|
}); |
|
|
|
|
|
|
|
test('Build correctly component with cleanId is enabled and id is not required ', () => { |
|
|
|
const m1 = comp.get('components').add({ |
|
|
|
tagName: 'article', |
|
|
|
}); |
|
|
|
expect(obj.build(m1, { cleanId: true, em })).toEqual(`<article></article>`); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('CssGenerator', () => { |
|
|
|
|