-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add acceptance test helper nativeClick and use it in modal assert hel…
…pers. A helper for firing native click events in acceptance tests for ember versions < 2.5.
- Loading branch information
Showing
4 changed files
with
28 additions
and
3 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
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