diff --git a/src/components/component-playground.jsx b/src/components/component-playground.jsx
index d757cff..a5d358b 100644
--- a/src/components/component-playground.jsx
+++ b/src/components/component-playground.jsx
@@ -108,9 +108,10 @@ module.exports = React.createClass({
{this._renderButtons()}
-
+ onClick={this.props.router.routeLink}>
{fixtureName}
;
@@ -235,7 +237,7 @@ module.exports = React.createClass({
return
Editor
+ onClick={this.props.router.routeLink}>Editor
;
},
@@ -249,7 +251,7 @@ module.exports = React.createClass({
return
Fullscreen
+ onClick={this.props.router.routeLink}>Fullscreen
;
},
diff --git a/tests/components/component-playground/children.js b/tests/components/component-playground/children.js
index a4bfe45..3cdfca4 100644
--- a/tests/components/component-playground/children.js
+++ b/tests/components/component-playground/children.js
@@ -25,7 +25,10 @@ describe('ComponentPlayground component', function() {
sinon.stub(ComponentTree.loadChild, 'loadChild');
props = {
- fixtures: {}
+ fixtures: {},
+ router: {
+ routeLink: sinon.spy()
+ }
};
});
diff --git a/tests/components/component-playground/events.js b/tests/components/component-playground/events.js
index 49703e0..7e74bd2 100644
--- a/tests/components/component-playground/events.js
+++ b/tests/components/component-playground/events.js
@@ -31,7 +31,10 @@ describe('ComponentPlayground component', function() {
sinon.stub(ComponentTree.loadChild, 'loadChild');
props = {
- fixtures: {}
+ fixtures: {},
+ router: {
+ routeLink: sinon.spy()
+ }
};
});
@@ -90,6 +93,36 @@ describe('ComponentPlayground component', function() {
expect(expandedComponents.length).to.equal(1);
expect(expandedComponents[0]).to.equal('FirstComponent');
});
+
+ describe('router links', function() {
+ beforeEach(function() {
+ render({
+ selectedComponent: 'SecondComponent',
+ selectedFixture: 'simple state'
+ });
+ });
+
+ afterEach(function() {
+ expect(props.router.routeLink).to.have.been.called;
+ });
+
+ it('should route link on home button', function() {
+ utils.Simulate.click(component.refs.homeLink.getDOMNode());
+ });
+
+ it('should route link on component fixture button', function() {
+ utils.Simulate.click(
+ component.refs['SecondComponentsimple stateButton'].getDOMNode());
+ });
+
+ it('should route link on fixture editor button', function() {
+ utils.Simulate.click(component.refs.fixtureEditorButton.getDOMNode());
+ });
+
+ it('should route link on full screen button', function() {
+ utils.Simulate.click(component.refs.fullScreenButton.getDOMNode());
+ });
+ });
});
describe('editing fixture', function() {
diff --git a/tests/components/component-playground/render.js b/tests/components/component-playground/render.js
index 88668c4..af49f98 100644
--- a/tests/components/component-playground/render.js
+++ b/tests/components/component-playground/render.js
@@ -41,6 +41,9 @@ describe('ComponentPlayground component', function() {
SecondComponent: {
'simple state': {}
}
+ },
+ router: {
+ routeLink: sinon.spy()
}
};
});
diff --git a/tests/components/component-playground/state.js b/tests/components/component-playground/state.js
index df0e42d..ac2ebb0 100644
--- a/tests/components/component-playground/state.js
+++ b/tests/components/component-playground/state.js
@@ -33,6 +33,9 @@ describe('ComponentPlayground component', function() {
myProp: true
}
}
+ },
+ router: {
+ routeLink: sinon.spy()
}
};
});