Skip to content

feat(VerticalNav): Add a prop to allow disabling persistence - #307

Merged
jeff-phillips-18 merged 1 commit into
patternfly:masterfrom
mturley:vert-nav-persistence
Apr 20, 2018
Merged

jeff-phillips-18 merged 1 commit into
patternfly:masterfrom
mturley:vert-nav-persistence

Conversation

@mturley

@mturley mturley commented Apr 16, 2018 •

Copy link
Copy Markdown
Contributor

What:

You can now pass persist={false} to VerticalNav to turn off the persistence behavior.

Link to Storybook:

http://rawgit.com/mturley/patternfly-react/vert-nav-persist-sb/index.html

@coveralls

coveralls commented Apr 16, 2018 •

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 1206

  • 7 of 7 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 75.299%

Totals Coverage Status
Change from base Build 1203: 0.07%
Covered Lines: 1535
Relevant Lines: 1856

💛 - Coveralls

@mturley
mturley force-pushed the vert-nav-persistence branch from 7962cd1 to c014c55 Compare April 16, 2018 19:27
expect(component.render()).toMatchSnapshot();
});

test('VerticalNav renders properly with persistence off', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't feel like this test does much. To rest the persist ternary you could export WithPersist and NoPersist from VericalNav.js (not the index.js) and then import them in the test. You could then assert similar to below:

const component = shallow(<VerticalNav persist />);
expect(component.find(WithPersist).exists()).toBe(true);

and

const component = shallow(<VerticalNav persist={false} />);
expect(component.find(NoPersist).exists()).toBe(true);

This still doesn't cover everything, but it probably is not worth writing tests for the controlled HOC if it is going away.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. I mostly copypasted as a sanity check to make sure the component doesn't crash when rendered that way. I like your version better. You're full of little snippets for my code library @dmiller9911.

You can now pass persist={false} to VerticalNav to turn off the persistence behavior.
@mturley

mturley commented Apr 17, 2018

Copy link
Copy Markdown
Contributor Author

@jeff-phillips-18 I rebased this and folded in @dmiller9911's feedback, can you re-approve when you get a chance?

@priley86

Copy link
Copy Markdown
Member

i'm ok w/ this for now - knowing that we are revisiting controlled() later (and moving to getDerivedStateFromProps. I'm guessing that some consumers could still prefer redux for this persistent state (and disable persistence with this option), but eventually if we still want to provide persistence here, maybe it makes sense to write a vanilla React HoC instead of using Recompose? Leave that up to you though... i'll be happy as long as we have coverage!! ;)

@jeff-phillips-18
jeff-phillips-18 merged commit b32aeb8 into patternfly:master Apr 20, 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.

5 participants