Permalink
Browse files

Allowing HTML to JSX without var name.

  • Loading branch information...
alansouzati committed Mar 24, 2015
1 parent 092cffd commit 28a4005cda6159dbaa0e712c9a10e95ee31c15da
Showing with 20 additions and 3 deletions.
  1. +3 −0 .gitignore
  2. +0 −3 src/htmltojsx.js
  3. +17 −0 test/htmltojsx-test.js
@@ -1,3 +1,6 @@
node_modules
build
temp
.DS_Store
*.sublime-project
*.sublime-workspace
@@ -161,9 +161,6 @@ var HTMLtoJSX = function(config) {
if (!this.config.indent) {
this.config.indent = ' ';
}
if (!this.config.outputClassName) {
this.config.outputClassName = 'NewComponent';
}
};
HTMLtoJSX.prototype = {
/**
@@ -62,6 +62,23 @@ describe('htmltojsx', function() {
);
});
it('should create a new React without var name', function() {
var converter = new HTMLtoJSX({
createClass: true
});
var result = converter.convert('<div>Hello world!</div>');
expect(result).toBe(
'React.createClass({\n' +
' render: function() {\n' +
' return (\n' +
'\n' +
' <div>Hello world!</div>\n' +
' );\n' +
' }\n' +
'});'
);
});
it('should wrap HTML with a div when multiple top-level', function() {
var converter = new HTMLtoJSX({
createClass: true,

0 comments on commit 28a4005

Please sign in to comment.