├── .npmrc ├── .babelrc ├── .eslintrc ├── test ├── .eslintrc ├── components │ ├── withHOC.jsx │ └── AphroditeComponent.jsx ├── enhance-test.js ├── index-test.js └── index.browser-test.js ├── src ├── enhance.js ├── index.browser.js └── index.js ├── .travis.yml ├── .gitignore ├── LICENSE ├── README.md └── package.json /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["airbnb"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": "airbnb" 4 | } 5 | -------------------------------------------------------------------------------- /test/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/components/withHOC.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default function withHOC(Component) { 4 | return props => ( 5 |
6 | 7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /src/enhance.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | enhancers: [], // HOCs applied to the component before render: e0(e1(e2(...en(component)))) 3 | }; 4 | 5 | export const setRenderEnhancers = (...enhancers) => { 6 | // Check that all enhancers are functions 7 | enhancers.forEach((enhancer, index) => { 8 | if (typeof enhancer !== 'function') { 9 | throw new TypeError(`enhancers passed to setRenderEnhancer should be functions: ${index}`); 10 | } 11 | }); 12 | 13 | config.enhancers = enhancers; // clear & set 14 | }; 15 | 16 | export const enhance = component => config.enhancers.reduceRight((x, f) => f(x), component); 17 | -------------------------------------------------------------------------------- /test/components/AphroditeComponent.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { css, StyleSheet } from 'aphrodite'; 4 | 5 | const styles = StyleSheet.create({ 6 | button: { 7 | backgroundColor: 'blue', 8 | }, 9 | 10 | text: { 11 | color: 'red', 12 | }, 13 | }); 14 | 15 | export default function Button(props) { 16 | const { children, onPress } = props; 17 | 18 | return ( 19 | 28 | ); 29 | } 30 | 31 | Button.propTypes = { 32 | onPress: PropTypes.func, 33 | children: PropTypes.node, 34 | }; 35 | Button.defaultProps = { 36 | onPress() {}, 37 | children: null, 38 | }; 39 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | os: 3 | - linux 4 | node_js: 5 | - "11" 6 | - "10" 7 | - "8" 8 | - "6" 9 | - "4" 10 | before_install: 11 | - 'nvm install-latest-npm' 12 | install: 13 | - 'npm install' 14 | - 'if [ -n "${APHRODITE-}" ]; then npm install "aphrodite@${APHRODITE}" ; fi' 15 | - 'npm ls >/dev/null' 16 | script: 17 | - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' 18 | - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' 19 | - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' 20 | - 'if [ -n "${APHRODITE-}" ]; then npm run tests-only ; fi' 21 | sudo: false 22 | env: 23 | - APHRODITE=2 24 | - APHRODITE=1 25 | - APHRODITE=0.4 26 | matrix: 27 | fast_finish: true 28 | include: 29 | - node_js: "lts/*" 30 | env: PRETEST=true 31 | - node_js: "4" 32 | env: COVERAGE=true 33 | allow_failures: 34 | - os: osx 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | TODO 40 | coverage 41 | lib 42 | 43 | # Only apps should have lockfiles 44 | npm-shrinkwrap.json 45 | yarn.lock 46 | package-lock.json 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Airbnb 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | | :exclamation: Deprecation Notice | 2 | |:-| 3 | |We want to express our sincere gratitude for your support and contributions to the Hypernova open source project. As we are no longer using this technology internally, we have come to the decision to archive the Hypernova repositories. While we won't be providing further updates or support, the existing code and resources will remain accessible for your reference. We encourage anyone interested to fork the repository and continue the project's legacy independently. Thank you for being a part of this journey and for your patience and understanding.| 4 | --- 5 | 6 | # hypernova-aphrodite 7 | 8 | [Aphrodite](https://github.com/Khan/aphrodite) bindings for [Hypernova](https://github.com/airbnb/hypernova). 9 | 10 | ## Install 11 | 12 | ```sh 13 | npm install hypernova-aphrodite 14 | ``` 15 | 16 | ## Usage 17 | 18 | Here's how use use it in your module: 19 | 20 | ```js 21 | import { renderReactWithAphrodite } from 'hypernova-aphrodite'; 22 | import MyComponent from './src/MyComponent.jsx'; 23 | 24 | export default renderReactWithAphrodite( 25 | 'MyComponent.hypernova.js', // this file's name (or really any unique name) 26 | MyComponent, 27 | ); 28 | ``` 29 | -------------------------------------------------------------------------------- /src/index.browser.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import hypernova, { 4 | load, 5 | fromScript, 6 | } from 'hypernova'; 7 | import { StyleSheet } from 'aphrodite'; 8 | 9 | import { setRenderEnhancers, enhance } from './enhance'; 10 | 11 | export { setRenderEnhancers }; 12 | 13 | const returnThrower = () => () => { 14 | throw new Error('server functionality does not work in browser'); 15 | }; 16 | 17 | export const renderReactWithAphrodite = (name, component) => { 18 | const enhancedComponent = enhance(component); 19 | 20 | return hypernova({ 21 | server: returnThrower, 22 | 23 | client() { 24 | const classNames = fromScript({ 'aphrodite-css': name }); 25 | if (classNames) StyleSheet.rehydrate(classNames); 26 | 27 | const payloads = load(name); 28 | if (payloads) { 29 | payloads.forEach((payload) => { 30 | const { node, data } = payload; 31 | if (node) { 32 | const element = React.createElement(enhancedComponent, data); 33 | if (ReactDOM.hydrate) { 34 | ReactDOM.hydrate(element, node); 35 | } else { 36 | ReactDOM.render(element, node); 37 | } 38 | } 39 | }); 40 | } 41 | 42 | return component; 43 | }, 44 | }); 45 | }; 46 | 47 | export const renderReactWithAphroditeStatic = () => hypernova({ 48 | server: returnThrower, 49 | client() {}, 50 | }); 51 | -------------------------------------------------------------------------------- /test/enhance-test.js: -------------------------------------------------------------------------------- 1 | import { assert } from 'chai'; 2 | 3 | import withHOC from './components/withHOC'; 4 | import AphroditeComponent from './components/AphroditeComponent'; 5 | import { setRenderEnhancers } from '../lib/enhance'; 6 | import { renderReactWithAphrodite } from '..'; 7 | 8 | describe('setRenderEnhancers', () => { 9 | afterEach(() => { 10 | setRenderEnhancers(); // reset 11 | }); 12 | 13 | it('works with no enhancers', () => { 14 | setRenderEnhancers(); 15 | 16 | const result = renderReactWithAphrodite('AC', AphroditeComponent)({}); 17 | 18 | assert.isString(result); 19 | }); 20 | 21 | it('works with one enhancer', () => { 22 | const enhancers = [withHOC]; 23 | setRenderEnhancers(...enhancers); 24 | 25 | const result = renderReactWithAphrodite('AC', AphroditeComponent)({}); 26 | 27 | assert.isString(result); 28 | assert.lengthOf(result.match(/class="hoc"/g), enhancers.length); 29 | }); 30 | 31 | it('works with multiple enhancers', () => { 32 | const enhancers = [withHOC, withHOC, withHOC, withHOC]; 33 | setRenderEnhancers(...enhancers); 34 | 35 | const result = renderReactWithAphrodite('AC', AphroditeComponent)({}); 36 | 37 | assert.isString(result); 38 | assert.lengthOf(result.match(/class="hoc"/g), enhancers.length); 39 | }); 40 | 41 | it('throws when passed enhancers that are not functions', () => { 42 | const goodEnhancers = [withHOC]; 43 | assert.doesNotThrow(setRenderEnhancers.bind(this, ...goodEnhancers), TypeError); 44 | 45 | const badEnhancers = ['not a function']; 46 | assert.throws(setRenderEnhancers.bind(this, ...badEnhancers), TypeError); 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOMServer from 'react-dom/server'; 3 | import hypernova, { 4 | serialize, 5 | toScript, 6 | } from 'hypernova'; 7 | import { StyleSheetServer } from 'aphrodite'; 8 | 9 | import { setRenderEnhancers, enhance } from './enhance'; 10 | 11 | export { setRenderEnhancers }; 12 | 13 | const thrower = () => { 14 | throw new Error('client functionality does not work on server'); 15 | }; 16 | 17 | export const renderReactWithAphrodite = (name, component) => { 18 | const enhancedComponent = enhance(component); 19 | return hypernova({ 20 | server() { 21 | return (props) => { 22 | const { html, css } = StyleSheetServer.renderStatic(() => { 23 | const element = React.createElement(enhancedComponent, props); 24 | return ReactDOMServer.renderToString(element); 25 | }); 26 | 27 | const style = ``; 28 | const markup = serialize(name, html, props); 29 | const classNames = toScript({ 'aphrodite-css': name }, css.renderedClassNames); 30 | 31 | return `${style}\n${markup}\n${classNames}`; 32 | }; 33 | }, 34 | 35 | client: thrower, 36 | }); 37 | }; 38 | 39 | export const renderReactWithAphroditeStatic = (name, component) => { 40 | const enhancedComponent = enhance(component); 41 | return hypernova({ 42 | server() { 43 | return (props) => { 44 | const { html, css } = StyleSheetServer.renderStatic(() => { 45 | const element = React.createElement(enhancedComponent, props); 46 | return ReactDOMServer.renderToStaticMarkup(element); 47 | }); 48 | 49 | const style = ``; 50 | 51 | return `${style}\n${html}`; 52 | }; 53 | }, 54 | 55 | client: thrower, 56 | }); 57 | }; 58 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hypernova-aphrodite", 3 | "version": "3.0.0", 4 | "description": "Aphrodite bindings for Hypernova", 5 | "main": "lib/index.js", 6 | "browser": "lib/index.browser.js", 7 | "scripts": { 8 | "prepublish": "npm run build", 9 | "clean": "rimraf lib coverage", 10 | "prebuild": "npm run clean", 11 | "build": "babel src -d lib", 12 | "lint": "eslint --ext=js,jsx src test", 13 | "pretest": "npm run lint", 14 | "test": "npm run coverage", 15 | "tests-only": "npm run test:quick", 16 | "precoverage": "npm run build", 17 | "coverage": "babel-node \"$(which istanbul)\" cover \"$(which _mocha)\" -- -R tap test/*-test.js", 18 | "pretest:quick": "npm run build", 19 | "test:quick": "babel-node \"$(which _mocha)\" -R tap test/*-test.js" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/airbnb/hypernova-aphrodite.git" 24 | }, 25 | "keywords": [ 26 | "aphrodite", 27 | "css", 28 | "styles", 29 | "react", 30 | "hypernova", 31 | "server", 32 | "render", 33 | "isomorphic", 34 | "universal" 35 | ], 36 | "files": [ 37 | "README.md", 38 | "lib", 39 | "src", 40 | "test", 41 | ".eslintrc", 42 | ".babelrc" 43 | ], 44 | "author": "Josh Perez ", 45 | "license": "MIT", 46 | "bugs": { 47 | "url": "https://github.com/airbnb/hypernova-aphrodite/issues" 48 | }, 49 | "homepage": "https://github.com/airbnb/hypernova-aphrodite", 50 | "peerDependencies": { 51 | "hypernova": "^2.0.0", 52 | "react": "0.14.x || >= 15.x", 53 | "react-dom": "0.14.x || >= 15.x", 54 | "aphrodite": "^0.4.0 || ^1.1.0 || ^2" 55 | }, 56 | "devDependencies": { 57 | "aphrodite": "^0.4.0 || ^1.1.0 || ^2", 58 | "babel-cli": "^6.26.0", 59 | "babel-preset-airbnb": "^2.6.0", 60 | "chai": "^4.2.0", 61 | "enzyme": "^3.8.0", 62 | "enzyme-adapter-react-helper": "^1.3.1", 63 | "eslint": "^5.10.0", 64 | "eslint-config-airbnb": "^17.1.0", 65 | "eslint-plugin-import": "^2.14.0", 66 | "eslint-plugin-jsx-a11y": "^6.1.2", 67 | "eslint-plugin-react": "^7.11.1", 68 | "hypernova": "^2.4.0", 69 | "istanbul": "^0.4.5", 70 | "jsdom": "^9.12.0", 71 | "mocha": "^4.1.0", 72 | "prop-types": "^15.6.2", 73 | "react": "^15 || ^16", 74 | "react-dom": "^15 || ^16", 75 | "rimraf": "^2.6.2", 76 | "sinon": "^5.1.1" 77 | }, 78 | "greenkeeper": { 79 | "ignore": [ 80 | "jsdom" 81 | ] 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /test/index-test.js: -------------------------------------------------------------------------------- 1 | import jsdom from 'jsdom'; 2 | import { assert } from 'chai'; 3 | import sinon from 'sinon'; 4 | import ReactDOM from 'react-dom'; 5 | import ifReact from 'enzyme-adapter-react-helper/build/ifReact'; 6 | 7 | import AphroditeComponent from './components/AphroditeComponent'; 8 | import { 9 | renderReactWithAphrodite, 10 | renderReactWithAphroditeStatic, 11 | } from '..'; 12 | 13 | describe('renderReactWithAphrodite aphrodite css rendering', () => { 14 | let originalWindow; 15 | let originalDocument; 16 | let result; 17 | 18 | beforeEach(() => { 19 | originalWindow = global.window; 20 | originalDocument = global.document; 21 | result = renderReactWithAphrodite('AC', AphroditeComponent)({ 22 | children: ['Zack'], 23 | onPress() { console.log('Clicked'); }, 24 | }); 25 | }); 26 | 27 | afterEach(() => { 28 | global.window = originalWindow; 29 | global.document = originalDocument; 30 | }); 31 | 32 | it('the markup looks good', () => { 33 | assert.isString(result); 34 | 35 | assert.ok(/style data-aphrodite/.test(result)); 36 | assert.ok(/Zack/.test(result)); 37 | assert.ok(/data-aphrodite-css/.test(result)); 38 | }); 39 | 40 | ifReact('>= 16', it, it.skip)('blows up when calling renderReactWithAphrodite on the client', (done) => { 41 | jsdom.env(result, (err, window) => { 42 | if (err) { 43 | done(err); 44 | return; 45 | } 46 | 47 | global.window = window; 48 | global.document = window.document; 49 | 50 | 51 | assert.throws(() => renderReactWithAphrodite('AC', AphroditeComponent)); 52 | 53 | delete global.window; 54 | delete global.document; 55 | 56 | done(); 57 | }); 58 | }); 59 | 60 | it('blows up when calling renderReactWithAphrodite on the client (render method)', (done) => { 61 | jsdom.env(result, (err, window) => { 62 | if (err) { 63 | done(err); 64 | return; 65 | } 66 | 67 | global.window = window; 68 | global.document = window.document; 69 | 70 | const sandbox = sinon.createSandbox(); 71 | if (ReactDOM.hydrate) { 72 | sandbox.stub(ReactDOM, 'hydrate').value(undefined); 73 | } 74 | 75 | assert.throws(() => renderReactWithAphrodite('AC', AphroditeComponent)); 76 | 77 | sandbox.restore(); 78 | 79 | delete global.window; 80 | delete global.document; 81 | 82 | done(); 83 | }); 84 | }); 85 | }); 86 | 87 | describe('renderReactWithAphroditeStatic static aphrodite css rendering', () => { 88 | let originalWindow; 89 | let originalDocument; 90 | let result; 91 | 92 | beforeEach(() => { 93 | originalWindow = global.window; 94 | originalDocument = global.document; 95 | result = renderReactWithAphroditeStatic('AC', AphroditeComponent)({ 96 | children: ['Steven'], 97 | onPress() {}, 98 | }); 99 | }); 100 | 101 | afterEach(() => { 102 | global.window = originalWindow; 103 | global.document = originalDocument; 104 | }); 105 | 106 | describe('on the server', () => { 107 | it('the output contains styles and component content', () => { 108 | assert.isString(result); 109 | 110 | assert.ok(/style data-aphrodite/.test(result)); 111 | assert.ok(/Steven/.test(result)); 112 | }); 113 | 114 | it('the markup does not contain aphrodite-css info for the client', () => { 115 | assert.isFalse(/data-aphrodite-css/.test(result)); 116 | }); 117 | }); 118 | 119 | describe('on the client', () => { 120 | it('throws', (done) => { 121 | jsdom.env(result, (err, window) => { 122 | if (err) { 123 | done(err); 124 | return; 125 | } 126 | 127 | global.window = window; 128 | global.document = window.document; 129 | 130 | assert.throws(() => renderReactWithAphroditeStatic('AC', AphroditeComponent), 'functionality does not work'); 131 | 132 | done(); 133 | }); 134 | }); 135 | }); 136 | }); 137 | -------------------------------------------------------------------------------- /test/index.browser-test.js: -------------------------------------------------------------------------------- 1 | import jsdom from 'jsdom'; 2 | import { assert } from 'chai'; 3 | import sinon from 'sinon'; 4 | import ReactDOM from 'react-dom'; 5 | import ifReact from 'enzyme-adapter-react-helper/build/ifReact'; 6 | 7 | import AphroditeComponent from './components/AphroditeComponent'; 8 | import { 9 | renderReactWithAphrodite as serverRenderReactWithAphrodite, 10 | renderReactWithAphroditeStatic as serverRenderReactWithAphroditeStatic, 11 | } from '..'; 12 | import { 13 | renderReactWithAphrodite, 14 | renderReactWithAphroditeStatic, 15 | } from '../lib/index.browser'; 16 | 17 | describe('renderReactWithAphrodite aphrodite css rendering', () => { 18 | let originalWindow; 19 | let originalDocument; 20 | let result; 21 | 22 | beforeEach(() => { 23 | originalWindow = global.window; 24 | originalDocument = global.document; 25 | result = serverRenderReactWithAphrodite('AC', AphroditeComponent)({ 26 | children: ['Zack'], 27 | onPress() { console.log('Clicked'); }, 28 | }); 29 | }); 30 | 31 | afterEach(() => { 32 | global.window = originalWindow; 33 | global.document = originalDocument; 34 | }); 35 | 36 | it('the markup looks good', () => { 37 | assert.isString(result); 38 | 39 | assert.ok(/style data-aphrodite/.test(result)); 40 | assert.ok(/Zack/.test(result)); 41 | assert.ok(/data-aphrodite-css/.test(result)); 42 | }); 43 | 44 | it('throws when calling renderReactWithAphrodite on the server', () => { 45 | assert.throws(() => renderReactWithAphrodite('AC', AphroditeComponent)(), 'functionality does not work'); 46 | }); 47 | 48 | ifReact('>= 16', it, it.skip)('does not blow up when calling renderReactWithAphrodite on the client', (done) => { 49 | jsdom.env(result, (err, window) => { 50 | if (err) { 51 | done(err); 52 | return; 53 | } 54 | 55 | global.window = window; 56 | global.document = window.document; 57 | 58 | const hydrateMethod = sinon.spy(ReactDOM, 'hydrate'); 59 | 60 | renderReactWithAphrodite('AC', AphroditeComponent); 61 | 62 | assert(hydrateMethod.calledOnce); 63 | 64 | delete global.window; 65 | delete global.document; 66 | 67 | hydrateMethod.restore(); 68 | 69 | done(); 70 | }); 71 | }); 72 | 73 | it('does not blow up when calling renderReactWithAphrodite on the client (render method)', (done) => { 74 | jsdom.env(result, (err, window) => { 75 | if (err) { 76 | done(err); 77 | return; 78 | } 79 | 80 | global.window = window; 81 | global.document = window.document; 82 | 83 | const sandbox = sinon.createSandbox(); 84 | if (ReactDOM.hydrate) { 85 | sandbox.stub(ReactDOM, 'hydrate').value(undefined); 86 | } 87 | 88 | const renderMethod = sinon.spy(ReactDOM, 'render'); 89 | 90 | renderReactWithAphrodite('AC', AphroditeComponent); 91 | 92 | assert(renderMethod.calledOnce); 93 | 94 | sandbox.restore(); 95 | 96 | delete global.window; 97 | delete global.document; 98 | 99 | done(); 100 | }); 101 | }); 102 | }); 103 | 104 | describe('renderReactWithAphroditeStatic static aphrodite css rendering', () => { 105 | let originalWindow; 106 | let originalDocument; 107 | let result; 108 | 109 | beforeEach(() => { 110 | originalWindow = global.window; 111 | originalDocument = global.document; 112 | result = serverRenderReactWithAphroditeStatic('AC', AphroditeComponent)({ 113 | children: ['Steven'], 114 | onPress() {}, 115 | }); 116 | }); 117 | 118 | afterEach(() => { 119 | global.window = originalWindow; 120 | global.document = originalDocument; 121 | }); 122 | 123 | it('returns nothing', (done) => { 124 | jsdom.env(result, (err, window) => { 125 | if (err) { 126 | done(err); 127 | return; 128 | } 129 | 130 | global.window = window; 131 | global.document = window.document; 132 | 133 | assert.isUndefined(renderReactWithAphroditeStatic('AC', AphroditeComponent)); 134 | 135 | done(); 136 | }); 137 | }); 138 | }); 139 | --------------------------------------------------------------------------------