react-live
Advanced tools
Comparing version 1.4.9 to 1.4.10
@@ -52,2 +52,10 @@ 'use strict'; | ||
}); | ||
it('should ignore comments', function () { | ||
var code = '// Comment\n<div>Hello World!</div>'; | ||
var element = (0, _transpile.generateElement)({ code: code }); | ||
var wrapper = (0, _enzyme.shallow)(element); | ||
expect(wrapper.text()).toBe('Hello World!'); | ||
}); | ||
}); | ||
@@ -54,0 +62,0 @@ |
@@ -29,5 +29,5 @@ 'use strict'; | ||
// NOTE: Workaround for classes, since buble doesn't allow `return` without a function | ||
var transformed = (0, _transform2.default)(code).trim().replace(/^var \w+ =/, ''); | ||
var transformed = (0, _transform2.default)(code).trim().replace(/^var \w+ =/, '').replace(/;$/, ''); | ||
return (0, _errorBoundary2.default)((0, _evalCode2.default)('return ' + transformed, scope), errorCallback); | ||
return (0, _errorBoundary2.default)((0, _evalCode2.default)('return (' + transformed + ')', scope), errorCallback); | ||
}; | ||
@@ -34,0 +34,0 @@ |
{ | ||
"name": "react-live", | ||
"version": "1.4.9", | ||
"version": "1.4.10", | ||
"description": "A production-focused playground for live editing React code", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -44,2 +44,10 @@ import React from 'react' | ||
}) | ||
it('should ignore comments', () => { | ||
const code = '// Comment\n<div>Hello World!</div>' | ||
const element = generateElement({ code }) | ||
const wrapper = shallow(element) | ||
expect(wrapper.text()).toBe('Hello World!') | ||
}) | ||
}) | ||
@@ -46,0 +54,0 @@ |
@@ -13,6 +13,7 @@ import transform from './transform' | ||
.replace(/^var \w+ =/, '') | ||
.replace(/;$/, '') | ||
return errorBoundary( | ||
evalCode( | ||
`return ${transformed}`, | ||
`return (${transformed})`, | ||
scope | ||
@@ -19,0 +20,0 @@ ), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1323493
27013