{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/12890","repository_url":"https://api.github.com/repos/emberjs/ember.js","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/12890/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/12890/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/12890/events","html_url":"https://github.com/emberjs/ember.js/pull/12890","id":130553053,"number":12890,"title":"[WIP] [Glimmer2] Component invocation tests","user":{"login":"Serabe","id":36221,"avatar_url":"https://avatars.githubusercontent.com/u/36221?v=3","gravatar_id":"","url":"https://api.github.com/users/Serabe","html_url":"https://github.com/Serabe","followers_url":"https://api.github.com/users/Serabe/followers","following_url":"https://api.github.com/users/Serabe/following{/other_user}","gists_url":"https://api.github.com/users/Serabe/gists{/gist_id}","starred_url":"https://api.github.com/users/Serabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Serabe/subscriptions","organizations_url":"https://api.github.com/users/Serabe/orgs","repos_url":"https://api.github.com/users/Serabe/repos","events_url":"https://api.github.com/users/Serabe/events{/privacy}","received_events_url":"https://api.github.com/users/Serabe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":32,"created_at":"2016-02-02T02:42:18Z","updated_at":"2016-04-05T17:58:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/emberjs/ember.js/pulls/12890","html_url":"https://github.com/emberjs/ember.js/pull/12890","diff_url":"https://github.com/emberjs/ember.js/pull/12890.diff","patch_url":"https://github.com/emberjs/ember.js/pull/12890.patch"},"body":"This PR explores the use of Glimmer `RenderingTest` and `moduleFor`, by @chancancode and @wycats, for Ember testing. This was originally a duplicate effort with a similar DSL for test, though it used plain QUnit.\r\n\r\nFirst file to be _ported_ has been `component_invocation_test.js`, though we have only changed superficial methods and I'll go through the file again to use some of the assertions included in `RenderingTest`.\r\n\r\nA few comments on the experience:\r\n\r\n1. I would make `render()` and `rerender()` to be wrapped inside a `run` by default.\r\n2. I needed to change the behaviour of templates to be accepted compiled. A few tests depended on passing a given environment to the compiler.\r\n\r\nFor the `render()` and `rerender()` case, I think it is easier to read:\r\n\r\n```js\r\n// Test setup\r\n\r\nthis.render('{{my-component}}');\r\n\r\n// Some assertions\r\n```\r\n\r\nthan:\r\n\r\n```js\r\n// Test setup\r\n\r\nEmber.run(() => {\r\n  this.render('{{my-component}}');\r\n});\r\n\r\n// Some assertions\r\n```\r\n\r\nIf for any reason the test needed to render the component without being inside a `run`, `this.component.render()` would be enough.\r\n\r\nAnd just curious, why are all test names surrounded by `[]`, babel seems to be ok with just `'@test something'(){}`\r\n\r\nOld PR\r\n~~This PR adds a module to improve internal testing. The final purpose is to\r\navoid the use of `View`s for testing.~~\r\n\r\n~~This PR is in WIP until:~~\r\n- ~~A name for `moduleForApp` has been chosen.~~\r\n- ~~The API has been approved.~~\r\n\r\n~~The API has been created to avoid the need of using the internal variables (no more need to use `view` as the variable to make the `teardown` work).~~\r\n\r\n## ~~API~~\r\n\r\n### ~~`this.getOwner()`~~\r\n\r\n~~Returns the `owner` created for this test run.~~\r\n\r\n### ~~`this.register(fullName, factory, options)`~~\r\n\r\n~~Registers in the `owner` the `factory` with the name `fullName` and the given `options`. Returns the registered `factory`.~~\r\n\r\n### ~~`this.render(template, hash={})`~~\r\n\r\n~~Creates a new anonymous component with the `owner` for the tests and the given `template`. It instances said component with the passed `hash` and appends it to the view.~~\r\n\r\n~~Currently, `template` needs to be compiled previously.~~\r\n\r\n~~The instance is kept to be destroyed in the `teardown` process.~~\r\n\r\n~~It returns the component instance.~~\r\n\r\n~~Calling it more than once makes the test fails~~\r\n\r\n###~~ `this.rerender()`~~\r\n\r\n~~Same as `run(component, 'rerender')`, where component is the one `this.render` instantiated.~~\r\n\r\n### ~~`this.$()`~~\r\n\r\n~~Calls `$()` in the `component` created while using `this.render()`.~~"},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/205920910","html_url":"https://github.com/emberjs/ember.js/pull/12890#issuecomment-205920910","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/12890","id":205920910,"user":{"login":"homu","id":10212162,"avatar_url":"https://avatars.githubusercontent.com/u/10212162?v=3","gravatar_id":"","url":"https://api.github.com/users/homu","html_url":"https://github.com/homu","followers_url":"https://api.github.com/users/homu/followers","following_url":"https://api.github.com/users/homu/following{/other_user}","gists_url":"https://api.github.com/users/homu/gists{/gist_id}","starred_url":"https://api.github.com/users/homu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/homu/subscriptions","organizations_url":"https://api.github.com/users/homu/orgs","repos_url":"https://api.github.com/users/homu/repos","events_url":"https://api.github.com/users/homu/events{/privacy}","received_events_url":"https://api.github.com/users/homu/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T17:58:31Z","updated_at":"2016-04-05T17:58:31Z","body":":umbrella: The latest upstream changes (presumably #13208) made this pull request unmergeable. Please resolve the merge conflicts."}}