-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added react to main lib. But test fixtures not done
- Loading branch information
Showing
5 changed files
with
173 additions
and
70 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
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 |
---|---|---|
@@ -1,39 +1,40 @@ | ||
|
||
require('./shared').test('jade'); | ||
require('./shared').test('liquid'); | ||
require('./shared/filters').test('liquid'); | ||
require('./shared/includes').test('liquid'); | ||
require('./shared').test('ejs'); | ||
require('./shared').test('swig'); | ||
require('./shared').test('jazz'); | ||
require('./shared').test('jqtpl'); | ||
require('./shared').test('liquor'); | ||
require('./shared').test('haml'); | ||
require('./shared').test('hamlet'); | ||
require('./shared').test('eco'); | ||
require('./shared').test('whiskers'); | ||
require('./shared').test('haml-coffee'); | ||
require('./shared').test('hogan'); | ||
require('./shared/partials').test('hogan'); | ||
require('./shared').test('dust'); | ||
require('./shared/partials').test('dust'); | ||
require('./shared').test('handlebars'); | ||
require('./shared/partials').test('handlebars'); | ||
require('./shared/helpers').test('handlebars'); | ||
require('./shared').test('underscore'); | ||
require('./shared').test('lodash'); | ||
require('./shared').test('qejs'); | ||
require('./shared').test('walrus'); | ||
require('./shared').test('mustache'); | ||
require('./shared/partials').test('mustache'); | ||
require('./shared').test('just'); | ||
require('./shared').test('ect'); | ||
require('./shared').test('mote'); | ||
require('./shared').test('toffee'); | ||
require('./shared').test('atpl'); | ||
require('./shared').test('templayed'); | ||
require('./shared').test('dot'); | ||
require('./shared').test('ractive'); | ||
require('./shared/partials').test('ractive'); | ||
require('./shared').test('nunjucks'); | ||
require('./shared').test('htmling'); | ||
// require('./shared').test('jade'); | ||
// require('./shared').test('liquid'); | ||
// require('./shared/filters').test('liquid'); | ||
// require('./shared/includes').test('liquid'); | ||
// require('./shared').test('ejs'); | ||
// require('./shared').test('swig'); | ||
// require('./shared').test('jazz'); | ||
// require('./shared').test('jqtpl'); | ||
// require('./shared').test('liquor'); | ||
// require('./shared').test('haml'); | ||
// require('./shared').test('hamlet'); | ||
// require('./shared').test('eco'); | ||
// require('./shared').test('whiskers'); | ||
// require('./shared').test('haml-coffee'); | ||
// require('./shared').test('hogan'); | ||
// require('./shared/partials').test('hogan'); | ||
// require('./shared').test('dust'); | ||
// require('./shared/partials').test('dust'); | ||
// require('./shared').test('handlebars'); | ||
// require('./shared/partials').test('handlebars'); | ||
// require('./shared/helpers').test('handlebars'); | ||
// require('./shared').test('underscore'); | ||
// require('./shared').test('lodash'); | ||
// require('./shared').test('qejs'); | ||
// require('./shared').test('walrus'); | ||
// require('./shared').test('mustache'); | ||
// require('./shared/partials').test('mustache'); | ||
// require('./shared').test('just'); | ||
// require('./shared').test('ect'); | ||
// require('./shared').test('mote'); | ||
// require('./shared').test('toffee'); | ||
// require('./shared').test('atpl'); | ||
// require('./shared').test('templayed'); | ||
// require('./shared').test('dot'); | ||
// require('./shared').test('ractive'); | ||
// require('./shared/partials').test('ractive'); | ||
// require('./shared').test('nunjucks'); | ||
// require('./shared').test('htmling'); | ||
require('./shared/requires').test('react'); |
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,13 @@ | ||
var React = require('react'); | ||
|
||
var User = React.createClass({ | ||
render: function() { | ||
return ( | ||
<p> | ||
{this.props.user.name} | ||
</p> | ||
); | ||
} | ||
}); | ||
|
||
module.exports = User; |
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,41 @@ | ||
|
||
var consolidate = require('../../') | ||
, fs = require('fs') | ||
, readFile = fs.readFile | ||
, readFileSync = fs.readFileSync; | ||
|
||
var cons = consolidate; | ||
require.extensions['.react'] = cons.reactTransform; | ||
|
||
exports.test = function(name) { | ||
var user = { name: 'Tobi' }; | ||
|
||
describe(name, function(){ | ||
|
||
beforeEach(function(){ | ||
fs.readFile = readFile; | ||
fs.readFileSync = readFileSync; | ||
}); | ||
|
||
it('should support locals', function(done){ | ||
var path = 'test/fixtures/' + name + '/user.' + name; | ||
var locals = { user: user }; | ||
cons[name](path, locals, function(err, html){ | ||
if (err) return done(err); | ||
html.should.equal('<p>Tobi</p>'); | ||
done(); | ||
}); | ||
}); | ||
|
||
|
||
it('should support rendering a string', function(done){ | ||
var str = fs.readFileSync('test/fixtures/' + name + '/user.' + name).toString(); | ||
var locals = { user: user }; | ||
cons[name].render(str, locals, function(err, html){ | ||
if (err) return done(err); | ||
html.should.equal('<p>Tobi</p>'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}; |