File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 3535 "devDependencies" : {
3636 "@types/chai" : " ^3.4.34" ,
3737 "@types/mocha" : " ^2.2.32" ,
38+ "babel-core" : " ^6.18.2" ,
39+ "babel-loader" : " ^6.2.7" ,
40+ "babel-plugin-transform-class-properties" : " ^6.18.0" ,
41+ "babel-plugin-transform-decorators-legacy" : " ^1.3.4" ,
42+ "babel-preset-es2015" : " ^6.18.0" ,
3843 "chai" : " ^3.5.0" ,
3944 "mocha" : " ^3.1.2" ,
4045 "node-libs-browser" : " ^1.0.0" ,
Original file line number Diff line number Diff line change 1+ {
2+ "presets" : [
3+ [" es2015" , {"modules" : false }]
4+ ],
5+ "plugins" : [
6+ " transform-decorators-legacy" ,
7+ " transform-class-properties"
8+ ]
9+ }
Original file line number Diff line number Diff line change 1+ import Component from '../lib/index'
2+ import { expect } from 'chai'
3+ import Vue from 'vue'
4+
5+ describe ( 'vue-class-component with Babel' , ( ) => {
6+ it ( 'should be instantiated without any errors' , ( ) => {
7+ @Component
8+ class MyComp { }
9+ expect ( ( ) => new MyComp ( ) ) . to . not . throw ( Error )
10+ } )
11+
12+ it ( 'should collect class properties as data' , ( ) => {
13+ @Component
14+ class MyComp {
15+ foo = 'hello'
16+ }
17+ const c = new MyComp ( )
18+ expect ( c . foo ) . to . equal ( 'hello' )
19+ } )
20+ } )
Original file line number Diff line number Diff line change 11module . exports = {
2- entry : './test/test.ts' ,
2+ entry : [
3+ './test/test.ts' ,
4+ './test/test-babel.js'
5+ ] ,
36 output : {
47 path : './test' ,
58 filename : 'test.build.js'
@@ -10,6 +13,11 @@ module.exports = {
1013 test : / \. t s $ / ,
1114 exclude : / n o d e _ m o d u l e s | v u e \/ s r c / ,
1215 loader : 'ts'
16+ } ,
17+ {
18+ test : / \. j s $ / ,
19+ exclude : / n o d e _ m o d u l e s | v u e \/ s r c / ,
20+ loader : 'babel'
1321 }
1422 ]
1523 }
You can’t perform that action at this time.
0 commit comments