@@ -7,8 +7,8 @@ var webpack = require('webpack')
7
7
var MemoryFS = require ( 'memory-fs' )
8
8
var expect = require ( 'chai' ) . expect
9
9
var hash = require ( 'hash-sum' )
10
+ var Vue = require ( 'vue' )
10
11
var SSR = require ( 'vue-server-renderer' )
11
- var Vue = require ( 'vue/dist/vue.runtime.js' )
12
12
// var compiler = require('../lib/template-compiler')
13
13
var normalizeNewline = require ( 'normalize-newline' )
14
14
var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
@@ -933,44 +933,47 @@ describe('vue-loader', function () {
933
933
} )
934
934
935
935
// Vue required tests for more complete test cases
936
- it ( 'should allow functional template' , done => {
937
- test ( {
938
- entry : './test/fixtures/functional-root.vue' ,
939
- vue : {
940
- preserveWhitespace : false
941
- }
942
- } , ( window , module ) => {
943
- expect ( module . components . Functional . compiled ) . to . equal ( true )
944
- expect ( module . components . Functional . functional ) . to . equal ( true )
945
- expect ( module . components . Functional . staticRenderFns ) . to . exist
946
- expect ( module . components . Functional . render ) . to . be . a ( 'function' )
947
-
948
- const vnode = mockRender ( module , {
949
- fn ( ) {
950
- done ( )
936
+ // this test case requires Vue >= 2.5
937
+ if ( Number ( Vue . version . split ( '.' ) [ 1 ] ) >= 5 ) {
938
+ it ( 'functional template' , done => {
939
+ test ( {
940
+ entry : './test/fixtures/functional-root.vue' ,
941
+ vue : {
942
+ preserveWhitespace : false
951
943
}
952
- } ) . children [ 0 ]
953
-
954
- // Basic vnode
955
- expect ( vnode . children [ 0 ] . data . staticClass ) . to . equal ( 'red' )
956
- expect ( vnode . children [ 0 ] . children [ 0 ] . text ) . to . equal ( 'hello' )
957
- // Default slot vnode
958
- expect ( vnode . children [ 1 ] . tag ) . to . equal ( 'span' )
959
- expect ( vnode . children [ 1 ] . children [ 0 ] . text ) . to . equal ( 'hello' )
960
- // Named slot vnode
961
- expect ( vnode . children [ 2 ] . tag ) . to . equal ( 'div' )
962
- expect ( vnode . children [ 2 ] . children [ 0 ] . text ) . to . equal ( 'Second slot' )
963
- // // Scoped slot vnode
964
- expect ( vnode . children [ 3 ] . text ) . to . equal ( 'hello' )
965
- // // Static content vnode
966
- expect ( vnode . children [ 4 ] . tag ) . to . equal ( 'div' )
967
- expect ( vnode . children [ 4 ] . children [ 0 ] . text ) . to . equal ( 'Some ' )
968
- expect ( vnode . children [ 4 ] . children [ 1 ] . tag ) . to . equal ( 'span' )
969
- expect ( vnode . children [ 4 ] . children [ 1 ] . children [ 0 ] . text ) . to . equal ( 'text' )
970
- // // v-if vnode
971
- expect ( vnode . children [ 5 ] . text ) . to . equal ( '' )
972
-
973
- vnode . children [ 6 ] . data . on . click ( )
944
+ } , ( window , module ) => {
945
+ expect ( module . components . Functional . _compiled ) . to . equal ( true )
946
+ expect ( module . components . Functional . functional ) . to . equal ( true )
947
+ expect ( module . components . Functional . staticRenderFns ) . to . exist
948
+ expect ( module . components . Functional . render ) . to . be . a ( 'function' )
949
+
950
+ const vnode = mockRender ( module , {
951
+ fn ( ) {
952
+ done ( )
953
+ }
954
+ } ) . children [ 0 ]
955
+
956
+ // Basic vnode
957
+ expect ( vnode . children [ 0 ] . data . staticClass ) . to . equal ( 'red' )
958
+ expect ( vnode . children [ 0 ] . children [ 0 ] . text ) . to . equal ( 'hello' )
959
+ // Default slot vnode
960
+ expect ( vnode . children [ 1 ] . tag ) . to . equal ( 'span' )
961
+ expect ( vnode . children [ 1 ] . children [ 0 ] . text ) . to . equal ( 'hello' )
962
+ // Named slot vnode
963
+ expect ( vnode . children [ 2 ] . tag ) . to . equal ( 'div' )
964
+ expect ( vnode . children [ 2 ] . children [ 0 ] . text ) . to . equal ( 'Second slot' )
965
+ // // Scoped slot vnode
966
+ expect ( vnode . children [ 3 ] . text ) . to . equal ( 'hello' )
967
+ // // Static content vnode
968
+ expect ( vnode . children [ 4 ] . tag ) . to . equal ( 'div' )
969
+ expect ( vnode . children [ 4 ] . children [ 0 ] . text ) . to . equal ( 'Some ' )
970
+ expect ( vnode . children [ 4 ] . children [ 1 ] . tag ) . to . equal ( 'span' )
971
+ expect ( vnode . children [ 4 ] . children [ 1 ] . children [ 0 ] . text ) . to . equal ( 'text' )
972
+ // // v-if vnode
973
+ expect ( vnode . children [ 5 ] . text ) . to . equal ( '' )
974
+
975
+ vnode . children [ 6 ] . data . on . click ( )
976
+ } )
974
977
} )
975
- } )
978
+ }
976
979
} )
0 commit comments