mirror of https://github.com/sveltejs/svelte
parent
44a2fd31f6
commit
c2daa66b3c
@ -0,0 +1,21 @@
|
||||
import * as assert from 'assert';
|
||||
|
||||
// TODO gah, JSDOM appears to behave differently to real browsers here... probably need to raise an issue
|
||||
|
||||
export default {
|
||||
html: '<input><!--#if visible-->',
|
||||
test ( component ) {
|
||||
component.refs.input.focus();
|
||||
|
||||
// this should NOT trigger blur event
|
||||
component.set({ visible: false });
|
||||
assert.ok( !component.get( 'blurred' ) );
|
||||
|
||||
component.set({ visible: true });
|
||||
component.refs.input.focus();
|
||||
|
||||
// this SHOULD trigger blur event
|
||||
component.refs.input.blur();
|
||||
assert.ok( component.get( 'blurred' ) );
|
||||
}
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
{{#if visible}}
|
||||
<input ref:input on:blur='set({ blurred: true })'>
|
||||
{{/if}}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
visible: true
|
||||
})
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue