{"action":"opened","issue":{"url":"https://api.github.com/repos/chaijs/chai-jquery/issues/77","labels_url":"https://api.github.com/repos/chaijs/chai-jquery/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/chaijs/chai-jquery/issues/77/comments","events_url":"https://api.github.com/repos/chaijs/chai-jquery/issues/77/events","html_url":"https://github.com/chaijs/chai-jquery/issues/77","id":123446614,"number":77,"title":"Only first element is tested","user":{"login":"joelrich","id":4216919,"avatar_url":"https://avatars.githubusercontent.com/u/4216919?v=3","gravatar_id":"","url":"https://api.github.com/users/joelrich","html_url":"https://github.com/joelrich","followers_url":"https://api.github.com/users/joelrich/followers","following_url":"https://api.github.com/users/joelrich/following{/other_user}","gists_url":"https://api.github.com/users/joelrich/gists{/gist_id}","starred_url":"https://api.github.com/users/joelrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joelrich/subscriptions","organizations_url":"https://api.github.com/users/joelrich/orgs","repos_url":"https://api.github.com/users/joelrich/repos","events_url":"https://api.github.com/users/joelrich/events{/privacy}","received_events_url":"https://api.github.com/users/joelrich/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-22T09:29:30Z","updated_at":"2015-12-22T09:29:30Z","closed_at":null,"body":"I have noticed that only the first element which is passed to the `expect` function is tested for the expectation. Example:\r\n\r\n```javascript\r\nit('should fail', function () {\r\n    var divs = $('<div title=\"a\"></div><div title=\"b\"></div>');\r\n    expect(divs).to.have.attr('title', 'a');\r\n});\r\n````\r\n\r\nThis test does not fail because only the first `div` is tested. Since jQuery usually performs operations for every selected element, this was surprise for me.\r\n\r\nI don't think the current behaviour should be changed because otherwise it could happen that tests, which fail at the moment because an empty jQuery is passed to `expect()` would suddenly succeed. However, I think it would be convenient to introduce the `each` keyword which performs the expectation for every given element. Example:\r\n\r\n```javascript\r\nit('should fail', function () {\r\n    var divs = $('<div title=\"a\"></div><div title=\"b\"></div>');\r\n    expect(divs).each.to.have.attr('title', 'a');\r\n});\r\n````\r\n\r\nWhat do you think?"}}