diff --git a/.all-contributorsrc b/.all-contributorsrc index f36aa4d9..e19bb8f9 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -198,6 +198,15 @@ "bug", "doc" ] + }, + { + "login": "mufasa71", + "name": "Shukhrat Mukimov", + "avatar_url": "https://avatars1.githubusercontent.com/u/626420?v=4", + "profile": "https://github.com/mufasa71", + "contributions": [ + "bug" + ] } ] } diff --git a/README.md b/README.md index 05d08d1b..a1e4cac1 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] -[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-20-orange.svg?style=flat-square)](#contributors) [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] @@ -733,10 +733,10 @@ Thanks goes to these people ([emoji key][emojis]): -| [
Kent C. Dodds](https://kentcdodds.com)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=kentcdodds "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=kentcdodds "Documentation") [๐Ÿš‡](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=kentcdodds "Tests") | [
Ryan Castner](http://audiolion.github.io)
[๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=audiolion "Documentation") | [
Daniel Sandiego](https://www.dnlsandiego.com)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=dnlsandiego "Code") | [
Paweล‚ Mikoล‚ajczyk](https://github.com/Miklet)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=Miklet "Code") | [
Alejandro ร‘รกรฑez Ortiz](http://co.linkedin.com/in/alejandronanez/)
[๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=alejandronanez "Documentation") | [
Matt Parrish](https://github.com/pbomb)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Apbomb "Bug reports") [๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=pbomb "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=pbomb "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=pbomb "Tests") | [
Justin Hall](https://github.com/wKovacs64)
[๐Ÿ“ฆ](#platform-wKovacs64 "Packaging/porting to new platform") | +| [Kent C. Dodds
Kent C. Dodds](https://kentcdodds.com)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=kentcdodds "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=kentcdodds "Documentation") [๐Ÿš‡](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=kentcdodds "Tests") | [Ryan Castner
Ryan Castner](http://audiolion.github.io)
[๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=audiolion "Documentation") | [Daniel Sandiego
Daniel Sandiego](https://www.dnlsandiego.com)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=dnlsandiego "Code") | [Paweล‚ Mikoล‚ajczyk
Paweล‚ Mikoล‚ajczyk](https://github.com/Miklet)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=Miklet "Code") | [Alejandro ร‘รกรฑez Ortiz
Alejandro ร‘รกรฑez Ortiz](http://co.linkedin.com/in/alejandronanez/)
[๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=alejandronanez "Documentation") | [Matt Parrish
Matt Parrish](https://github.com/pbomb)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Apbomb "Bug reports") [๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=pbomb "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=pbomb "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=pbomb "Tests") | [Justin Hall
Justin Hall](https://github.com/wKovacs64)
[๐Ÿ“ฆ](#platform-wKovacs64 "Packaging/porting to new platform") | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| [
Anto Aravinth](https://github.com/antoaravinth)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=antoaravinth "Code") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=antoaravinth "Tests") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=antoaravinth "Documentation") | [
Jonah Moses](https://github.com/JonahMoses)
[๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=JonahMoses "Documentation") | [
ลukasz Gandecki](http://team.thebrain.pro)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=lgandecki "Code") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=lgandecki "Tests") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=lgandecki "Documentation") | [
Ivan Babak](https://sompylasar.github.io)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Asompylasar "Bug reports") [๐Ÿค”](#ideas-sompylasar "Ideas, Planning, & Feedback") | [
Jesse Day](https://github.com/jday3)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=jday3 "Code") | [
Ernesto Garcรญa](http://gnapse.github.io)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=gnapse "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=gnapse "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=gnapse "Tests") | [
Mark Volkmann](http://ociweb.com/mark/)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Amvolkmann "Bug reports") [๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=mvolkmann "Code") | -| [
smacpherson64](https://github.com/smacpherson64)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=smacpherson64 "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=smacpherson64 "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=smacpherson64 "Tests") | [
John Gozde](https://github.com/jgoz)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Ajgoz "Bug reports") [๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=jgoz "Code") | [
Iwona](https://github.com/callada)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=callada "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=callada "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=callada "Tests") | [
Lewis](https://github.com/6ewis)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=6ewis "Code") | [
Leandro Lourenci](https://blog.lourenci.com/)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Alourenci "Bug reports") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=lourenci "Documentation") | +| [Anto Aravinth
Anto Aravinth](https://github.com/antoaravinth)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=antoaravinth "Code") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=antoaravinth "Tests") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=antoaravinth "Documentation") | [Jonah Moses
Jonah Moses](https://github.com/JonahMoses)
[๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=JonahMoses "Documentation") | [ลukasz Gandecki
ลukasz Gandecki](http://team.thebrain.pro)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=lgandecki "Code") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=lgandecki "Tests") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=lgandecki "Documentation") | [Ivan Babak
Ivan Babak](https://sompylasar.github.io)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Asompylasar "Bug reports") [๐Ÿค”](#ideas-sompylasar "Ideas, Planning, & Feedback") | [Jesse Day
Jesse Day](https://github.com/jday3)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=jday3 "Code") | [Ernesto Garcรญa
Ernesto Garcรญa](http://gnapse.github.io)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=gnapse "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=gnapse "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=gnapse "Tests") | [Mark Volkmann
Mark Volkmann](http://ociweb.com/mark/)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Amvolkmann "Bug reports") [๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=mvolkmann "Code") | +| [smacpherson64
smacpherson64](https://github.com/smacpherson64)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=smacpherson64 "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=smacpherson64 "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=smacpherson64 "Tests") | [John Gozde
John Gozde](https://github.com/jgoz)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Ajgoz "Bug reports") [๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=jgoz "Code") | [Iwona
Iwona](https://github.com/callada)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=callada "Code") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=callada "Documentation") [โš ๏ธ](https://github.com/gnapse/jest-dom/commits?author=callada "Tests") | [Lewis
Lewis](https://github.com/6ewis)
[๐Ÿ’ป](https://github.com/gnapse/jest-dom/commits?author=6ewis "Code") | [Leandro Lourenci
Leandro Lourenci](https://blog.lourenci.com/)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Alourenci "Bug reports") [๐Ÿ“–](https://github.com/gnapse/jest-dom/commits?author=lourenci "Documentation") | [Shukhrat Mukimov
Shukhrat Mukimov](https://github.com/mufasa71)
[๐Ÿ›](https://github.com/gnapse/jest-dom/issues?q=author%3Amufasa71 "Bug reports") | diff --git a/package.json b/package.json index 86bd4071..a242ec19 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "dependencies": { "chalk": "^2.4.1", "css": "^2.2.3", + "css.escape": "^1.5.1", "jest-diff": "^24.0.0", "jest-matcher-utils": "^24.0.0", "lodash": "^4.17.11", diff --git a/src/__tests__/to-have-form-values.js b/src/__tests__/to-have-form-values.js index 9fef4599..37cf74d7 100644 --- a/src/__tests__/to-have-form-values.js +++ b/src/__tests__/to-have-form-values.js @@ -23,6 +23,9 @@ const defaultValues = { description: 'You need to know your stuff', remote: true, freelancing: false, + 'is%Private^': true, + 'benefits[0]': 'Fruit & free drinks everyday', + 'benefits[1]': 'Multicultural environment', } function renderForm({ @@ -71,6 +74,30 @@ function renderForm({ /> +
+ Benefits + + +
+ + + + ${selectSingle('category', 'Category', categories, values.category)} ${selectMultiple('skills', 'Skills', skills, values.skills)} diff --git a/src/to-have-form-values.js b/src/to-have-form-values.js index 5e34def0..8028edfa 100644 --- a/src/to-have-form-values.js +++ b/src/to-have-form-values.js @@ -4,6 +4,7 @@ import isEqual from 'lodash/isEqual' import isEqualWith from 'lodash/isEqualWith' import uniq from 'lodash/uniq' import {checkHtmlElement} from './utils' +import escape from 'css.escape' function compareArraysAsSet(a, b) { if (Array.isArray(a) && Array.isArray(b)) { @@ -74,7 +75,7 @@ function getMultiElementValue(elements) { } function getFormValue(container, name) { - const elements = [...container.querySelectorAll(`[name="${name}"]`)] + const elements = [...container.querySelectorAll(`[name="${escape(name)}"]`)] /* istanbul ignore if */ if (elements.length === 0) { return undefined // shouldn't happen, but just in case