Skip to content
This repository was archived by the owner on Jun 8, 2019. It is now read-only.

Commit 01d731e

Browse files
committed
Merge branch 'STRML-tests'
2 parents 3db4e12 + d775d85 commit 01d731e

File tree

21 files changed

+551
-2
lines changed

21 files changed

+551
-2
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/**/expected.js

.eslintrc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
"ecmaVersion": 6,
44
"sourceType": "module",
55
"ecmaFeatures": {
6+
"jsx": true,
67
"experimentalObjectRestSpread": true
78
}
89
},
910
"extends": "eslint:recommended",
1011
"env": {
1112
"es6": true,
12-
"node": true
13+
"node": true,
14+
"mocha": true
1315
},
16+
"plugins": [
17+
"react"
18+
],
1419
"rules": {
1520
"no-console": 0,
1621

@@ -31,6 +36,9 @@
3136
"no-this-before-super": 2,
3237
"no-unexpected-multiline": 2,
3338
"no-var": 2,
34-
"no-warning-comments": 1
39+
"no-warning-comments": 1,
40+
41+
"react/jsx-uses-react": 2,
42+
"react/jsx-uses-vars": 2
3543
}
3644
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
*.log
33
lib
4+
test/fixtures/*/actual.json

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- 0.12
5+
- 4.2
6+
- 5
7+
- 6
8+
before_install: if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi
9+
script: npm run lint && npm test
10+
notifications:
11+
email:
12+
recipients:
13+
14+
on_success: change
15+
on_failure: always

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,23 @@
1616
},
1717
"devDependencies": {
1818
"babel-cli": "^6.1.18",
19+
"babel-plugin-espower": "^2.3.1",
1920
"babel-plugin-transform-object-rest-spread": "^6.1.18",
2021
"babel-plugin-transform-runtime": "^6.1.18",
2122
"babel-preset-es2015": "^6.1.18",
23+
"babel-preset-react": "^6.11.1",
24+
"babel-register": "^6.11.6",
25+
"cross-env": "^2.0.0",
2226
"eslint": "^2.9.0",
27+
"eslint-plugin-react": "^6.1.2",
28+
"mocha": "^3.0.2",
29+
"power-assert": "^1.4.1",
2330
"rimraf": "^2.4.3"
2431
},
2532
"scripts": {
2633
"lint": "eslint src/",
2734
"clean": "rimraf lib/",
35+
"test": "cross-env NODE_ENV=test mocha --compilers js:babel-register",
2836
"build": "babel src/ --out-dir lib/",
2937
"preversion": "npm run lint && npm run clean && npm run build",
3038
"prepublish": "npm run clean && npm run build"

test/fixtures/.babelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"react"
5+
],
6+
"env": {
7+
"test": {
8+
"plugins": [
9+
"espower"
10+
]
11+
}
12+
}
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, {Component} from 'react';
2+
import {FormattedHTMLMessage} from 'react-intl';
3+
4+
export default class Foo extends Component {
5+
render() {
6+
return (
7+
<FormattedHTMLMessage
8+
id='foo.bar.baz'
9+
defaultMessage='<h1>Hello World!</h1>'
10+
description='The default message.'
11+
/>
12+
);
13+
}
14+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8+
9+
var _react = require('react');
10+
11+
var _react2 = _interopRequireDefault(_react);
12+
13+
var _reactIntl = require('react-intl');
14+
15+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16+
17+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18+
19+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
20+
21+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
22+
23+
var Foo = function (_Component) {
24+
_inherits(Foo, _Component);
25+
26+
function Foo() {
27+
_classCallCheck(this, Foo);
28+
29+
return _possibleConstructorReturn(this, Object.getPrototypeOf(Foo).apply(this, arguments));
30+
}
31+
32+
_createClass(Foo, [{
33+
key: 'render',
34+
value: function render() {
35+
return _react2.default.createElement(_reactIntl.FormattedHTMLMessage, {
36+
id: 'foo.bar.baz',
37+
defaultMessage: '<h1>Hello World!</h1>',
38+
description: 'The default message.'
39+
});
40+
}
41+
}]);
42+
43+
return Foo;
44+
}(_react.Component);
45+
46+
exports.default = Foo;
47+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"id": "foo.bar.baz",
4+
"description": "The default message.",
5+
"defaultMessage": "<h1>Hello World!</h1>"
6+
}
7+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, {Component} from 'react';
2+
import {FormattedMessage} from 'react-intl';
3+
4+
export default class Foo extends Component {
5+
render() {
6+
return (
7+
<FormattedMessage
8+
id='foo.bar.baz'
9+
defaultMessage='Hello World!'
10+
description='The default message.'
11+
/>
12+
);
13+
}
14+
}

0 commit comments

Comments
 (0)