Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(card): add missing hasRipple (#248) #255

Merged
merged 2 commits into from
Sep 19, 2018

Conversation

bmihelac
Copy link
Contributor

No description provided.

Copy link

@moog16 moog16 left a comment

Choose a reason for hiding this comment

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

Just curious what the use case for not having the ripple is?

);
}
}


const PrimaryContentDefault = (props) => {
Copy link

Choose a reason for hiding this comment

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

Instead of PrimaryContentDefault, can we name it PrimaryContentBase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bmihelac
Copy link
Contributor Author

Good question. Looking mdc-card it looks like there is no use-case for PrimaryContent without ripple:

Only applicable to cards that have a primary action that the main surface should trigger.

I can refactor this PR to remove hasRipple prop and export decorated with withRipple component instead.

@moog16
Copy link

moog16 commented Sep 17, 2018

@bmihelac that sounds good to me!

@bmihelac
Copy link
Contributor Author

@moog16 PR has been refactored (would rebase when add tests)

One thing that I am not sure how to do is testing that PrimaryContent has ripple. Here is my not working code:

test('it should contain mdc-ripple-upgraded', () => {
const wrapper = mount(<CardPrimaryContent/>);
//assert.isTrue(
//wrapper.update()
//.find('.mdc-card__primary-action')
//.hasClass('mdc-ripple-upgraded'));
});

Any idea how to test this?

@moog16
Copy link

moog16 commented Sep 18, 2018

@bmihelac figured it out...the upgraded class is added in a requestAnimationFrame. So just wrap the assert in a requestAnimationFrame.

@moog16
Copy link

moog16 commented Sep 18, 2018

@bmihelac - instead of wrapping it in a rAF, please use the rAF helper we have https://github.com/material-components/material-components-web-react/blob/master/test/unit/helpers/raf.js. Example seen in ripple unit test.

@bmihelac
Copy link
Contributor Author

Thanks @moog16, that worked perfectly.
I have added missing test and rebased PR.

@bmihelac
Copy link
Contributor Author

Let me know if anything else is needed regarding this.

@moog16
Copy link

moog16 commented Sep 18, 2018

looks good to me. I'm going to open another pr for tests. Thanks!

@codecov-io
Copy link

codecov-io commented Sep 18, 2018

Codecov Report

Merging #255 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #255   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files          27       27           
  Lines        1089     1089           
  Branches      107      107           
=======================================
  Hits         1063     1063           
  Misses         26       26
Impacted Files Coverage Δ
packages/card/PrimaryContent.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 731e980...aae5803. Read the comment docs.

@moog16
Copy link

moog16 commented Sep 18, 2018

Once CI passes on this PR: #263 we can merge this PR.

@bmihelac can you please sign this PR?

@bmihelac
Copy link
Contributor Author

@bmihelac can you please sign this PR?

signed.

@moog16
Copy link

moog16 commented Sep 19, 2018

@moog16 moog16 merged commit d2f58d6 into material-components:master Sep 19, 2018
@bmihelac
Copy link
Contributor Author

thank you @moog16 !

@moog16 moog16 mentioned this pull request Sep 21, 2018
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