/
665tests.ts
35 lines (30 loc) · 1.11 KB
/
665tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { expect } from "chai";
import { Project } from "../../Project";
describe("tests for issue #665", () => {
it("should not error when getting the descendants when there's jsx in a ts file", () => {
const project = new Project({ useVirtualFileSystem: true });
const file = project.createSourceFile("test.ts", `
function oi(){
const snapshot = { isDraggingOver: false };
function getSourceStyle(opts) {
return {};
}
return <div>
<div></div>
<p style={getSourceStyle(snapshot.isDraggingOver)}></p>
</div>
}
`);
expect(() => file.getDescendants()).to.not.throw();
});
it("should not error when getting the descendants when there's jsx in a ts file for second example", () => {
const project = new Project({ useVirtualFileSystem: true });
const file = project.createSourceFile("test.ts", `
import * as React from 'react';
export const Broken: React.SFC<{ arg: boolean }> = (props) => (
<div style={getStyle(props.arg)} >...</div>
)
`);
expect(() => file.getDescendants()).to.not.throw();
});
});