-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from oscarni/master
Register unique clickOutsideToClose click handlers
- Loading branch information
Showing
8 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Ember from 'ember'; | ||
|
||
function fireNativeMouseEvent(eventType, selectorOrDomElement, context) { | ||
let event = new window.Event(eventType, { bubbles: true, cancelable: true, view: window }); | ||
let target; | ||
if (typeof selectorOrDomElement === 'string') { | ||
target = Ember.$(selectorOrDomElement, context)[0]; | ||
} else { | ||
target = selectorOrDomElement; | ||
} | ||
Ember.run(() => target.dispatchEvent(event)); | ||
} | ||
|
||
export default function acceptanceTestHelpers() { | ||
|
||
Ember.Test.registerAsyncHelper('nativeClick', function(app, selectorOrDomElement, context) { | ||
fireNativeMouseEvent('click', selectorOrDomElement, context); | ||
wait(); | ||
}); | ||
|
||
} | ||
|
||
export default acceptanceTestHelpers(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters