Skip to content

Commit 28a4005

Browse files
committed
Allowing HTML to JSX without var name.
1 parent 092cffd commit 28a4005

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
build
33
temp
4+
.DS_Store
5+
*.sublime-project
6+
*.sublime-workspace

Diff for: src/htmltojsx.js

-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ var HTMLtoJSX = function(config) {
161161
if (!this.config.indent) {
162162
this.config.indent = ' ';
163163
}
164-
if (!this.config.outputClassName) {
165-
this.config.outputClassName = 'NewComponent';
166-
}
167164
};
168165
HTMLtoJSX.prototype = {
169166
/**

Diff for: test/htmltojsx-test.js

+17
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ describe('htmltojsx', function() {
6262
);
6363
});
6464

65+
it('should create a new React without var name', function() {
66+
var converter = new HTMLtoJSX({
67+
createClass: true
68+
});
69+
var result = converter.convert('<div>Hello world!</div>');
70+
expect(result).toBe(
71+
'React.createClass({\n' +
72+
' render: function() {\n' +
73+
' return (\n' +
74+
'\n' +
75+
' <div>Hello world!</div>\n' +
76+
' );\n' +
77+
' }\n' +
78+
'});'
79+
);
80+
});
81+
6582
it('should wrap HTML with a div when multiple top-level', function() {
6683
var converter = new HTMLtoJSX({
6784
createClass: true,

0 commit comments

Comments
 (0)