2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-08 17:22:26 +03:00

add eslint, travis config, test tasks

This commit is contained in:
Nikolay Kostyurin
2018-06-11 22:31:02 +02:00
parent 305643daa2
commit 792e949b6e
36 changed files with 6529 additions and 434 deletions
+41
View File
@@ -0,0 +1,41 @@
const React = require('react');
const parse = require('bbob-html');
class BBCode extends React.Component {
render() {
const Container = this.props.container;
return (
<Container>
{this.content()}
</Container>
);
}
content() {
if (this.props.source) {
return <span dangerouslySetInnerHTML={{ __html: this.renderBBCode(this.props.source) }} />;
}
else {
return React.Children.map(this.props.children, child => {
if (typeof child === 'string') {
return <span dangerouslySetInnerHTML={{ __html: this.renderBBCode(child) }} />;
}
else {
return child;
}
});
}
}
renderBBCode(source) {
return parse(source)
}
}
BBCode.defaultProps = {
container: 'div',
options: {},
};
module.exports = BBCode;
+7
View File
@@ -0,0 +1,7 @@
describe('React BBCode', () => {
test('render markup properly', () => {
})
});
+13
View File
@@ -0,0 +1,13 @@
{
"name": "@bbob/react",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "../../node_modules/.bin/jest --",
"cover": "../../node_modules/.bin/jest --coverage",
"lint": "../../node_modules/.bin/eslint "
},
"author": "Nikolay Kostyurin <jilizart@gmail.com>",
"license": "MIT"
}