Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

find with css-style selectors #18

Closed
BlueVajra opened this issue Sep 30, 2015 · 7 comments
Closed

find with css-style selectors #18

BlueVajra opened this issue Sep 30, 2015 · 7 comments

Comments

@BlueVajra
Copy link

It seems the selectors work with elements, for instance "div a" but normal css selectors like ".button.delete" don't seem to work with find. Are there plans for this?

@percyhanna
Copy link
Owner

rquery supports class and attribute selectors, as well as union (a, b), descendent (a b), and child (a > b) syntax.

If these aren't working for you then there's potentially something else going on. As noted in #14, rquery doesn't currently support shallow rendering.

@BlueVajra
Copy link
Author

does rquery class selectors only allow one class? For instance, in my rquery test, I examine the component and see these props

props:
      { className: 'button disabled',
        onClick: [Object],
        children: [Object] }

when I try either of these I get true

expect($component.find('.button')).to.have.length(1);
expect($component.find('.disabled')).to.have.length(1);

yet when I try to use the following, I get false

expect($component.find('.button.disabled')).to.have.length(1);

I tried the union syntax you mentioned ('.button, .disabled'), but no luck there

@percyhanna
Copy link
Owner

Hmm, it should support chained class names. See test here.

@BlueVajra
Copy link
Author

ok, thanks... must be something weird going on... I will dig around and see what I can figure out.

@percyhanna
Copy link
Owner

Is className being passed to a composite component? If so, that might be the problem.

@percyhanna
Copy link
Owner

For example:

  • DOM component: <div className="my-class" />
  • Composite component: <MyComponent className="my-class" />

It could be that .my-class won't match className on a composite component, I don't think there's a test for that scenario.

@percyhanna
Copy link
Owner

Closing for now until more details are provided.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants