Skip to content

Commit

Permalink
Add plugin mount point component test
Browse files Browse the repository at this point in the history
  • Loading branch information
Orlando Hohmeier committed Feb 12, 2016
1 parent 71bb91a commit 27d074e
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/test/units/PluginMountPointComponent.test.js
@@ -0,0 +1,52 @@
import {expect} from "chai";
import {mount} from "enzyme";
import React from "react/addons";

import PluginComponentStore from "../../js/stores/PluginComponentStore";
import PluginComponentEvents from "../../js/events/PluginComponentEvents";
import PluginDispatcher from "../../js/plugin/shared/PluginDispatcher";
import PluginEvents from "../../js/plugin/shared/PluginEvents";
import PluginMoundPointComponent
from "../../js/components/PluginMountPointComponent";

describe("PluginMountPointComponent", function () {

before(function (done) {
this.pluginMountPointComponentA =
mount(<PluginMoundPointComponent placeId="testMountPointPlaceId" />);

this.pluginMountPointComponentB =
mount(<PluginMoundPointComponent placeId="testMountPointPlaceId" />);

this.pluginMountPointComponentC =
mount(<PluginMoundPointComponent placeId="differentPlaceId" />);

var component = React.createClass({
render: function () {
return (<span>Test Mount Point Component</span>);
}
});

PluginComponentStore.once(PluginComponentEvents.CHANGE, () => done());

PluginDispatcher.dispatch({
eventType: PluginEvents.INJECT_COMPONENT,
placeId: "testMountPointPlaceId",
component: component
});
});

it("renders component with given place id", function () {
expect(this.pluginMountPointComponentA.find("span").text())
.to.equal("Test Mount Point Component");

expect(this.pluginMountPointComponentB.find("span").text())
.to.equal("Test Mount Point Component");
});

it("does not render at non-matching place id", function () {
expect(this.pluginMountPointComponentC.find("span").length)
.to.equal(0);
});

});

0 comments on commit 27d074e

Please sign in to comment.