Created
June 12, 2015 17:46
-
-
Save alexmcpherson/f66198609278cb99cdf2 to your computer and use it in GitHub Desktop.
Testing examples
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
import React from "react/addons"; | |
import jsdom from "mocha-jsdom"; | |
import {expect} from "chai"; | |
//See https://facebook.github.io/react/docs/test-utils.html for available methods | |
let {TestUtils} = React.addons; | |
import TitleBar from "js-app/components/titleBar"; | |
describe("TitleBar", function() { | |
jsdom(); | |
it("should have the title in its DOM", () => { | |
var titleBar = TestUtils.renderIntoDocument( | |
<TitleBar title="My Gallery" /> | |
); | |
var titleTag = TestUtils.findRenderedDOMComponentWithClass(titleBar, "gallery-title"); | |
expect(titleTag.getDOMNode().textContent).to.equal("My Gallery"); | |
}); | |
}); |
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
describe("#setFavorite", function() { | |
it("should set favorite status for content", function() { | |
var content = contentMock[2]; | |
contentStore.setFavorite(content.id, true); | |
content.favorite.should.equal(true); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment