1313
1414const { html, Component, render } = require ( 'htm/preact' ) ;
1515
16- describe ( 'preact-html ' , ( ) => {
16+ describe ( 'htm/ preact' , ( ) => {
1717 const scratch = document . createElement ( 'div' ) ;
1818 document . body . appendChild ( scratch ) ;
1919
@@ -100,36 +100,36 @@ describe('preact-html', () => {
100100 scratch . innerHTML = '' ;
101101
102102 } ) ;
103- } ) ;
104103
105- describe ( 'performance' , ( ) => {
106- test ( 'creation' , ( ) => {
107- const results = [ ] ;
108- const Foo = ( { name } ) => html `< div class ="foo "> ${ name } </ div > ` ;
109- const statics = [
110- '\n<div id=app data-loading="true">\n\t<h1>Hello World</h1>\n\t<ul class="items" id=' , '>\n\t' ,
111- '\n\t</ul>\n\t\n\t<' , ' name="foo" />\n\t<' , ' name="other">content</' , '>\n\n</div>'
112- ] ;
113- let count = 0 ;
114- function go ( count ) {
115- return html (
116- statics . concat ( [ 'count:' , count ] ) ,
117- `id${ count } ` ,
118- html ( [ '<li data-id="' , '">' , '</li>' ] , 'i' + count , 'some text #' + count ) ,
119- Foo , Foo , Foo
120- ) ;
121- }
122- let now = performance . now ( ) ;
123- const start = now ;
124- while ( ( now = performance . now ( ) ) < start + 2000 ) {
125- count ++ ;
126- if ( results . push ( String ( go ( count ) ) ) === 10 ) results . length = 0 ;
127- }
128- const elapsed = now - start ;
129- const hz = count / elapsed * 1000 ;
130- // eslint-disable-next-line no-console
131- console . log ( `Creation: ${ hz | 0 } /s, average: ${ elapsed / count . toFixed ( 4 ) } ms` ) ;
132- expect ( elapsed ) . toBeGreaterThan ( 999 ) ;
133- expect ( hz ) . toBeGreaterThan ( 10 ) ;
134- } ) ;
135- } ) ;
104+ // describe('performance', () => {
105+ // test('creation', () => {
106+ // const results = [];
107+ // const Foo = ({ name }) => html`<div class="foo">${name}</div>`;
108+ // const statics = [
109+ // '\n<div id=app data-loading="true">\n\t<h1>Hello World</h1>\n\t<ul class="items" id=', '>\n\t',
110+ // '\n\t</ul>\n\t\n\t<', ' name="foo" />\n\t<', ' name="other">content</', '>\n\n</div>'
111+ // ];
112+ // let count = 0;
113+ // function go(count) {
114+ // return html(
115+ // statics.concat(['count:', count]),
116+ // `id${count}`,
117+ // html(['<li data-id="','">', '</li>'], 'i'+count, 'some text #'+count),
118+ // Foo, Foo, Foo
119+ // );
120+ // }
121+ // let now = performance.now();
122+ // const start = now;
123+ // while ((now = performance.now()) < start+2000) {
124+ // count++;
125+ // if (results.push(String(go(count)))===10) results.length = 0;
126+ // }
127+ // const elapsed = now - start;
128+ // const hz = count / elapsed * 1000;
129+ // // eslint-disable-next-line no-console
130+ // console.log(`Creation: ${hz|0}/s, average: ${elapsed/count.toFixed(4)}ms`);
131+ // expect(elapsed).toBeGreaterThan(999);
132+ // expect(hz).toBeGreaterThan(10);
133+ // });
134+ // });
135+ } ) ;
0 commit comments