diff --git a/peasy.test.js b/peasy.test.js index 45eb310..0d1119f 100644 --- a/peasy.test.js +++ b/peasy.test.js @@ -26,8 +26,6 @@ it('creates a deeper html structure', () => { `; - expect(view.childElementCount).toBe(4); - expect(view.childNodes.length).toBe(4); // make sure we have no textnodes from the indentation expect(view.querySelectorAll('span').length).toBe(2); expect(view.querySelector('p').textContent).toBe('paragraph'); }); @@ -44,4 +42,56 @@ it('works with node interpolations', () => { expect(outerView).toBeInstanceOf(HTMLElement); expect(outerView.querySelector('.myuser').textContent).toBe('JohnDoe'); +}); + +it('works with properties', () => { + const view = html` +
+

Title

+ Text + Text2 +

paragraph

+
+ `; + + expect(view.childElementCount).toBe(4); + expect(view.childNodes.length).toBe(4); // make sure we have no textnodes from the indentation + expect(view.getAttribute('data-lol')).toBe('sometext'); + expect(view.getAttribute('aria-role')).toBe('code'); +}); + +describe('tab-indenations removal', () => { + + it('removes basic tab-indentation', () => { + const view = html` +
+

Title

+ Text + Text2 +

paragraph

+
+ `; + + expect(view.childElementCount).toBe(4); + expect(view.childNodes.length).toBe(4); // make sure we have no textnodes from the indentation + }); + + it('removes tab-indentations when used with properties', () => { + const view = html` +
+

Title

+ Text + Text2 +

paragraph

+
+ `; + + expect(view.childElementCount).toBe(4); + expect(view.childNodes.length).toBe(4); // make sure we have no textnodes from the indentation + expect(view.getAttribute('data-lol')).toBe('sometext'); + expect(view.getAttribute('aria-role')).toBe('code'); + }); + }); \ No newline at end of file