Created
August 15, 2014 17:45
-
-
Save mhuggins/d33bf7042d4b447bc22b to your computer and use it in GitHub Desktop.
How can I do this in Mocha?
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
/** @jsx React.DOM */ | |
var React = require('react'); | |
var Loader = require('../../lib/react-loader'); | |
var expect = require('chai').expect; | |
var loader, loaded; | |
describe('Loader', function () { | |
beforeEach(function () { | |
loader = <Loader loaded={loaded}>Welcome</Loader>; | |
React.renderComponent(loader, document.body); | |
}); | |
describe('before loaded', function () { | |
beforeEach(function () { | |
loaded = false; | |
}); | |
it('renders the loader', function () { | |
expect(document.body.innerHTML).to.match(/<div class="loader"/); | |
}); | |
it('does not render the content', function () { | |
expect(document.body.innerHTML).to.not.match(/Welcome/); | |
}); | |
}); | |
describe('after loaded', function () { | |
beforeEach(function () { | |
loaded = true; | |
}); | |
it('does not render the loader', function () { | |
expect(document.body.innerHTML).to.not.match(/<div class="loader"/); | |
}); | |
it('renders the content', function () { | |
expect(document.body.innerHTML).to.match(/Welcome/); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Long live rspec :)