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 an .equals() method which accepts JSX #122

Closed
lelandrichardson opened this issue Jan 15, 2016 · 2 comments
Closed

Add an .equals() method which accepts JSX #122

lelandrichardson opened this issue Jan 15, 2016 · 2 comments

Comments

@lelandrichardson
Copy link
Collaborator

based on the conversation in #116 I think adding a .equals(<Foo />); method would be a reasonable addition to the API.

const MyComponent = ({ type }) => (
<Page type={type}>
  <Header>
    My Page Title
  </Header>
  <Body>
    My Page Content
  </Body>
</Page>
);

describe('test JSX output', () => {
  it('should be done', () => {
    const component = shallow(<MyComponent type="custom" />);
    expect(component.equals(
<Page type="custom">
  <Header>
    My Page Title
  </Header>
  <Body>
    My Page Content
  </Body>
</Page>)).to.equal(true);
  });
});

NOTE: looking at .contains() should make this pretty straight-forward to implement...

@ljharb
Copy link
Member

ljharb commented Jan 15, 2016

Should this be called .is to closer match jQuery?

@lelandrichardson
Copy link
Collaborator Author

There already is an .is(selector) method. We could just augment that method though to allow JSX to be passed in as an alternative use.

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

No branches or pull requests

2 participants