Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
expect(headers.length).toBe(1);
expect(headers[0].props.title).toBe(props.title);
expect(headers[0].props.closeDrawer).toBe(props.closeDrawer);
expect(headers[0].props.closeIconChildren).toBe(props.closeIconChildren);
expect(headers[0].props.closeIconClassName).toBe(props.closeIconClassName);
expect(headers[0].props.persistent).toBe(props.persistent);
expect(headers[0].props.children).toBe(props.children);
// Closed mini drawer
props = Object.assign({}, props, {
drawerType: 'mini',
mini: true,
isOpen: false,
});
drawer = renderIntoDocument();
headers = scryRenderedComponentsWithType(drawer, DrawerHeader);
expect(headers.length).toBe(0);
// Opened mini drawer
props = Object.assign({}, props, {
isOpen: true,
});
drawer = renderIntoDocument();
headers = scryRenderedComponentsWithType(drawer, DrawerHeader);
expect(headers.length).toBe(1);
});
it('has the right number of Modal child components', () => {
expect(TestUtils.scryRenderedComponentsWithType(component, Modal)).toHaveLength(2);
});
it('properly tabs from the query builder to browsing favorites', () => {
const props = _.assign({}, component.props, { persistence: {} });
component = TestHelpers.renderComponent(Explorer, props);
TestUtils.Simulate.click(component.refs['query-pane-tabs'].refs['browse-tab']);
expect(TestUtils.scryRenderedComponentsWithType(component, BrowseQueries)).toHaveLength(1);
expect(TestUtils.scryRenderedComponentsWithType(component, QueryBuilder)).toHaveLength(0);
});
it("should navigate back to the image launch view", function(){
var searchButton = TestUtils.findRenderedDOMComponentWithClass(modalElement, "configure-button");
TestUtils.Simulate.click(searchButton.getDOMNode());
var results = TestUtils.scryRenderedComponentsWithType(modalElement, ImageLaunchView);
expect(results.length).toBe(1);
})
})
it('should render correct with no item', () => {
instance = renderIntoDocument();
scryRenderedComponentsWithType(instance, TransactionItem).length.should.equal(0);
scryRenderedComponentsWithType(instance, TransactionDirection).length.should.equal(1);
scryRenderedComponentsWithType(instance, AddTransactionBtn).length.should.equal(1);
scryRenderedComponentsWithType(instance, TransactBtn).length.should.equal(1);
scryRenderedComponentsWithType(instance, TransactionPopup).length.should.equal(0);
findRenderedComponentWithType(instance, TransactionDetail).should.be.ok();
let addTransactionBtn = findRenderedComponentWithType(instance, AddTransactionBtn);
addTransactionBtn = findRenderedDOMComponentWithClass(addTransactionBtn, 'indicator');
Simulate.click(addTransactionBtn);
props.addTransaction.should.be.calledOnce();
});
it('should render as many FunnelStep child components as there are steps', function () {
this.component = TestHelpers.renderComponent(FunnelBuilder, getProps({
steps: [
TestHelpers.createStep(),
TestHelpers.createStep(),
TestHelpers.createStep()
]
}));
assert.lengthOf(TestUtils.scryRenderedComponentsWithType(this.component, FunnelStep), 3);
});
it('has a Geo component', function(){
assert.lengthOf(TestUtils.scryRenderedComponentsWithType(this.component, Geo), 1);
});
window.setTimeout(() => {
const cells = TestUtils.scryRenderedComponentsWithType(grid, Cell)
c1 = cells[0]
c2 = cells[1]
done()
}, 100, this)
})
export function scryRenderedComponentsWithTypeAndProps(root, type, props) {
if (!root) { throw new Error("Must supply a root to scryRenderedComponentsWithTypeAndProps"); }
return _.compact(_.map(ReactTestUtils.scryRenderedComponentsWithType(root, type), (el) => {
if (_.isEqual(_.pick(el.props, Object.keys(props)), props)) {
return el;
}
return false;
}));
}