Skip to content

Commit f217437

Browse files
author
daniel.gomez
committed
Added Dummy test to configure dependencies.
TODO, all the Helper/Localizer/Factory should be moved to an Utils repo in order to use them as inter dependencies btw core and ui modules
1 parent 3fa0e51 commit f217437

File tree

14 files changed

+189
-7
lines changed

14 files changed

+189
-7
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015", "stage-0", "react"],
3+
"plugins": ["add-module-exports"]
4+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/node_modules
12
/.idea

package.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Bootstrap UI implementation for redux-autoform",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "mocha ./test --compilers js:babel-register"
88
},
99
"repository": {
1010
"type": "git",
@@ -21,5 +21,24 @@
2121
"bugs": {
2222
"url": "https://github.com/redux-autoform/redux-autoform-bootstrap-ui/issues"
2323
},
24-
"homepage": "https://github.com/redux-autoform/redux-autoform-bootstrap-ui#readme"
24+
"homepage": "https://github.com/redux-autoform/redux-autoform-bootstrap-ui#readme",
25+
"dependencies": {
26+
"bootstrap": "^3.3.6",
27+
"react": "^15.1.0",
28+
"react-bootstrap": "^0.30.0-rc.1",
29+
"react-select": "^1.0.0-beta14",
30+
"react-widgets": "^3.4.2",
31+
"underscore": "^1.8.3"
32+
},
33+
"devDependencies": {
34+
"babel-cli": "^6.6.5",
35+
"babel-core": "^6.7.4",
36+
"babel-loader": "^6.2.4",
37+
"babel-plugin-add-module-exports": "^0.2.1",
38+
"babel-polyfill": "^6.9.1",
39+
"babel-preset-es2015": "^6.6.0",
40+
"babel-preset-react": "^6.5.0",
41+
"babel-preset-stage-0": "^6.5.0",
42+
"mocha": "^2.5.3"
43+
}
2544
}

src/components/FormGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component, PropTypes } from 'react';
2-
import FormGroupInline from './FormGroupInline';
2+
import FormGroupInline from './FormGroupInline.js';
33
import FormGroupStacked from './FormGroupStacked';
44

55
class FormGroup extends Component {

src/components/FormGroupInline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { Component, PropTypes } from 'react';
22
import { FormGroup as BootstrapFormGroup } from 'react-bootstrap';
33
import FormGroupInlineControlLabel from './FormGroupInlineControlLabel';
44
import FormGroupInlineContent from './FormGroupInlineContent'
5-
import { getDisplayName } from '../../helpers/metadataHelper';
5+
import { getDisplayName } from '../helpers/metadataHelper'; // TODO Move to Util Repo
66

77
class FormGroupInline extends Component {
88
static propTypes = {

src/components/fieldComponents/CheckBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import { getDisplayName } from '../../../helpers/metadataHelper';
2+
import { getDisplayName } from '../../helpers/metadataHelper'; // TODO Move to Util Repo
33
import { Checkbox as BootstrapCheckbox } from 'react-bootstrap';
44
import Col from 'react-bootstrap/lib/Col';
55

src/components/fieldComponents/DateTimePicker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component, PropTypes } from 'react';
22
import {DateTimePicker as ReactWidgetsDateTimePicker} from 'react-widgets';
3-
import { getDateLocalizer } from '../../../localization/dateLocalizer';
3+
import { getDateLocalizer } from '../../localization/dateLocalizer'; // TODO Move to Util Repo
44
import FormGroup from '../FormGroup';
55

66
class DateTimePicker extends Component {

src/factory/BootstrapFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ComponentFactory from './ComponentFactory';
1+
import ComponentFactory from './ComponentFactory'; //TODO Move to Util repo
22
import { registerBaseComponents } from './helper/BootstrapComponentFactoryHelper';
33

44
class BootstrapFactory extends ComponentFactory {

src/helpers/metadataHelper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function getDisplayName(displayName, name) {
2+
if(displayName == null) return null;
3+
else if(displayName == undefined || displayName == '') return name;
4+
return displayName;
5+
}

src/localization/dateLocalizer.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var _dateLocalizer;
2+
3+
/**
4+
* Sets the date localizer
5+
* @param localizer
6+
*/
7+
export function setDateLocalizer(localizer) {
8+
if (!localizer) throw Error('\'localizer\' should be truthy');
9+
_dateLocalizer = localizer;
10+
}
11+
12+
/**
13+
* Gets the date localizer
14+
* @returns {*}
15+
*/
16+
export function getDateLocalizer() {
17+
if(!_dateLocalizer)
18+
throw Error('Localizer has not yet been set');
19+
return _dateLocalizer;
20+
}
21+

0 commit comments

Comments
 (0)