Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add plugin mount point component test
- Loading branch information
Orlando Hohmeier
committed
Feb 12, 2016
1 parent
71bb91a
commit 27d074e
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
|
||
}); |