Skip to content

Commit

Permalink
[Chore]: remove shallow wrapper suspense test because shallow rendere…
Browse files Browse the repository at this point in the history
…r has not support it
  • Loading branch information
chenesan committed Jan 21, 2019
1 parent 8a1dde1 commit d051c10
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Expand Up @@ -16,7 +16,6 @@ import {
sym,
} from 'enzyme/build/Utils';
import getAdapter from 'enzyme/build/getAdapter';
import { fakeDynamicImport } from 'enzyme-adapter-utils/src/Utils';
import {
Portal,
} from 'react-is';
Expand All @@ -27,11 +26,9 @@ import {
createContext,
createPortal,
createRef,
lazy,
Fragment,
forwardRef,
PureComponent,
Suspense,
} from './_helpers/react-compat';
import {
describeIf,
Expand Down Expand Up @@ -1276,59 +1273,6 @@ describe('shallow', () => {
expect(wrapper.find(Component.displayName)).to.have.lengthOf(2);
});
});

describeIf(is('>= 16.6'), 'Suspense & lazy', () => {
class DynamicComponent extends React.Component {
render() {
return (
<div>Dynamic Component</div>
);
}
}
class Fallback extends React.Component {
render() {
return (
<div>Fallback</div>
);
}
}
it('finds Suspense and its children when no lazy component', () => {
class Component extends React.Component {
render() {
return (
<div>test</div>
);
}
}
const SuspenseComponent = () => (
<Suspense fallback={<Fallback />}>
<Component />
</Suspense>
);

const wrapper = shallow(<SuspenseComponent />);

expect(wrapper.is(Suspense)).to.equal(true);
expect(wrapper.find(Component)).to.have.lengthOf(1);
expect(wrapper.find(Fallback)).to.have.lengthOf(0)
});

it('finds Lazy when given lazy component', () => {
const LazyComponent = lazy(fakeDynamicImport(DynamicComponent));
const SuspenseComponent = () => (
<Suspense fallback={<Fallback />}>
<LazyComponent />
</Suspense>
);

const wrapper = shallow(<SuspenseComponent />);

expect(wrapper.is(Suspense)).to.equal(true);
expect(wrapper.find(LazyComponent)).to.have.lengthOf(1);
// won't render fallback in shallow renderer
expect(wrapper.find(Fallback)).to.have.lengthOf(0);
});
});
});

describe('.findWhere(predicate)', () => {
Expand Down

0 comments on commit d051c10

Please sign in to comment.