-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #383 from childrentime/fix/early-wrapReturn
Fix: mv wrapReturn behind transform
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/react-live/src/utils/test/fixtures/optional-chain.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { generateElement } from "../../transpile"; | ||
import { shallow } from "../renderer"; | ||
|
||
describe("transpile", () => { | ||
it("should support optional chain", () => { | ||
const code = `function Demo() { | ||
return <h3 style={{ | ||
background: 'darkslateblue', | ||
color: 'white', | ||
padding: 8, | ||
borderRadius: 4 | ||
}}> | ||
{'1'?.toString()} | ||
</h3> | ||
}`; | ||
const Component = generateElement({ code }); | ||
const wrapper = shallow(<Component />); | ||
|
||
expect(wrapper.html()).toMatchInlineSnapshot( | ||
`"<h3 style=\\"background:darkslateblue;color:white;padding:8px;border-radius:4px\\">1</h3>"` | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters