{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/testing/issues/36","repository_url":"https://api.github.com/repos/aurelia/testing","labels_url":"https://api.github.com/repos/aurelia/testing/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/testing/issues/36/comments","events_url":"https://api.github.com/repos/aurelia/testing/issues/36/events","html_url":"https://github.com/aurelia/testing/issues/36","id":177393197,"number":36,"title":"feature request: method to wait for task queue","user":{"login":"manuel-guilbault","id":718466,"avatar_url":"https://avatars.githubusercontent.com/u/718466?v=3","gravatar_id":"","url":"https://api.github.com/users/manuel-guilbault","html_url":"https://github.com/manuel-guilbault","followers_url":"https://api.github.com/users/manuel-guilbault/followers","following_url":"https://api.github.com/users/manuel-guilbault/following{/other_user}","gists_url":"https://api.github.com/users/manuel-guilbault/gists{/gist_id}","starred_url":"https://api.github.com/users/manuel-guilbault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuel-guilbault/subscriptions","organizations_url":"https://api.github.com/users/manuel-guilbault/orgs","repos_url":"https://api.github.com/users/manuel-guilbault/repos","events_url":"https://api.github.com/users/manuel-guilbault/events{/privacy}","received_events_url":"https://api.github.com/users/manuel-guilbault/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-16T10:31:19Z","updated_at":"2016-09-16T10:55:11Z","closed_at":null,"body":"Many operations are asynchronous in the framework. For example, updating the target of a two-way binding is done asynchronously. When depending on such operations in a test, you need to enqueue the rest of the test on the task queue, which requires code that is repetitive and that adds noise to the tests.\r\n\r\nFor example:\r\n\r\n```js\r\nimport {StageComponent} from 'aurelia-testing';\r\nimport {bootstrap} from 'aurelia-bootstrapper';\r\nimport {TaskQueue} from 'aurelia-framework';\r\n\r\ndescribe('the my-component custom element', () => {\r\n  let viewModel, component, taskQueue;\r\n\r\n  beforeEach(() => {\r\n    viewModel = { result = null };\r\n    component = StageComponent\r\n      .withResource('my-component')\r\n      .inView('<my-component value.two-way=\"result\"></my-component>')\r\n      .boundTo(viewModel);\r\n    component.bootstrap(aurelia => {\r\n      aurelia.use.standardConfiguration();\r\n      taskQueue = aurelia.container.get(TaskQueue);\r\n    });\r\n  });\r\n\r\n  afterEach(() => {\r\n    component.dispose();\r\n  });\r\n\r\n  it('should assign value when whatever', done => {\r\n    //trigger something that should update the value property on the component\r\n    taskQueue.queueMicroTask(() => {\r\n      //assert something about viewModel.result\r\n      done();\r\n    });\r\n  });\r\n});\r\n```\r\n\r\nAt the moment, we have to:\r\n* import the TaskQueue\r\n* define a custom bootstrap function to get the TaskQueue instance\r\n* manually queue a task\r\n\r\nThis last point is mostly annoying because it is not Promise-friendly. Since I use mostly ```jasmine-promises``` instead of the ```done``` callback, I am forced to wrap the call to ```queueMicroTask``` inside a Promise constructor.\r\n\r\nAll of this contribute to make tests bloated with details related to the Aurelia implementation. A new Promise-friendly method on ComponentTester that would wrap all of this could be nice. I could even quickly come up with a PR for this."},"comment":{"url":"https://api.github.com/repos/aurelia/testing/issues/comments/247572981","html_url":"https://github.com/aurelia/testing/issues/36#issuecomment-247572981","issue_url":"https://api.github.com/repos/aurelia/testing/issues/36","id":247572981,"user":{"login":"manuel-guilbault","id":718466,"avatar_url":"https://avatars.githubusercontent.com/u/718466?v=3","gravatar_id":"","url":"https://api.github.com/users/manuel-guilbault","html_url":"https://github.com/manuel-guilbault","followers_url":"https://api.github.com/users/manuel-guilbault/followers","following_url":"https://api.github.com/users/manuel-guilbault/following{/other_user}","gists_url":"https://api.github.com/users/manuel-guilbault/gists{/gist_id}","starred_url":"https://api.github.com/users/manuel-guilbault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manuel-guilbault/subscriptions","organizations_url":"https://api.github.com/users/manuel-guilbault/orgs","repos_url":"https://api.github.com/users/manuel-guilbault/repos","events_url":"https://api.github.com/users/manuel-guilbault/events{/privacy}","received_events_url":"https://api.github.com/users/manuel-guilbault/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T10:55:11Z","updated_at":"2016-09-16T10:55:11Z","body":"Could be useful indeed.\r\nAnd thanks for the example :)"}}
{"actor":{"display_login":"manuel-guilbault"}}