mirror of
https://github.com/scratchfoundation/scratch-html5.git
synced 2024-12-02 20:07:09 -05:00
Extend .is(:focus) check to activeElement.
If this test has to be used more often, I suggest to use a prototype. This bugfix is based on various SO threads like http://stackoverflow.com/questions/18850219/testing-for-focus-an-angularjs-directive
This commit is contained in:
parent
623dce5402
commit
a3cd2c796a
1 changed files with 8 additions and 2 deletions
|
@ -169,7 +169,10 @@ describe('Sprite', function() {
|
|||
expect($('.ask-container').css('bottom')).toBe('7px');
|
||||
expect($('.ask-container').css('height')).toBe('25px');
|
||||
expect($('.ask-container').css('height')).toBe('25px');
|
||||
expect($('.ask-text-field').is(':focus')).toBe(true);
|
||||
expect(
|
||||
$('.ask-text-field').is(':focus') ||
|
||||
document.activeElement.className.match(/ask-text-field/) !== null
|
||||
).toBe(true);
|
||||
expect(spriteProto.askInputOn).toBe(true);
|
||||
});
|
||||
|
||||
|
@ -177,7 +180,10 @@ describe('Sprite', function() {
|
|||
spriteProto.visible = false;
|
||||
spriteProto.showAsk();
|
||||
expect($('.ask-container').css('display')).toBe('none');
|
||||
expect($('.ask-text-field').is(':focus')).toBe(false);
|
||||
expect(
|
||||
$('.ask-text-field').is(':focus') ||
|
||||
document.activeElement.className.match(/ask-text-field/) !== null
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue