-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
190 additions
and
56 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
*node_modules* | ||
*.jsx | ||
bundle.js | ||
test1 | ||
test-2 |
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,4 @@ | ||
language: node_js | ||
node_js: | ||
- "0.8" | ||
- "0.10" |
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
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
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
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,2 @@ | ||
#!/bin/sh | ||
npm run precommit |
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,61 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var test = require('tap').test; | ||
var jsxhint = require('../jsxhint'); | ||
|
||
test('Load and enumerate regexps from .gitignore', function(t){ | ||
t.plan(4); | ||
var ignoreString = 'test;' | ||
var ignoreData = fs.readFileSync('../.gitignore', 'utf-8').trim().split('\n'); | ||
|
||
jsxhint.makeIgnores([ignoreString], null, null, function(err, ignores){ | ||
t.equal(ignores.length, 1, 'More than one ignore'); | ||
var regex = new RegExp('^'+ignoreString+'$','g'); | ||
t.equal(ignores[0].toString(), regex.toString(), 'RegExp processed incorrectly'); | ||
}); | ||
|
||
jsxhint.makeIgnores(null, '.gitignore', '../', function(err, ignores){ | ||
t.equal(ignores.length, ignoreData.length, 'Should be '+ignoreData.length); | ||
}); | ||
|
||
jsxhint.makeIgnores([ignoreString], '.gitignore', '../', function(err, ignores){ | ||
t.equal(ignores.length, ignoreData.length+1, 'Should have combined'); | ||
}); | ||
}); | ||
|
||
test('Load .jshintrc, if it exists', function(t){ | ||
t.plan(4); | ||
var jshintRC = JSON.parse(fs.readFileSync('../.jshintrc', 'utf-8')); | ||
jsxhint.getJSHintRc(null, null, function(err, jshintdata){ | ||
t.ifError(err); | ||
t.deepEqual(jshintdata, {}, 'Should be an empty object'); | ||
}); | ||
|
||
jsxhint.getJSHintRc('.jshintrc', '../', function(err, jshintdata){ | ||
t.ifError(err); | ||
t.deepEqual(jshintdata, jshintRC, 'Should match'); | ||
}); | ||
}); | ||
|
||
test('Convert JSX to JS', function(t){ | ||
t.plan(4); | ||
jsxhint.transformJSX('./test_article.js', function(err, data){ | ||
t.ifError(err); | ||
var containsFormElement = data.match(/<form/); | ||
t.equal(data.match(/<form/), null, 'JS was not properly converted'); | ||
}); | ||
|
||
jsxhint.transformJSX('./test_article.jsx', function(err, data){ | ||
t.ifError(err); | ||
t.equal(data.match(/<form/), null, 'JS was not properly converted'); | ||
}); | ||
}); | ||
|
||
test('Generate tests', function(t){ | ||
var tasks = jsxhint.generateTasks(['./test.js'], [], '', '', process.cwd()); | ||
console.log(tasks); | ||
t.equal(tasks.length, 2, 'Should be a single task'); | ||
t.equal(typeof tasks[0], 'function', 'First task should a function'); | ||
t.end(); | ||
}); |
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,37 @@ | ||
/** @jsx React.DOM */ | ||
'use strict' | ||
|
||
var React = require('react-tools/build/modules/React'); | ||
|
||
var statusForm = React.createClass({ | ||
render: function(){ | ||
return <form class="form-horizontal" role="form"> | ||
<div class="form-group"> | ||
<label for="brand-lead" class="col-sm-4 control-label">Brand lead:</label> | ||
<div class="col-sm-8"> | ||
<input class="form-control" | ||
placeholder="brand lead" | ||
type="text" | ||
id="brand-lead" | ||
ref="brandLead" | ||
data-state="brandLead" /> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="status-text" class="col-sm-4 control-label">Status:</label> | ||
<div class="col-sm-8"> | ||
<textarea | ||
id="status-text" | ||
class="form-control" | ||
rows="40" | ||
ref="statusText" | ||
data-state="statusText"/> | ||
</div> | ||
</div> | ||
|
||
<input class="btn btn-success" type="submit" value="Save status"/> | ||
</form> | ||
} | ||
}); | ||
|
||
module.exports = statusForm; |
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,36 @@ | ||
'use strict' | ||
|
||
var React = require('react-tools/build/modules/React'); | ||
|
||
var statusForm = React.createClass({ | ||
render: function(){ | ||
return <form class="form-horizontal" role="form"> | ||
<div class="form-group"> | ||
<label for="brand-lead" class="col-sm-4 control-label">Brand lead:</label> | ||
<div class="col-sm-8"> | ||
<input class="form-control" | ||
placeholder="brand lead" | ||
type="text" | ||
id="brand-lead" | ||
ref="brandLead" | ||
data-state="brandLead" /> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label for="status-text" class="col-sm-4 control-label">Status:</label> | ||
<div class="col-sm-8"> | ||
<textarea | ||
id="status-text" | ||
class="form-control" | ||
rows="40" | ||
ref="statusText" | ||
data-state="statusText"/> | ||
</div> | ||
</div> | ||
|
||
<input class="btn btn-success" type="submit" value="Save status"/> | ||
</form> | ||
} | ||
}); | ||
|
||
module.exports = statusForm; |