Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. import jsdomify from "jsdomify";
  2.  
  3. var React,
  4. TestUtils,
  5. Sanity;
  6.  
  7. describe.only("sanity", () => {
  8. before(() => {
  9. jsdomify.create();
  10. });
  11.  
  12. after(() => {
  13. jsdomify.destroy();
  14. });
  15.  
  16. beforeEach(() => {
  17. jsdomify.clear();
  18. React = require("react");
  19. TestUtils = require("react-addons-test-utils");
  20. });
  21.  
  22. // this test passes.
  23. it("lets me render to the dom", () => {
  24. class Test extends React.Component {
  25. render() {
  26. return <div>test</div>;
  27. }
  28. }
  29.  
  30. /* console.log(instance);
  31. *
  32. { '$$typeof': Symbol(react.element),
  33. type: [Function: Test],
  34. key: null,
  35. ref: null,
  36. props: {},
  37. _owner: null,
  38. _store: {} }
  39. */
  40.  
  41. let instance = <Test />;
  42. TestUtils.renderIntoDocument(instance);
  43. });
  44.  
  45. // this test fails.
  46. it("lets me render required components to the dom", () => {
  47. Sanity = require("./Sanity");
  48.  
  49. let instance = <Sanity />;
  50.  
  51. /* console.log(instance);
  52. *
  53. { '$$typeof': Symbol(react.element),
  54. type: { default: [Function: Sanity] },
  55. key: null,
  56. ref: null,
  57. props: {},
  58. _owner: null,
  59. _store: {} }
  60. */
  61.  
  62. TestUtils.renderIntoDocument(instance);
  63. });
  64. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement