Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(function() {
sinon.stub(console, 'error');
// Don't render any children
sinon.stub(ComponentTree.loadChild, 'loadChild');
params = {
components: {},
router: {
routeLink: sinon.spy()
}
};
});
beforeEach(function() {
// Don't render any children
sinon.stub(ComponentTree.loadChild, 'loadChild');
params = {
components: {
FirstComponent: {
class: 'FirstComponent',
fixtures: {
'default state': {}
}
}
},
router: {
routeLink: sinon.spy()
}
};
});
beforeEach(function() {
// Don't render any children
sinon.stub(ComponentTree.loadChild, 'loadChild');
params = {
components: {
FirstComponent: {
fixtures: {
'blank state': {},
'error state': {},
'simple state': {}
}
},
SecondComponent: {
fixtures: {
'simple state': {}
}
}
},
describe(`ComponentPlayground (${FIXTURE}) Render Children`, function() {
var loadChild = require('react-component-tree').loadChild,
render = require('tests/lib/render-component.js'),
spyLoadChild = require('tests/setup/spy-load-child.js'),
fixture = require(`fixtures/component-playground/${FIXTURE}.js`);
var component,
$component,
container,
fixture;
spyLoadChild();
beforeEach(function() {
({container, component, $component} = render(fixture));
});
it('should not load preview component', function() {
it('should render child with selected fixture', function() {
render({
component: 'FirstComponent',
fixture: 'default state'
});
expect(ComponentTree.loadChild.loadChild).to.have.been.called;
});
afterEach(function() {
console.error.restore();
ComponentTree.loadChild.loadChild.restore();
})
afterEach(function() {
ComponentTree.loadChild.loadChild.restore();
});
};
describe(`ComponentPlayground (${FIXTURE}) Render Children`, function() {
var loadChild = require('react-component-tree').loadChild,
render = require('tests/lib/render-component.js'),
spyLoadChild = require('tests/setup/spy-load-child.js'),
fixture = require(`fixtures/component-playground/${FIXTURE}.js`);
var component,
$component,
container,
fixture,
childParams;
spyLoadChild();
beforeEach(function() {
({container, component, $component} = render(fixture));
childParams = component.children.preview.call(component);
afterEach(function() {
ComponentTree.loadChild.loadChild.restore();
})
beforeEach(function() {
sinon.spy(ComponentTree.loadChild, 'loadChild');
});