Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
fix(withComponent): forward roolEl when calling withComponent (#377)
Browse files Browse the repository at this point in the history
* failing test for withcomponent(β€˜a’) getting passed an href

* reset rootEl when calling withComponent

* add to all contributers

* update to use getRootEl
  • Loading branch information
tikotzky authored and Kent C. Dodds committed Jan 19, 2018
1 parent b564686 commit 5347c77
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,16 @@
"code",
"test"
]
},
{
"login": "tikotzky",
"name": "Mordy Tikotzky",
"avatar_url": "https://avatars3.githubusercontent.com/u/200528?v=4",
"profile": "https://github.com/tikotzky",
"contributions": [
"bug",
"code"
]
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[![downloads][downloads-badge]][npmcharts]
[![MIT License][license-badge]][license]

[![All Contributors](https://img.shields.io/badge/all_contributors-57-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-58-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs]
[![Chat][chat-badge]][chat]
[![Code of Conduct][coc-badge]][coc]
Expand Down Expand Up @@ -162,7 +162,7 @@ Thanks goes to these people ([emoji key][emojis]):
| [<img src="https://avatars3.githubusercontent.com/u/22868432?v=3" width="100px;"/><br /><sub><b>Lufty Wiranda</b></sub>](http://instagram.com/luftywiranda13)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=luftywiranda13 "Code") | [<img src="https://avatars3.githubusercontent.com/u/3208863?v=3" width="100px;"/><br /><sub><b>Ansuman Shah</b></sub>](https://github.com/ansumanshah)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=ansumanshah "Code") [πŸ“–](https://github.com/paypal/glamorous/commits?author=ansumanshah "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/11598?v=3" width="100px;"/><br /><sub><b>Travis LaDuke</b></sub>](http://-)<br />[πŸ’‘](#example-laduke "Examples") | [<img src="https://avatars2.githubusercontent.com/u/11290953?v=3" width="100px;"/><br /><sub><b>AydΔ±n Γ‡ağrΔ± Dumlu</b></sub>](https://github.com/acgrdumlu)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Aacgrdumlu "Bug reports") [πŸ’»](https://github.com/paypal/glamorous/commits?author=acgrdumlu "Code") | [<img src="https://avatars2.githubusercontent.com/u/1383861?v=3" width="100px;"/><br /><sub><b>Maja Wichrowska</b></sub>](https://github.com/majapw)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Amajapw "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/6845263?v=3" width="100px;"/><br /><sub><b>Tom Liu</b></sub>](https://github.com/gt3240)<br />[πŸ“–](https://github.com/paypal/glamorous/commits?author=gt3240 "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1863771?v=3" width="100px;"/><br /><sub><b>Siddharth Kshetrapal</b></sub>](https://github.com/siddharthkp)<br />[⚠️](https://github.com/paypal/glamorous/commits?author=siddharthkp "Tests") [πŸ”§](#tool-siddharthkp "Tools") |
| [<img src="https://avatars2.githubusercontent.com/u/5257243?v=3" width="100px;"/><br /><sub><b>WillowHQ</b></sub>](https://github.com/WillowHQ)<br />[πŸ“–](https://github.com/paypal/glamorous/commits?author=WillowHQ "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/12202757?v=4" width="100px;"/><br /><sub><b>Mohammad Rajabifard</b></sub>](https://tarino.ir)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Amorajabi "Bug reports") [πŸ“–](https://github.com/paypal/glamorous/commits?author=morajabi "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/17005317?v=3" width="100px;"/><br /><sub><b>Omar Albacha</b></sub>](https://github.com/Oalbacha)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=Oalbacha "Code") [πŸ“–](https://github.com/paypal/glamorous/commits?author=Oalbacha "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/28659384?v=3" width="100px;"/><br /><sub><b>tdeschryver</b></sub>](https://github.com/tdeschryver)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=tdeschryver "Code") [⚠️](https://github.com/paypal/glamorous/commits?author=tdeschryver "Tests") | [<img src="https://avatars0.githubusercontent.com/u/4955191?v=4" width="100px;"/><br /><sub><b>Dylan Mozlowski</b></sub>](https://github.com/DylanMoz)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=DylanMoz "Code") | [<img src="https://avatars2.githubusercontent.com/u/3275424?v=4" width="100px;"/><br /><sub><b>andretshurotshka</b></sub>](https://github.com/goodmind)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=goodmind "Code") [⚠️](https://github.com/paypal/glamorous/commits?author=goodmind "Tests") | [<img src="https://avatars3.githubusercontent.com/u/12836237?v=4" width="100px;"/><br /><sub><b>Danila</b></sub>](https://github.com/O4epegb)<br />[⚠️](https://github.com/paypal/glamorous/commits?author=O4epegb "Tests") |
| [<img src="https://avatars3.githubusercontent.com/u/12473268?v=4" width="100px;"/><br /><sub><b>Junyoung Clare Jang</b></sub>](http://ailrun.github.io/)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=Ailrun "Code") [⚠️](https://github.com/paypal/glamorous/commits?author=Ailrun "Tests") | [<img src="https://avatars2.githubusercontent.com/u/897575?v=4" width="100px;"/><br /><sub><b>BjΓΆrn Ricks</b></sub>](https://twitter.com/bjoernricks)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Abjoernricks "Bug reports") [πŸ’»](https://github.com/paypal/glamorous/commits?author=bjoernricks "Code") [πŸ“–](https://github.com/paypal/glamorous/commits?author=bjoernricks "Documentation") [⚠️](https://github.com/paypal/glamorous/commits?author=bjoernricks "Tests") | [<img src="https://avatars0.githubusercontent.com/u/4934193?v=4" width="100px;"/><br /><sub><b>Tyler Deitz</b></sub>](http://tylerdeitz.com)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=tvler "Code") | [<img src="https://avatars2.githubusercontent.com/u/16104985?v=4" width="100px;"/><br /><sub><b>Shovan Chatterjee</b></sub>](https://twitter.com/shovan_ch)<br />[πŸ“–](https://github.com/paypal/glamorous/commits?author=shovanch "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/6839660?v=4" width="100px;"/><br /><sub><b>johnjessewood</b></sub>](https://github.com/johnjesse)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=johnjesse "Code") | [<img src="https://avatars3.githubusercontent.com/u/856386?v=4" width="100px;"/><br /><sub><b>Daniel</b></sub>](https://www.danielberndt.net)<br />[πŸ’»](https://github.com/paypal/glamorous/commits?author=danielberndt "Code") [⚠️](https://github.com/paypal/glamorous/commits?author=danielberndt "Tests") | [<img src="https://avatars0.githubusercontent.com/u/174864?v=4" width="100px;"/><br /><sub><b>Ken Powers</b></sub>](https://knpw.rs)<br />[πŸ€”](#ideas-knpwrs "Ideas, Planning, & Feedback") |
| [<img src="https://avatars1.githubusercontent.com/u/442932?v=4" width="100px;"/><br /><sub><b>John Grishin</b></sub>](http://johngrish.in)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Aexah "Bug reports") [πŸ’»](https://github.com/paypal/glamorous/commits?author=exah "Code") [⚠️](https://github.com/paypal/glamorous/commits?author=exah "Tests") |
| [<img src="https://avatars1.githubusercontent.com/u/442932?v=4" width="100px;"/><br /><sub><b>John Grishin</b></sub>](http://johngrish.in)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Aexah "Bug reports") [πŸ’»](https://github.com/paypal/glamorous/commits?author=exah "Code") [⚠️](https://github.com/paypal/glamorous/commits?author=exah "Tests") | [<img src="https://avatars3.githubusercontent.com/u/200528?v=4" width="100px;"/><br /><sub><b>Mordy Tikotzky</b></sub>](https://github.com/tikotzky)<br />[πŸ›](https://github.com/paypal/glamorous/issues?q=author%3Atikotzky "Bug reports") [πŸ’»](https://github.com/paypal/glamorous/commits?author=tikotzky "Code") |

<!-- ALL-CONTRIBUTORS-LIST:END -->

Expand Down
6 changes: 6 additions & 0 deletions src/__tests__/create-glamorous.with-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ test('resulting component can have its styles extended further', () => {
render(<View className={glamor.css({color: 'green'})} />),
).toMatchSnapshot('overriding styles via className')
})

test('resulting component gets sent valid props', () => {
const A = glamorous.div({}).withComponent('a')
const rendered = render(<A href="https://glamorous.rocks" />)
expect(rendered.prop('href')).toBe('https://glamorous.rocks')
})
1 change: 1 addition & 0 deletions src/create-glamorous.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function createGlamorous(splitProps) {
{
...componentProperties,
comp: newComp,
rootEl: getRootEl(newComp),
},
{
// allows the forwardProps and filterProps to be overridden
Expand Down

0 comments on commit 5347c77

Please sign in to comment.