1

I really don't understand the chain of events that's happening here. Trying to follow the guide as well as possible. I have:

test('Tab focus', function(assert) { 
    visit('/demo/form');
    click('input[type=text]');
    andThen(function() {
        assert.equal(
            find('input[type=text]').css('borderTopColor'), 'rgb(0, 125, 164)', 'Text input has focus'
        );
    });
});

only to have it fail: enter image description here

There are no transitions on the color change, and if I hit rerun, it DOES pass.

Brian
  • 2,819
  • 4
  • 24
  • 30
  • What happens if you test for focus using find('input[type=text]').is(":focus") ? – JonRed Nov 06 '16 at 01:27
  • Both `find('input[type=text]').is(':focus')` and `find('input[type=text]:focus')` will NOT return the true/.length = 1 as expected. :( – Brian Nov 07 '16 at 14:25
  • If you can set up an ember twiddle (https://ember-twiddle.com/) with the example, maybe a few of us can take a look? – JonRed Nov 07 '16 at 17:29

1 Answers1

1

for anyone still looking for an answer - you have to trigger "focus" event manually in your test:

triggerEvent(<alement selector>, 'focus');

more info: https://guides.emberjs.com/v2.14.0/testing/acceptance/#toc_asynchronous-helpers

Igor
  • 592
  • 2
  • 9
  • 31