From 6375a25d932bf5abbaec9b31e7e630e58b8a0274 Mon Sep 17 00:00:00 2001 From: Ivan Babak Date: Fri, 6 Apr 2018 20:59:21 -0700 Subject: [PATCH 1/3] fix(add-commands): reorder forEach arg fields for consistency --- src/add-commands.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/add-commands.js b/src/add-commands.js index 6adaeef..43e8f14 100644 --- a/src/add-commands.js +++ b/src/add-commands.js @@ -1,6 +1,6 @@ import {commands} from './' -commands.forEach(({command, name}) => { +commands.forEach(({name, command}) => { Cypress.Commands.add(name, command) }) From 899897e864945a40eb16d9433f53f3b7e57daef8 Mon Sep 17 00:00:00 2001 From: Ivan Babak Date: Fri, 6 Apr 2018 21:03:55 -0700 Subject: [PATCH 2/3] fix(commands): use getBy, not queryBy, to fail on missing element BREAKING CHANGE: The queries will now throw a useful message and fail the test if the queried element is missing. --- src/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 4713b7b..a18dff4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,18 +1,17 @@ import {queries} from 'dom-testing-library' const commands = Object.keys(queries) - .filter(queryName => queryName.startsWith('query')) + .filter(queryName => queryName.startsWith('getBy')) .map(queryName => { - const commandName = queryName.replace(/^query/, 'get') return { - name: commandName, + name: queryName, command: (...args) => { const fn = new Function( 'args', 'query', 'getCommandWaiter', ` - return function Command__${commandName}({document}) { + return function Command__${queryName}({document}) { return getCommandWaiter(document, () => query(document, ...args))(); }; `, From 9c68958828d9e0b693a53351fd3e218ca3dc334c Mon Sep 17 00:00:00 2001 From: Ivan Babak Date: Fri, 6 Apr 2018 21:07:54 -0700 Subject: [PATCH 3/3] docs(contributors): add sompylasar --- .all-contributorsrc | 13 ++++++++++++- README.md | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 2aa7305..effa20c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -18,6 +18,17 @@ "infra", "test" ] + }, + { + "login": "sompylasar", + "name": "Ivan Babak", + "avatar_url": "https://avatars2.githubusercontent.com/u/498274?v=4", + "profile": "https://sompylasar.github.io", + "contributions": [ + "code", + "ideas" + ] } - ] + ], + "repoType": "github" } diff --git a/README.md b/README.md index 3971f94..5f1b4b0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] -[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors) [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] @@ -74,8 +74,8 @@ Thanks goes to these people ([emoji key][emojis]): -| [
Kent C. Dodds](https://kentcdodds.com)
[💻](https://github.com/kentcdodds/cypress-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/cypress-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/cypress-testing-library/commits?author=kentcdodds "Tests") | -| :---: | +| [
Kent C. Dodds](https://kentcdodds.com)
[💻](https://github.com/kentcdodds/cypress-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/cypress-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/cypress-testing-library/commits?author=kentcdodds "Tests") | [
Ivan Babak](https://sompylasar.github.io)
[💻](https://github.com/kentcdodds/cypress-testing-library/commits?author=sompylasar "Code") [🤔](#ideas-sompylasar "Ideas, Planning, & Feedback") | +| :---: | :---: |