Skip to content

Switch out contextify for vm #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/todomvc/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Header extends Component {
return (
<header className="header">
<h1>todos</h1>
<TodoTextInput newTodo={true}
<TodoTextInput newTodo
onSave={this.handleSave.bind(this)}
placeholder="What needs to be done?" />
</header>
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"babel-core": "^5.6.18",
"babel-eslint": "^4.1.0",
"babel-loader": "^5.1.4",
"contextify": "^0.1.14",
"eslint": "^1.2.1",
"eslint-config-airbnb": "0.0.8",
"eslint-plugin-react": "^3.2.3",
Expand Down
8 changes: 3 additions & 5 deletions test/utils/isPlainObject.spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import expect from 'expect';
import isPlainObject from '../../src/utils/isPlainObject';
import contextify from 'contextify';
import vm from 'vm';

describe('isPlainObject', () => {
it('should return true only if plain object', () => {
function Test() {
this.prop = 1;
}

const sandbox = contextify();
sandbox.run('var fromAnotherRealm = {};');
const sandbox = { fromAnotherRealm: false };
vm.runInNewContext('fromAnotherRealm = {}', sandbox);

expect(isPlainObject(sandbox.fromAnotherRealm)).toBe(true);
expect(isPlainObject(new Test())).toBe(false);
Expand All @@ -18,7 +18,5 @@ describe('isPlainObject', () => {
expect(isPlainObject(null)).toBe(false);
expect(isPlainObject()).toBe(false);
expect(isPlainObject({ 'x': 1, 'y': 2 })).toBe(true);

sandbox.dispose();
});
});