Testing for focus an AngularJS directive

前端 未结 2 1842
清歌不尽
清歌不尽 2021-02-05 05:38

How can you test for focus in an AngularJS directive? I would expect the following to work:

describe(\'focus test\', function(){
    it(\'should focus element\',         


        
2条回答
  •  隐瞒了意图╮
    2021-02-05 06:35

    Try 'document.activeElement' instead of ':focus'. I haven't tested it in karma, but $('document.activeElement') behaves as desired under standard jQuery.

提交回复
热议问题