{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5400","repository_url":"https://api.github.com/repos/Automattic/wp-calypso","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5400/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5400/comments","events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5400/events","html_url":"https://github.com/Automattic/wp-calypso/pull/5400","id":155103408,"number":5400,"title":"Upgrades: Use enzyme for CartButtons test, use `localize` for CartButtons","user":{"login":"ockham","id":96308,"avatar_url":"https://avatars.githubusercontent.com/u/96308?v=3","gravatar_id":"","url":"https://api.github.com/users/ockham","html_url":"https://github.com/ockham","followers_url":"https://api.github.com/users/ockham/followers","following_url":"https://api.github.com/users/ockham/following{/other_user}","gists_url":"https://api.github.com/users/ockham/gists{/gist_id}","starred_url":"https://api.github.com/users/ockham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ockham/subscriptions","organizations_url":"https://api.github.com/users/ockham/orgs","repos_url":"https://api.github.com/users/ockham/repos","events_url":"https://api.github.com/users/ockham/events{/privacy}","received_events_url":"https://api.github.com/users/ockham/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/Components","name":"Components","color":"006b75"},{"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/Purchases","name":"Purchases","color":"006b75"},{"url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Status]%20Ready%20to%20Merge","name":"[Status] Ready to Merge","color":"d4fb79"}],"state":"open","locked":false,"assignee":{"login":"ockham","id":96308,"avatar_url":"https://avatars.githubusercontent.com/u/96308?v=3","gravatar_id":"","url":"https://api.github.com/users/ockham","html_url":"https://github.com/ockham","followers_url":"https://api.github.com/users/ockham/followers","following_url":"https://api.github.com/users/ockham/following{/other_user}","gists_url":"https://api.github.com/users/ockham/gists{/gist_id}","starred_url":"https://api.github.com/users/ockham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ockham/subscriptions","organizations_url":"https://api.github.com/users/ockham/orgs","repos_url":"https://api.github.com/users/ockham/repos","events_url":"https://api.github.com/users/ockham/events{/privacy}","received_events_url":"https://api.github.com/users/ockham/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-05-16T19:33:06Z","updated_at":"2016-05-16T21:43:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5400","html_url":"https://github.com/Automattic/wp-calypso/pull/5400","diff_url":"https://github.com/Automattic/wp-calypso/pull/5400.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/5400.patch"},"body":"Rationale here is to fix the `CartButtons` test to no longer rely on `__reactAutoBindMap`, which is going away with React 15 (see #5116). This is the last occurrence of `__reactAutoBindMap`, but also the trickiest to get rid of.\r\n\r\nThis PR:\r\n* Mocks `AnalyticsMixin` to stub `recordEvent`, instead of indirectly adding `recordEvent` to `CartButtons.prototype.__reactAutoBindMap`.\r\n* Uses enzyme for `CartButtons` tests, to easily find components by class attributes instead of `ref`s.\r\n* Drops `ref`s defined in `cart-buttons.jsx`, which were only used in the test, and, after stubbing `recordEvent`, were giving me [this error](https://fb.me/react-refs-must-have-owner).\r\n* ES6ifies `CartButtons`.\r\n* Wraps `CartButtons` in [`localize()`](https://github.com/Automattic/wp-calypso/tree/master/client/lib/mixins/i18n/localize) for i18n, as `CartButton` tests would otherwise interfere with others, causing them to break.\r\n\r\nCode QA instructions:\r\n* Verify that the `ref`s previously defined in `cart-buttons.jsx` aren't referenced anywhere anymore.\r\n* Verify that `CartButtons` is imported correctly everywhere.\r\n* Verify that tests pass :-)\r\n\r\nTesting instructions:\r\n* Verify that the `CartButtons` component still works correctly -- especially that strings are translated. To see that component, add stuff to your cart for 'yoursite' and hit 'Back' from checkout flow. Then, navigate to http://calypso.localhost:3000/domains/manage/<yoursite>, and click on the little cart icon in the upper right.\r\n\r\n/cc @gwwar @aduth for review"},"comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments/219557621","html_url":"https://github.com/Automattic/wp-calypso/pull/5400#issuecomment-219557621","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5400","id":219557621,"user":{"login":"ockham","id":96308,"avatar_url":"https://avatars.githubusercontent.com/u/96308?v=3","gravatar_id":"","url":"https://api.github.com/users/ockham","html_url":"https://github.com/ockham","followers_url":"https://api.github.com/users/ockham/followers","following_url":"https://api.github.com/users/ockham/following{/other_user}","gists_url":"https://api.github.com/users/ockham/gists{/gist_id}","starred_url":"https://api.github.com/users/ockham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ockham/subscriptions","organizations_url":"https://api.github.com/users/ockham/orgs","repos_url":"https://api.github.com/users/ockham/repos","events_url":"https://api.github.com/users/ockham/events{/privacy}","received_events_url":"https://api.github.com/users/ockham/received_events","type":"User","site_admin":false},"created_at":"2016-05-16T21:43:49Z","updated_at":"2016-05-16T21:43:49Z","body":"Thanks for reviewing! Squashed a bit, going to merge now."}}