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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not test Dialog component. #18226

Closed
1 task done
OlegRyzhkov opened this issue Nov 6, 2019 · 1 comment
Closed
1 task done

can not test Dialog component. #18226

OlegRyzhkov opened this issue Nov 6, 2019 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@OlegRyzhkov
Copy link

I was trying to test my wrapper for Dialog component and I got a big stacktrace

  • [?] The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 馃槸

test failed and shows irrelevant stacktrace (for me)

Expected Behavior 馃

test is passed correctly and creates snapshot file.

Steps to Reproduce 馃暪

  1. create react app.
  2. install material ui.
  3. replace file App.test.js with this:
import React from 'react';
import renderer from 'react-test-renderer';
import { Dialog, DialogActions, DialogContent, DialogTitle } from '@material-ui/core'

test('Sidebar', () => {
  const component = renderer.create(
    <Dialog
      open
      onClose={() => {}}
    >
      <DialogTitle>qweqw</DialogTitle>
      <DialogContent>qweqweqwe</DialogContent>
      <DialogActions>
      </DialogActions>
    </Dialog>
  );
  let tree = component.toJSON();
  expect(tree).toMatchSnapshot();
});
  1. run npm test
    https://codesandbox.io/s/kind-hugle-r14zn

I see a different stacktrace in codesandbox fr some reason. am I doing something wrong?

Your Environment 馃寧

Tech Version
Material-UI v4.6.0
React any (16.11.0)
Browser any (chrome)
TypeScript -
@oliviertassinari oliviertassinari added the duplicate This issue or pull request already exists label Nov 6, 2019
@oliviertassinari
Copy link
Member

I'm closing as a duplicate of #17992.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants