Skip to content

Commit

Permalink
test: update test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed May 5, 2023
1 parent 9231def commit 5cfcb94
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/__test__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import RunWeb from '../';
it('Should output a RunWeb', async () => {
const component = TestRenderer.create(<RunWeb />);
let tree = component.toJSON();
console.log('tree:', tree);
if (tree && !Array.isArray(tree)) {
expect(tree.type).toEqual('iframe');
expect(tree.props.title).toEqual('Demo Title');
expect(tree.props.width).toEqual('100%');
expect(tree.props.height).toEqual('100%');
expect(tree.props.style).toEqual({ border: 0 });
expect(tree.props.srcDoc).toEqual('<!DOCTYPE html><html><head></head><body></body></html>');
expect(tree.props.srcDoc).toBeUndefined();
}
});

Expand All @@ -24,9 +25,7 @@ it('RunWeb Props js="..."', async () => {
expect(tree.props.width).toEqual('100%');
expect(tree.props.height).toEqual('100%');
expect(tree.props.style).toEqual({ border: 0 });
expect(tree.props.srcDoc).toEqual(
`<!DOCTYPE html><html><head></head><body></body><script type="text/javascript">console.log('hello world!')</script></html>`,
);
expect(tree.props.srcDoc).toBeUndefined();
}
});

Expand All @@ -39,8 +38,6 @@ it('RunWeb Props css="..."', async () => {
expect(tree.props.width).toEqual('100%');
expect(tree.props.height).toEqual('100%');
expect(tree.props.style).toEqual({ border: 0 });
expect(tree.props.srcDoc).toEqual(
`<!DOCTYPE html><html><head><style>body { color:red; }</style></head><body></body></html>`,
);
expect(tree.props.srcDoc).toBeUndefined();
}
});

0 comments on commit 5cfcb94

Please sign in to comment.