Skip to content

Commit

Permalink
Added tests for class decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
skolmer committed Jul 4, 2016
1 parent 0c5b395 commit 80fc21e
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 52 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Expand Up @@ -2,5 +2,6 @@
"presets": [
"es2015",
"stage-0"
]
],
"plugins": ["babel-plugin-transform-decorators-legacy"]
}
3 changes: 2 additions & 1 deletion jsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules"
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -44,6 +44,7 @@
"babel-cli": "^6.9.0",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"eslint": "^2.11.1",
Expand Down
27 changes: 27 additions & 0 deletions test/groupedClass.js
@@ -0,0 +1,27 @@
import i18n, { i18nGroup } from '../lib/index'

const name = 'Steffen'
const amount = 1250.33

@i18nGroup('custom group')
export default class GroupedClass {
getText() {
return this.i18n`Hello ${name}, you have ${amount}:c in your bank account.`
}

getCommonText() {
return i18n('common')`Hello ${name}, you have ${amount}:c in your bank account.`
}
}

class GroupedClass2 {
getText() {
return this.i18n`Hello ${name}, you have ${amount}:c in your bank account.`
}

getCommonText() {
return i18n('common 2') `Hello ${name}, you have ${amount}:c in your bank account.`
}
}

export const groupedClass2 = i18nGroup('custom group 2')(GroupedClass2)

0 comments on commit 80fc21e

Please sign in to comment.