You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/generator/samples/component-binding-infinite-.../_config.js

91 lines
2.6 KiB

export default {
html: `
<p><span class=''>1</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>3</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>1</span></p>
<p><span class=''>1</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>3</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>1</span></p>
<p><span class=''>1</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>3</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>1</span></p>
<p><span class=''>1</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>3</span></p>
<p><span class='selected'>2</span></p>
<p><span class=''>1</span></p>
`,
test ( assert, component, target, window ) {
const click = new window.MouseEvent( 'click' );
const spans = target.querySelectorAll( 'span' );
spans[0].dispatchEvent( click );
assert.equal( component.get( 'currentIdentifier' ), 1 );
assert.htmlEqual( target.innerHTML, `
<p><span class='selected'>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class='selected'>1</span></p>
<p><span class='selected'>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class='selected'>1</span></p>
<p><span class='selected'>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class='selected'>1</span></p>
<p><span class='selected'>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class='selected'>1</span></p>
` );
spans[0].dispatchEvent( click );
assert.equal( component.get( 'currentIdentifier' ), null );
assert.htmlEqual( target.innerHTML, `
<p><span class=''>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class=''>1</span></p>
<p><span class=''>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class=''>1</span></p>
<p><span class=''>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class=''>1</span></p>
<p><span class=''>1</span></p>
<p><span class=''>2</span></p>
<p><span class=''>3</span></p>
<p><span class=''>2</span></p>
<p><span class=''>1</span></p>
` );
}
};