{"action":"created","issue":{"url":"https://api.github.com/repos/StephanHoyer/mithril-query/issues/14","labels_url":"https://api.github.com/repos/StephanHoyer/mithril-query/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/StephanHoyer/mithril-query/issues/14/comments","events_url":"https://api.github.com/repos/StephanHoyer/mithril-query/issues/14/events","html_url":"https://github.com/StephanHoyer/mithril-query/pull/14","id":89432078,"number":14,"title":"Proof of concept: use Mithril's mocking functions to query actual DOM","user":{"login":"tombh","id":160835,"avatar_url":"https://avatars.githubusercontent.com/u/160835?v=3","gravatar_id":"","url":"https://api.github.com/users/tombh","html_url":"https://github.com/tombh","followers_url":"https://api.github.com/users/tombh/followers","following_url":"https://api.github.com/users/tombh/following{/other_user}","gists_url":"https://api.github.com/users/tombh/gists{/gist_id}","starred_url":"https://api.github.com/users/tombh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tombh/subscriptions","organizations_url":"https://api.github.com/users/tombh/orgs","repos_url":"https://api.github.com/users/tombh/repos","events_url":"https://api.github.com/users/tombh/events{/privacy}","received_events_url":"https://api.github.com/users/tombh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-06-19T00:28:19Z","updated_at":"2015-06-21T07:49:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/StephanHoyer/mithril-query/pulls/14","html_url":"https://github.com/StephanHoyer/mithril-query/pull/14","diff_url":"https://github.com/StephanHoyer/mithril-query/pull/14.diff","patch_url":"https://github.com/StephanHoyer/mithril-query/pull/14.patch"},"body":"Great library! Thanks.\r\n\r\nI've been playing around to see if you can use this against the DOM as generated by `m.route()`. The mithril.js repo itself comes with great mocks for `window` and `window.XMLHttpRequest`, see: https://github.com/lhorie/mithril.js/blob/next/tests/mock.js So it's already easy to render mithril modules into a fake DOM.\r\n\r\nSo taking it a step further I've added an extra cssauron language for a rendered DOM. I've also added some tests that show how you can now also test modules by visiting URLs (eg; `m.route('/')`) and it even works with URL params, eg; `/route/:param`. Mithril's mocking functions also stub out AJAX requests, so I've also added a test that shows how to render a view with a fake AJAX response. Who needs PhantomJS!\r\n\r\nThere's definitely a lot more tests and tidying up that could be done to this, but I'm just PR'ing it now to see if this is something you'd be interested in? If so, I wonder if @lhorie would be up for packaging `mock.js` along with the npm package? So we didn't have to copy and paste it into this repo every time it updates."},"comment":{"url":"https://api.github.com/repos/StephanHoyer/mithril-query/issues/comments/113871453","html_url":"https://github.com/StephanHoyer/mithril-query/pull/14#issuecomment-113871453","issue_url":"https://api.github.com/repos/StephanHoyer/mithril-query/issues/14","id":113871453,"user":{"login":"StephanHoyer","id":54701,"avatar_url":"https://avatars.githubusercontent.com/u/54701?v=3","gravatar_id":"","url":"https://api.github.com/users/StephanHoyer","html_url":"https://github.com/StephanHoyer","followers_url":"https://api.github.com/users/StephanHoyer/followers","following_url":"https://api.github.com/users/StephanHoyer/following{/other_user}","gists_url":"https://api.github.com/users/StephanHoyer/gists{/gist_id}","starred_url":"https://api.github.com/users/StephanHoyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StephanHoyer/subscriptions","organizations_url":"https://api.github.com/users/StephanHoyer/orgs","repos_url":"https://api.github.com/users/StephanHoyer/repos","events_url":"https://api.github.com/users/StephanHoyer/events{/privacy}","received_events_url":"https://api.github.com/users/StephanHoyer/received_events","type":"User","site_admin":false},"created_at":"2015-06-21T07:49:19Z","updated_at":"2015-06-21T07:49:19Z","body":"Maybe we can have a chat on this on [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/StephanHoyer/mithril-query?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)"}}