add JSXAttribute visitor function, wraps JSXElement attributes in a JSXExpressionContainer; also adds test fixtures (#6006)

This commit is contained in:
Noah Lemen 2017-07-25 09:30:32 -04:00 committed by Henry Zhu
parent 19c4dd2d8c
commit 51a293601b
3 changed files with 10 additions and 0 deletions

View File

@ -47,6 +47,12 @@ export default function({ types: t }) {
);
};
visitor.JSXAttribute = function(path) {
if (t.isJSXElement(path.node.value)) {
path.node.value = t.jSXExpressionContainer(path.node.value);
}
};
return {
inherits: jsx,
visitor,

View File

@ -0,0 +1,3 @@
React.createElement("div", {
attr: React.createElement("div", null)
});