mirror of https://github.com/sveltejs/svelte
				
				
				
			
							parent
							
								
									046a8000e6
								
							
						
					
					
						commit
						cb446bca64
					
				| @ -0,0 +1,13 @@ | |||||||
|  | <h3>Called {{count}} times.</h3> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  |   export default { | ||||||
|  |     immutable: false, | ||||||
|  |     data() { | ||||||
|  |       return { | ||||||
|  |         count: 0, | ||||||
|  |         foo: { bar: 'baz' } | ||||||
|  |       }; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | </script> | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | export default { | ||||||
|  | 	immutable: true, | ||||||
|  | 	html: `<div><h3>Called 0 times.</h3></div>`, | ||||||
|  | 
 | ||||||
|  | 	test(assert, component, target, window) { | ||||||
|  | 		var nested = component.refs.nested; | ||||||
|  | 		nested.observe('foo', foo => { | ||||||
|  | 			nested.set({ count: nested.get('count') + 1 }); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<div><h3>Called 1 times.</h3></div>`); | ||||||
|  | 
 | ||||||
|  | 		nested.set({ foo: nested.get('foo') }); | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<div><h3>Called 2 times.</h3></div>`); | ||||||
|  | 	} | ||||||
|  | }; | ||||||
| @ -0,0 +1,13 @@ | |||||||
|  | <div> | ||||||
|  |   <Nested ref:nested /> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	import Nested from './Nested.html'; | ||||||
|  | 
 | ||||||
|  | 	export default { | ||||||
|  | 		components: { | ||||||
|  | 			Nested | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | </script> | ||||||
| @ -0,0 +1,12 @@ | |||||||
|  | <h3>Called {{count}} times.</h3> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	export default { | ||||||
|  | 		data() { | ||||||
|  | 			return { | ||||||
|  | 				count: 0, | ||||||
|  | 				foo: { bar: 'baz' } | ||||||
|  | 			}; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | </script> | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | export default { | ||||||
|  | 	immutable: true, | ||||||
|  | 	html: `<div><h3>Called 0 times.</h3></div>`, | ||||||
|  | 
 | ||||||
|  | 	test(assert, component, target, window) { | ||||||
|  | 		var nested = component.refs.nested; | ||||||
|  | 		nested.observe('foo', foo => { | ||||||
|  | 			nested.set({ count: nested.get('count') + 1 }); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<div><h3>Called 1 times.</h3></div>`); | ||||||
|  | 
 | ||||||
|  | 		nested.set({ foo: nested.get('foo') }); | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<div><h3>Called 1 times.</h3></div>`); | ||||||
|  | 	} | ||||||
|  | }; | ||||||
| @ -0,0 +1,13 @@ | |||||||
|  | <div> | ||||||
|  |   <Nested ref:nested /> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | 	import Nested from './Nested.html'; | ||||||
|  | 
 | ||||||
|  | 	export default { | ||||||
|  | 		components: { | ||||||
|  | 			Nested | ||||||
|  | 		} | ||||||
|  | 	}; | ||||||
|  | </script> | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | export default { | ||||||
|  | 	immutable: true, | ||||||
|  | 	html: `<div><h3>Called 0 times.</h3></div>`, | ||||||
|  | 
 | ||||||
|  | 	test(assert, component, target, window) { | ||||||
|  | 		component.observe('foo', foo => { | ||||||
|  | 			component.set({ count: component.get('count') + 1 }); | ||||||
|  | 		}); | ||||||
|  | 
 | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<div><h3>Called 1 times.</h3></div>`); | ||||||
|  | 
 | ||||||
|  | 		component.set({ foo: component.get('foo') }); | ||||||
|  | 		assert.htmlEqual(target.innerHTML, `<div><h3>Called 1 times.</h3></div>`); | ||||||
|  | 	} | ||||||
|  | }; | ||||||
| @ -0,0 +1,14 @@ | |||||||
|  | <div> | ||||||
|  | 	<h3>Called {{count}} times.</h3> | ||||||
|  | </div> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  |   export default { | ||||||
|  | 		data() { | ||||||
|  | 			return { | ||||||
|  | 				count: 0, | ||||||
|  | 				foo: { bar: 'baz' } | ||||||
|  | 			}; | ||||||
|  | 		} | ||||||
|  |   } | ||||||
|  | </script> | ||||||
					Loading…
					
					
				
		Reference in new issue