From a05722e9c3b48df884b536eded9d9108ab7fbe25 Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Wed, 24 Jun 2015 09:50:06 -0600 Subject: [PATCH] Additional dom testing events. --- tests/test-module-for-integration-test.js | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/test-module-for-integration-test.js b/tests/test-module-for-integration-test.js index 385b0c1ae..429ade9d8 100644 --- a/tests/test-module-for-integration-test.js +++ b/tests/test-module-for-integration-test.js @@ -79,6 +79,41 @@ test('it supports DOM events', function() { equal(this.$('.value').text(), '1'); }); +test('it supports updating an input', function() { + setResolverRegistry({ + 'component:my-input': Ember.TextField.extend({ + value: null + }) + }); + this.render('{{my-input value=value}}'); + this.$('input').val('1').change(); + equal(this.get('value'), '1'); +}); + +test('it supports dom triggered focus events', function() { + setResolverRegistry({ + 'component:my-input': Ember.TextField.extend({ + _onInit: Ember.on('init', function() { + this.set('value', 'init'); + }), + focusIn: function() { + this.set('value', 'focusin'); + }, + focusOut: function() { + this.set('value', 'focusout'); + } + }) + }); + this.render('{{my-input}}'); + equal(this.$('input').val(), 'init'); + + this.$('input').trigger('focusin'); + equal(this.$('input').val(), 'focusin'); + + this.$('input').trigger('focusout'); + equal(this.$('input').val(), 'focusout'); +}); + moduleForComponent('Component Integration Tests: render during setup', { integration: true, beforeSetup: function() {