-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Continue to flesh out more tests for new API's. #224
Conversation
Carries over many tests from the previous (now "legacy-0-6-x" suite) into the new system. This is largely to ensure that the regressions previously caught by these tests, are still checked for long after the legacy-0-6-x suite is gone.
698b87b
to
61a92aa
Compare
tests/unit/setup-context-test.js
Outdated
let subject = context.owner.lookup('service:Foo'); | ||
|
||
assert.equal(subject.someMethod(), 'hello thar!'); | ||
}); |
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 we test this.inject('foo')
here too?
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.
Well, that API is no longer present (see examples and reasoning in the RFC), but I will add an example to both these tests and the rendering tests that will be a better demo of the go forward way to do it...
tests/unit/setup-context-test.js
Outdated
}) | ||
); | ||
|
||
let subject = context.owner.lookup('service:Foo'); |
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.
I suppose the uppercase Foo
was deliberate? could probably use a comment in that case
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.
Haha, nope, not intentional. Will fix.
await this.render(hbs`{{x-foo}}`); | ||
|
||
assert.equal(this.element.textContent, 'Click me!', 'precond - component was rendered'); | ||
click(this.element.querySelector('button')); |
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.
I assume at some point passing in just a CSS selector will also be supported?
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, these event helpers are only internal test things for now. My next RFC will be for adding the real ones here (and they will essentially have the same API as ember-native-dom-helpers).
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.
would that mean deprecating ember-native-dom-helpers
?
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.
I don’t know, but possibly. The main differences from what we need here is that we do not want to defer to Ember’s own internal application test globals. It’s definitely possible to do this transition a number of ways...
input.value = '1'; | ||
|
||
fireEvent(input, 'change'); | ||
assert.equal(this.get('value'), '1'); |
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.
precondition assertion might make sense here
await this.clearRender(); | ||
|
||
assert.equal(this.get('foo'), 'updated!'); | ||
assert.equal(this.get('bar'), 'updated bar!'); |
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.
why two properties? because one of them is rendered and the other is not? might need a comment 🤔
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.
Comment added...
Carries over many tests from the previous (now "legacy-0-6-x" suite) into the new system. This is largely to ensure that the regressions previously caught by these tests, are still checked for long after the legacy-0-6-x suite is gone.