でレンダリングされていないです:小道具は、私は、次のユニットテストを持って浅い酵素小道具クエリ
const wrap = (props = {}) => shallow(<Col {...props} />).dive();
describe('Col',() => {
it('should render a 100% wide div by default',() => {
const wrapper = wrap();
console.log(wrapper.unrendered.props);
expect(wrapper.props().w).toBe(1);
expect(wrapper.type().target).toBe('div');
次のようになります返されwrapper
:
ShallowWrapper {
root: [Circular],
unrendered:
{ '$$typeof': Symbol(react.element),
type:
{ [Function: StyledComponent]
withComponent: [Function: withComponent],
contextTypes: [Object],
displayName: 'styled.div',
styledComponentId: 'sc-ifAKCX',
attrs: undefined,
componentStyle: [Object],
warnTooManyClasses: [Function],
target: 'div' },
key: null,
ref: null,
props: { w: 1, children: undefined },
_owner: null,
_store: {} },
私がテストしたいので、小道具をw
は、のunrendered
という名前のプロパティにありますが、ラッパーにはありません。
この未レンダリングされたオブジェクトが何であるか、なぜそのプロパティがラッパーにないのか混乱します。