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

Add tests for ListGroup #43

Merged
merged 2 commits into from
Apr 14, 2017
Merged

Add tests for ListGroup #43

merged 2 commits into from
Apr 14, 2017

Conversation

folkertdev
Copy link
Collaborator

would like a quick second pair of eyeballs on this.

In particular the tests for keyed elements. I've copied tests for the normal elements to check the keyed ones produce the same html. Maybe it would be better to define the tests once as a function taking a Html msg, then applying that function to a standard and a keyed piece of html?

Copy link
Owner

@rundis rundis left a comment

Choose a reason for hiding this comment

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

Looks pretty good. Made a few minor comments.

[ ListGroup.li [] [ text "List item 1" ]
]

active =
Copy link
Owner

Choose a reason for hiding this comment

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

Why not just put an active item and disabled item in the list for html and then have assertions for 0, 1, 2 indexed items ?

\() ->
html
|> Query.fromHtml
|> Query.has [ tag "li", Selector.disabled False ]
Copy link
Owner

Choose a reason for hiding this comment

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

This assertion strikes me as a bit odd. I can sort of understand it, but if we are to test everything that should not be set... there's a lot you need to assert.

{-| The fact that an element is keyed is not visible from the dom, so
this just tests that the keyed versions produce the same html as the "vanilla" ones
-}
keyedListGroup : Test
Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, I think it might be worth extracting all that's common between vanilla and keyed into a separate function used by both.

]


contextualListGroup : Test
Copy link
Owner

Choose a reason for hiding this comment

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

Cool. Like this approach !

@folkertdev
Copy link
Collaborator Author

The above commit uses the same test for normal and keyed, and fixes the other problems you raised.

@rundis rundis merged commit aad59e0 into rundis:master Apr 14, 2017
@rundis
Copy link
Owner

rundis commented Apr 14, 2017

Looking good ! Tx.

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.

2 participants