Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

setupTests.js 903 B

3 anni fa
1234567891011121314151617181920212223242526272829303132333435363738
  1. /* global jest */
  2. /* eslint-disable import/no-extraneous-dependencies */
  3. import Enzyme, { ReactWrapper } from 'enzyme';
  4. import Adapter from 'enzyme-adapter-react-16';
  5. Enzyme.configure({
  6. adapter: new Adapter()
  7. }); // TODO remove when enzyme releases https://github.com/airbnb/enzyme/pull/1179
  8. ReactWrapper.prototype.hostNodes = function () {
  9. return this.filterWhere(function (n) {
  10. return typeof n.type() === 'string';
  11. });
  12. };
  13. global.requestAnimationFrame = function (cb) {
  14. cb(0);
  15. };
  16. global.window.cancelAnimationFrame = function () {};
  17. global.createSpyObj = function (baseName, methodNames) {
  18. var obj = {};
  19. for (var i = 0; i < methodNames.length; i += 1) {
  20. obj[methodNames[i]] = jest.fn();
  21. }
  22. return obj;
  23. };
  24. global.document.createRange = function () {
  25. return {
  26. setStart: function setStart() {},
  27. setEnd: function setEnd() {},
  28. commonAncestorContainer: {}
  29. };
  30. };