Skip to content

Commit 2567438

Browse files
committed
fix jest tests
1 parent ff55a90 commit 2567438

2 files changed

Lines changed: 11 additions & 18 deletions

File tree

src/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,19 @@ export class Entity extends React.Component {
8383
render() {
8484
const props = this.props;
8585
const elementName = this.isScene ? 'a-scene' : (props.primitive || 'a-entity');
86+
87+
// Let through props that are OK to render initially.
88+
let reactProps = {};
89+
Object.keys(props).forEach(propName => {
90+
if (['className', 'id', 'mixin'].indexOf(propName) !== -1 ||
91+
propName.indexOf('data-') === 0) {
92+
reactProps[propName] = props[propName];
93+
}
94+
});
95+
8696
return React.createElement(
8797
elementName,
88-
Object.assign({ref: this.updateDOM}),
98+
{ref: this.updateDOM, ...reactProps},
8999
props.children);
90100
}
91101
}

tests/react/index.test.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ describe('Entity', () => {
3434
expect(tree.props.mixin).toBe('box');
3535
});
3636

37-
it('renders <a-entity> with null component', () => {
38-
const tree = renderer.create(
39-
<Entity position={null} />
40-
).toJSON();
41-
expect(tree.props.position).toBe(null);
42-
});
43-
4437
it('renders primitive', () => {
4538
const tree = renderer.create(
4639
<Entity primitive='a-sphere' material={{color: 'red'}}/>
@@ -59,14 +52,4 @@ describe('Scene', () => {
5952
expect(tree.type).toBe('a-scene');
6053
expect(tree.children[0].type).toBe('a-entity');
6154
});
62-
63-
it('renders <a-scene antialias="true">', () => {
64-
const tree = renderer.create(
65-
<Scene antialias='true'>
66-
<Entity/>
67-
</Scene>
68-
).toJSON();
69-
expect(tree.type).toBe('a-scene');
70-
expect(tree.props.antialias).toBe('true');
71-
});
7255
});

0 commit comments

Comments
 (0)