vendredi 16 mars 2018

Wrapper reference is lost

After these lines of code, i can access my wrappers and instances successfully:

containerDiv.style.width = '400px';
global.document.body.appendChild(containerDiv);

wrapper2 = mount(
    <DocumentList 
        oid={'docOid251085'}/>,
    {attachTo: containerDiv}
);
instance2 = wrapper2.component.getInstance();

wrapper = mount(
    <DocumentListRow 
        getDocumentListWidth={instance2.getDocumentListWidth}
        oid={'docOid251085'}
        record={record}/>,
    {attachTo: document.getElementById('DocumentGriddocOid251085')}
);
instance = wrapper.component.getInstance();

But inside the next "it" blocks, i cannot access them, what is making me lose the wrappers and instances reference?

it("should render one row", function() {
    expect(wrapper.find('Row_1_' + 'docOid251085')).to.exist;
});

it("should render one row in a card that is normal", function() {
    var width;

    width = instance.props.getDocumentListWidth();

    expect(width).to.equal(400);
});

Aucun commentaire:

Enregistrer un commentaire