Skip to content

fix(Button): render labeled as a <button>#597

Merged
levithomason merged 4 commits intoSemantic-Org:masterfrom
xshmatov:master
Oct 3, 2016
Merged

fix(Button): render labeled as a <button>#597
levithomason merged 4 commits intoSemantic-Org:masterfrom
xshmatov:master

Conversation

@xshmatov
Copy link
Copy Markdown

@xshmatov xshmatov commented Oct 3, 2016

Fix switch button to div
#596

fix switch button to div
@codecov-io
Copy link
Copy Markdown

codecov-io commented Oct 3, 2016

Current coverage is 100% (diff: 100%)

Merging #597 into master will not change coverage

@@           master   #597   diff @@
====================================
  Files         119    119          
  Lines        1915   1915          
  Methods         0      0          
  Messages        0      0          
  Branches        0      0          
====================================
  Hits         1915   1915          
  Misses          0      0          
  Partials        0      0          

Powered by Codecov. Last update 6c72147...81b9150

Copy link
Copy Markdown
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, just need a test for this. See test/specs/elements/Button. Should be a very simply copy/paste update of one of the existing tests.
Add your review

@xshmatov
Copy link
Copy Markdown
Author

xshmatov commented Oct 3, 2016

Should work in production this trick fixed the problem.

wrapper.should.have.tagName('button')
wrapper.should.have.className('labeled')
wrapper.should.have.exactly(1).descendants('Icon')
})
Copy link
Copy Markdown
Member

@levithomason levithomason Oct 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the test, let's simplify it a bit. It is best to write tests that are as minimal as possible and assert one thing. This makes them stronger and more maintainable.

In this case, most of the assertions made here are covered by other existing tests, all we should need to assert is that a labeled button renders a button element:

it('renders as a button', () => {
  shallow(<Button labeled />)
    .should.have.tagName('button')
})

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made

@levithomason levithomason changed the title feat(Button): fix switch button to div fix(Button): render labeled as a <button> Oct 3, 2016
@levithomason
Copy link
Copy Markdown
Member

One linter issue:

image

@levithomason
Copy link
Copy Markdown
Member

levithomason commented Oct 3, 2016

Also, if the description of this PR were updated slightly, it will auto close the related issue on merge:

Fix switch button to div 
#596
Fixes #596 switch button to div 

https://github.com/blog/1506-closing-issues-via-pull-requests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants