-
-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce direct jQuery usage in tests. #215
Conversation
rwjblue
commented
Oct 8, 2017
•
edited
Loading
edited
- add test scenarios that run without jQuery (defaulting to jQueryless setup)
- refactor all tests to avoid jQuery usage
- embed custom eventing test helpers (until we can bring ember-native-dom-helpers into the fold)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please!
@@ -760,7 +763,7 @@ moduleForComponent('Component Integration Tests: willDestoryElement', { | |||
'component:my-component': Component.extend({ | |||
willDestroyElement() { | |||
var stateIndicatesInDOM = this._state === 'inDOM'; | |||
var actuallyInDOM = $.contains(document, this.$()[0]); | |||
var actuallyInDOM = document.contains(this._element); | |||
|
|||
QUnit.config.current.assert.ok( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably break this up into two assertions so you can get more granular feedback when it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, great point!
673f402
to
c3b1a6d
Compare
Updating the resolver to fallback to "real" resolving (so that we can automatically get the event_dispatcher:main for jQueryless usage) leads to some tests failing now due to `application.hbs` having the text contents of the welcome page component. Remove this template so that it doesn't interfere with the existing tests...
Without this looking up `event_dispatcher:main` does not find the event dispatcher that is normally provided by ember-native-dom-event-dispatcher.
Mostly copied/stolen from emberjs's packages/ember-testing/lib/events.js but with some tweaks to make it work without jQuery (I think those changes were made upstream in Ember as well). The long term goal here is to remove this file and have ember-test-helpers _include_ the helpers from ember-native-dom-helpers, but that will require an RFC once the changes proposed in emberjs/rfcs#230 are implemented.
When a given test is explicitly testing jQuery behaviors, this helper will be used...
Apparently, the dummy app _must_ have an `app/templates/` tree. 😡
Updated with lots more changes. Tests are passing locally without jQuery (and scenarios were added to ember-try config to test with and without jQuery). Playing a bit of whack-a-mole with various issues in CI, but generally speaking I think this pretty close... |
The built-in `packages/ember-testing` does not work for acceptance tests in 2.12.
Finally green. |