{"action":"closed","issue":{"url":"https://api.github.com/repos/Swiip/generator-gulp-angular/issues/693","labels_url":"https://api.github.com/repos/Swiip/generator-gulp-angular/issues/693/labels{/name}","comments_url":"https://api.github.com/repos/Swiip/generator-gulp-angular/issues/693/comments","events_url":"https://api.github.com/repos/Swiip/generator-gulp-angular/issues/693/events","html_url":"https://github.com/Swiip/generator-gulp-angular/issues/693","id":97747796,"number":693,"title":"Unit test controller that uses jQuery: TypeError: 'undefined' is not an object (evaluating 'jQuery('","user":{"login":"dereklin","id":2231799,"avatar_url":"https://avatars.githubusercontent.com/u/2231799?v=3","gravatar_id":"","url":"https://api.github.com/users/dereklin","html_url":"https://github.com/dereklin","followers_url":"https://api.github.com/users/dereklin/followers","following_url":"https://api.github.com/users/dereklin/following{/other_user}","gists_url":"https://api.github.com/users/dereklin/gists{/gist_id}","starred_url":"https://api.github.com/users/dereklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dereklin/subscriptions","organizations_url":"https://api.github.com/users/dereklin/orgs","repos_url":"https://api.github.com/users/dereklin/repos","events_url":"https://api.github.com/users/dereklin/events{/privacy}","received_events_url":"https://api.github.com/users/dereklin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-28T16:27:55Z","updated_at":"2015-08-05T18:18:31Z","closed_at":"2015-08-05T18:18:31Z","body":"I have a controller that have a line of code that sets a focus to an input field:\r\n```\r\njQuery('.input_field')[0].focus();\r\n```\r\n\r\nWhen I run gulp test.  I get:\r\n\r\n```\r\n        TypeError: 'undefined' is not an object (evaluating 'jQuery('.input_field')[0].focus')\r\n```\r\n\r\nHow do I include jQuery in the test code?  Do I need to mock it?\r\n\r\n\r\nI am using:\r\n```\r\n{\r\n  \"generator-gulp-angular\": {\r\n    \"version\": \"0.12.1\",\r\n    \"props\": {\r\n      \"angularVersion\": \"~1.4.0\",\r\n      \"angularModules\": [\r\n        {\r\n          \"key\": \"animate\",\r\n          \"module\": \"ngAnimate\"\r\n        }\r\n      ],\r\n      \"jQuery\": {\r\n        \"key\": \"jquery2\"\r\n      },\r\n      \"resource\": {\r\n        \"key\": \"none\",\r\n        \"module\": null\r\n      },\r\n      \"router\": {\r\n        \"key\": \"ui-router\",\r\n        \"module\": \"ui.router\"\r\n      },\r\n      \"ui\": {\r\n        \"key\": \"bootstrap\",\r\n        \"module\": null\r\n      },\r\n      \"bootstrapComponents\": {\r\n        \"key\": \"ui-bootstrap\",\r\n        \"module\": \"ui.bootstrap\"\r\n      },\r\n      \"cssPreprocessor\": {\r\n        \"key\": \"stylus\",\r\n        \"extension\": \"styl\"\r\n      },\r\n      \"jsPreprocessor\": {\r\n        \"key\": \"none\",\r\n        \"extension\": \"js\",\r\n        \"srcExtension\": \"js\"\r\n      },\r\n      \"htmlPreprocessor\": {\r\n        \"key\": \"none\",\r\n        \"extension\": \"html\"\r\n      },\r\n      \"foundationComponents\": {\r\n        \"name\": null,\r\n        \"version\": null,\r\n        \"key\": null,\r\n        \"module\": null\r\n      },\r\n      \"paths\": {\r\n        \"src\": \"src\",\r\n        \"dist\": \"dist\",\r\n        \"e2e\": \"e2e\",\r\n        \"tmp\": \".tmp\"\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n"}}