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 [attr] and [attr="val"] to findNode capabilities #22

Closed
wants to merge 2 commits into from

Conversation

donabrams
Copy link

Added support for tree.findNode('[data-has-tests="yay"]'). Tests added and passing.

@glenjamin
Copy link
Owner

Ooo, this is quite nice - but I'm not sure if it'll be needed once we do the API changes discussed in #9 (comment) land - what do you think?

@donabrams
Copy link
Author

#9 will definitely solve this case. ETA?

@glenjamin
Copy link
Owner

I meant to do it last weekend - so should be soon.

@glenjamin
Copy link
Owner

I've published v0.9.0 which allows you to pass props as the second argument of subTree and everySubTree.

Along with the findComponent and findComponentLike functions this should cover the functionality in this PR - let me know if you need more in the short term.

@glenjamin glenjamin closed this Oct 15, 2015
@donabrams
Copy link
Author

Awesome, thanks!

@donabrams
Copy link
Author

Hmm, I don't necessarily want to have to specify the Component Name, just filter based on props. Context: we're using skin deep to get coverage and verify behavior but NOT tie ourselves to html structure/presentation (classes/ids). So really, this would be our ideal API:

tree.findNode({'data-testref': 'good'});
tree.everySubTree({'data-testref': /.*good.*/});
tree.findComponentLike({'data-testref': 'yay green'}, 
    { children: ['Navigation', {'data-testref': 'fly'}] });

@glenjamin
Copy link
Owner

Ah, I see - could you live with * as the first argument?

@donabrams
Copy link
Author

Yeah, definitely could do that.

@glenjamin
Copy link
Owner

Released * in subTree and everySubTree as v0.11.0.

Haven't added to other methods as they're all going away soonish.

@donabrams
Copy link
Author

Goooood.... GOOOOOOOOD... Now all we gotta do is write a ton of tests!

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