Merge pull request #52 from rschamp/feature/selenium-entry

Make app more transparent to Selenium
This commit is contained in:
Ray Schamp 2015-10-13 13:32:14 -06:00
commit 79a8d771d6
21 changed files with 47 additions and 11 deletions

View file

@ -6,6 +6,7 @@ var Format = require('../../lib/format.js');
require('./activity.scss'); require('./activity.scss');
var Activity = React.createClass({ var Activity = React.createClass({
type: 'Activity',
propTypes: { propTypes: {
items: React.PropTypes.array items: React.PropTypes.array
}, },

View file

@ -2,6 +2,7 @@ var React = require('react');
var classNames = require('classnames'); var classNames = require('classnames');
var Avatar = React.createClass({ var Avatar = React.createClass({
type: 'Avatar',
propTypes: { propTypes: {
src: React.PropTypes.string src: React.PropTypes.string
}, },

View file

@ -3,6 +3,7 @@ var React = require('react');
require('./box.scss'); require('./box.scss');
var Box = React.createClass({ var Box = React.createClass({
type: 'Box',
propTypes: { propTypes: {
title: React.PropTypes.string.isRequired, title: React.PropTypes.string.isRequired,
moreTitle: React.PropTypes.string, moreTitle: React.PropTypes.string,

View file

@ -7,6 +7,7 @@ require('slick-carousel/slick/slick-theme.scss');
require('./carousel.scss'); require('./carousel.scss');
var Carousel = React.createClass({ var Carousel = React.createClass({
type: 'Carousel',
propTypes: { propTypes: {
items: React.PropTypes.array items: React.PropTypes.array
}, },

View file

@ -3,6 +3,7 @@ var React = require('react');
require('./footer.scss'); require('./footer.scss');
var Footer = React.createClass({ var Footer = React.createClass({
type: 'Footer',
render: function () { render: function () {
return ( return (
<div className="inner"> <div className="inner">

View file

@ -4,6 +4,7 @@ var classNames = require('classnames');
require('./button.scss'); require('./button.scss');
var Button = React.createClass({ var Button = React.createClass({
type: 'Button',
propTypes: { propTypes: {
}, },

View file

@ -4,6 +4,7 @@ var classNames = require('classnames');
require('./input.scss'); require('./input.scss');
var Input = React.createClass({ var Input = React.createClass({
type: 'Input',
propTypes: { propTypes: {
}, },

View file

@ -6,6 +6,7 @@ require('./intro.scss');
Modal.setAppElement(document.getElementById('view')); Modal.setAppElement(document.getElementById('view'));
var Intro = React.createClass({ var Intro = React.createClass({
type: 'Intro',
propTypes: { propTypes: {
projectCount: React.PropTypes.number projectCount: React.PropTypes.number
}, },

View file

@ -5,6 +5,7 @@ var Button = require('../forms/button.jsx');
require('./login.scss'); require('./login.scss');
var Login = React.createClass({ var Login = React.createClass({
type: 'Login',
propTypes: { propTypes: {
onLogIn: React.PropTypes.func, onLogIn: React.PropTypes.func,
error: React.PropTypes.string error: React.PropTypes.string

View file

@ -5,6 +5,7 @@ require('./modal.scss');
var Modal = React.createClass({ var Modal = React.createClass({
type: 'Modal',
statics: { statics: {
setAppElement: ReactModal.setAppElement setAppElement: ReactModal.setAppElement
}, },

View file

@ -4,6 +4,7 @@ var classNames = require('classnames');
require('./dropdown.scss'); require('./dropdown.scss');
var Dropdown = React.createClass({ var Dropdown = React.createClass({
type: 'Dropdown',
mixins: [ mixins: [
require('react-onclickoutside') require('react-onclickoutside')
], ],

View file

@ -15,6 +15,7 @@ var Login = require('../login/login.jsx');
require('./navigation.scss'); require('./navigation.scss');
var Navigation = React.createClass({ var Navigation = React.createClass({
type: 'Navigation',
mixins: [ mixins: [
Api, Api,
Session Session

View file

@ -5,6 +5,7 @@ var Box = require('../box/box.jsx');
require('./news.scss'); require('./news.scss');
var News = React.createClass({ var News = React.createClass({
type: 'News',
propTypes: { propTypes: {
items: React.PropTypes.array items: React.PropTypes.array
}, },

View file

@ -4,6 +4,7 @@ var classNames = require('classnames');
require('./thumbnail.scss'); require('./thumbnail.scss');
var Thumbnail = React.createClass({ var Thumbnail = React.createClass({
type: 'Thumbnail',
propTypes: { propTypes: {
src: React.PropTypes.string src: React.PropTypes.string
}, },

View file

@ -1,4 +1,5 @@
var Environment = { var Environment = {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
API_HOST: JSON.stringify(process.env.API_HOST || 'https://api-staging.scratch.mit.edu') API_HOST: JSON.stringify(process.env.API_HOST || 'https://api-staging.scratch.mit.edu')
}; };

13
src/lib/renderer.jsx Normal file
View file

@ -0,0 +1,13 @@
var React = require('react');
var Renderer = {
render: function (jsx, toElement) {
var rendered = React.render(jsx, toElement);
if (process.env.NODE_ENV != 'production') {
window.renderedComponents = window.renderedComponents || [];
window.renderedComponents.push(rendered);
}
}
};
module.exports = Renderer;

View file

@ -1,9 +1,9 @@
var React = require('react'); var Renderer = require('./lib/renderer.jsx');
require('./main.scss'); require('./main.scss');
var Navigation = require('./components/navigation/navigation.jsx'); var Navigation = require('./components/navigation/navigation.jsx');
var Footer = require('./components/footer/footer.jsx'); var Footer = require('./components/footer/footer.jsx');
React.render(<Navigation />, document.getElementById('navigation')); Renderer.render(<Navigation />, document.getElementById('navigation'));
React.render(<Footer />, document.getElementById('footer')); Renderer.render(<Footer />, document.getElementById('footer'));

View file

@ -1,8 +1,10 @@
var React = require('react'); var React = require('react');
var Renderer = require('../../lib/renderer.jsx');
require('./about.scss'); require('./about.scss');
var View = React.createClass({ var About = React.createClass({
type: 'About',
render: function () { render: function () {
return ( return (
<div> <div>
@ -12,4 +14,4 @@ var View = React.createClass({
} }
}); });
React.render(<View />, document.getElementById('view')); Renderer.render(<About />, document.getElementById('view'));

View file

@ -1,4 +1,5 @@
var React = require('react'); var React = require('react');
var Renderer = require('../../lib/renderer.jsx');
var Box = require('../../components/box/box.jsx'); var Box = require('../../components/box/box.jsx');
var Button = require('../../components/forms/button.jsx'); var Button = require('../../components/forms/button.jsx');
@ -8,7 +9,8 @@ var Input = require('../../components/forms/input.jsx');
require('./components.scss'); require('./components.scss');
var View = React.createClass({ var Components = React.createClass({
type: 'Components',
render: function () { render: function () {
return ( return (
<div className="inner"> <div className="inner">
@ -35,4 +37,4 @@ var View = React.createClass({
} }
}); });
React.render(<View />, document.getElementById('view')); Renderer.render(<Components />, document.getElementById('view'));

View file

@ -1,11 +1,13 @@
var React = require('react'); var React = require('react');
var Renderer = require('../../lib/renderer.jsx');
require('./hoc.scss'); require('./hoc.scss');
var Button = require('../../components/forms/button.jsx'); var Button = require('../../components/forms/button.jsx');
var Box = require('../../components/box/box.jsx'); var Box = require('../../components/box/box.jsx');
var View = React.createClass({ var Hoc = React.createClass({
type: 'Hoc',
render: function () { render: function () {
return ( return (
<div> <div>
@ -103,4 +105,4 @@ var View = React.createClass({
} }
}); });
React.render(<View />, document.getElementById('view')); Renderer.render(<Hoc />, document.getElementById('view'));

View file

@ -1,4 +1,5 @@
var React = require('react'); var React = require('react');
var Renderer = require('../../lib/renderer.jsx');
var Api = require('../../mixins/api.jsx'); var Api = require('../../mixins/api.jsx');
var Session = require('../../mixins/session.jsx'); var Session = require('../../mixins/session.jsx');
@ -11,7 +12,8 @@ var News = require('../../components/news/news.jsx');
require('./splash.scss'); require('./splash.scss');
var View = React.createClass({ var Splash = React.createClass({
type: 'Splash',
mixins: [ mixins: [
Api, Api,
Session Session
@ -71,4 +73,4 @@ var View = React.createClass({
} }
}); });
React.render(<View />, document.getElementById('view')); Renderer.render(<Splash />, document.getElementById('view'));