{"action":"opened","issue":{"url":"https://api.github.com/repos/kentcdodds/dom-testing-library/issues/136","repository_url":"https://api.github.com/repos/kentcdodds/dom-testing-library","labels_url":"https://api.github.com/repos/kentcdodds/dom-testing-library/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/kentcdodds/dom-testing-library/issues/136/comments","events_url":"https://api.github.com/repos/kentcdodds/dom-testing-library/issues/136/events","html_url":"https://github.com/kentcdodds/dom-testing-library/issues/136","id":373293867,"node_id":"MDU6SXNzdWUzNzMyOTM4Njc=","number":136,"title":"Configurable data-testid","user":{"login":"davidgilbertson","id":4443482,"node_id":"MDQ6VXNlcjQ0NDM0ODI=","avatar_url":"https://avatars2.githubusercontent.com/u/4443482?v=4","gravatar_id":"","url":"https://api.github.com/users/davidgilbertson","html_url":"https://github.com/davidgilbertson","followers_url":"https://api.github.com/users/davidgilbertson/followers","following_url":"https://api.github.com/users/davidgilbertson/following{/other_user}","gists_url":"https://api.github.com/users/davidgilbertson/gists{/gist_id}","starred_url":"https://api.github.com/users/davidgilbertson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidgilbertson/subscriptions","organizations_url":"https://api.github.com/users/davidgilbertson/orgs","repos_url":"https://api.github.com/users/davidgilbertson/repos","events_url":"https://api.github.com/users/davidgilbertson/events{/privacy}","received_events_url":"https://api.github.com/users/davidgilbertson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-24T03:52:10Z","updated_at":"2018-10-24T03:52:10Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n\r\nVote on feature requests by adding a 👍. This helps maintainers prioritize what\r\nto work on.\r\n\r\n* Please fill out this template with all the relevant information so we can\r\n  understand what's going on and fix the issue. We appreciate bugs filed and PRs\r\n  submitted!\r\n\r\n* Please make sure that you are familiar with and follow the Code of Conduct for\r\n  this project (found in the CODE_OF_CONDUCT.md file).\r\n\r\nIt'd be great if after the discussion you're the one who submits the PR that\r\nimplements this feature. If you've never done that before, that's great! Check\r\nthis free short video tutorial to learn how: http://kcd.im/pull-request\r\n\r\n-->\r\n\r\n### Describe the feature you'd like:\r\n\r\n<!--\r\nA clear and concise description of what you want to happen. Add any considered\r\ndrawbacks.\r\n-->\r\n\r\nThe ability to define what attribute will be used to denote a test id.\r\n\r\nFor example, an organisation may have a code base where `data-test-id` is currently used, but `dom-testing-library` will look for an attribute of `data-testid`. If they want to begin using `dom-testing-library`, they would need to universally change all test IDs, which prevents an incremental roll-out.\r\n\r\n### Suggested implementation:\r\n\r\nUsage might be something like:\r\n\r\n```js\r\n// in global test setup\r\nimport domTestingLibrary from 'dom-testing-library';\r\n\r\ndomTestingLibrary.config({ testIdString: 'data-test-id' });\r\n```\r\n\r\nE.g. Cypress does it like so: https://docs.cypress.io/api/cypress-api/config.html#Syntax\r\nJest does it slightly more strangely: https://jestjs.io/docs/en/configuration.html#defaults\r\n\r\nAnother option would be a config file (standalone rc file or package.json prop), but that seems like overkill, and there would be no option to do it per-file which might be useful to some.\r\n\r\nAnd internally, this could perhaps be held in a `config.js` module that is loaded into `queries.js` and referenced. I don't believe there would be any performance impact.\r\n\r\n<!-- Helpful but optional 😀 -->\r\n\r\n### Describe alternatives you've considered:\r\n\r\nI can't think of any alternatives. We actually have an internal component library (separate npm package) and it defines the attribute name `data-test-id` and no option to change it because it's shared across many projects.\r\n\r\n<!--\r\nA clear and concise description of any alternative solutions or features you've\r\nconsidered.\r\n-->\r\n\r\n### Teachability, Documentation, Adoption, Migration Strategy:\r\n\r\nAs an opt-in to change the default, it wouldn't need to be a breaking change, docs should be minimal.\r\n\r\n<!--\r\nIf you can, explain how users will be able to use this and possibly write out a\r\nversion of the docs.\r\n-->\r\n\r\nP.S.: awesome work on this library."}}
{"actor":{"display_login":"davidgilbertson"}}