mirror of https://github.com/sveltejs/svelte
				
				
				
			correctly bind one-way select value attributes (#423)
	
		
	
				
					
				
			
							parent
							
								
									20298b1a0a
								
							
						
					
					
						commit
						93e51d6ef3
					
				@ -0,0 +1,24 @@
 | 
				
			||||
const items = [ {}, {} ];
 | 
				
			||||
 | 
				
			||||
export default {
 | 
				
			||||
	skip: true, // JSDOM quirks
 | 
				
			||||
 | 
				
			||||
	'skip-ssr': true,
 | 
				
			||||
 | 
				
			||||
	data: {
 | 
				
			||||
		foo: items[0],
 | 
				
			||||
		items
 | 
				
			||||
	},
 | 
				
			||||
 | 
				
			||||
	test ( assert, component, target ) {
 | 
				
			||||
		const options = target.querySelectorAll( 'option' );
 | 
				
			||||
 | 
				
			||||
		assert.equal( options[0].selected, true );
 | 
				
			||||
		assert.equal( options[1].selected, false );
 | 
				
			||||
 | 
				
			||||
		component.set( { foo: items[1] } );
 | 
				
			||||
 | 
				
			||||
		assert.equal( options[0].selected, false );
 | 
				
			||||
		assert.equal( options[1].selected, true );
 | 
				
			||||
	}
 | 
				
			||||
};
 | 
				
			||||
@ -0,0 +1,4 @@
 | 
				
			||||
<select value="{{foo}}">
 | 
				
			||||
	<option value='{{items[0]}}'>a</option>
 | 
				
			||||
	<option value='{{items[1]}}'>b</option>
 | 
				
			||||
</select>
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue