-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
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
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,50 @@ | ||
'use strict'; | ||
|
||
import setupDOM from '../util/setup'; | ||
import createParent from '../util/createParent'; | ||
import chai, { expect } from 'chai'; | ||
import sinon from 'sinon'; | ||
import sinonChai from 'sinon-chai'; | ||
|
||
var React; | ||
var LoginLinks; | ||
var TestUtils; | ||
|
||
chai.use(sinonChai); | ||
|
||
describe('LoginLinks Component', () => { | ||
let loginLinks; | ||
|
||
beforeEach(() => { | ||
setupDOM(); | ||
React = require('react/addons'); | ||
LoginLinks = require('../../src/js/components/LoginLinks'); | ||
TestUtils = React.addons.TestUtils; | ||
}); | ||
|
||
afterEach(() => { | ||
// React caches required modules | ||
for (var i in require.cache) { | ||
delete require.cache[i]; | ||
} | ||
}); | ||
|
||
describe('DOM', function() { | ||
beforeEach(() => { | ||
loginLinks = TestUtils.renderIntoDocument(<LoginLinks />); | ||
}); | ||
|
||
it('should render a span with className "login-links"', () => { | ||
expect(loginLinks.getDOMNode().className).to.equal('login-links'); | ||
}); | ||
|
||
it('should render "Sign In" and "Register" links', () => { | ||
let links = TestUtils.scryRenderedDOMComponentsWithTag(loginLinks, 'a'); | ||
let linkText = links.map((link) => link.getDOMNode().textContent); | ||
|
||
expect(links.length).to.equal(2); | ||
expect(linkText[0]).to.equal('Sign In'); | ||
expect(linkText[1]).to.equal('Register'); | ||
}); | ||
}); | ||
}); |