@@ -2,6 +2,7 @@ var Vue = require('../../../../src/vue')
2
2
var _ = require ( '../../../../src/util' )
3
3
var compiler = require ( '../../../../src/compiler' )
4
4
var compile = compiler . compile
5
+ var publicDirectives = require ( '../../../../src/directives/public' )
5
6
var internalDirectives = require ( '../../../../src/directives/internal' )
6
7
7
8
if ( _ . inBrowser ) {
@@ -102,36 +103,37 @@ if (_.inBrowser) {
102
103
expect ( directiveBind . calls . argsFor ( 3 ) [ 0 ] ) . toBe ( 'a' )
103
104
} )
104
105
105
- it ( 'bind- syntax ' , function ( ) {
106
- el . setAttribute ( 'bind- class' , 'a' )
107
- el . setAttribute ( 'bind- style' , 'b' )
108
- el . setAttribute ( 'bind- title' , 'c' )
106
+ it ( 'v-bind shorthand ' , function ( ) {
107
+ el . setAttribute ( ': class' , 'a' )
108
+ el . setAttribute ( ': style' , 'b' )
109
+ el . setAttribute ( ': title' , 'c' )
109
110
var linker = compile ( el , Vue . options )
110
111
linker ( vm , el )
111
112
expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 3 )
112
113
// 1
113
114
var args = vm . _bindDir . calls . argsFor ( 0 )
114
115
expect ( args [ 0 ] . name ) . toBe ( 'class' )
115
116
expect ( args [ 0 ] . expression ) . toBe ( 'a' )
116
- expect ( args [ 0 ] . def ) . toBe ( internalDirectives . class )
117
+ expect ( args [ 0 ] . def ) . toBe ( publicDirectives . class )
117
118
expect ( args [ 1 ] ) . toBe ( el )
118
119
// 2
119
120
args = vm . _bindDir . calls . argsFor ( 1 )
120
121
expect ( args [ 0 ] . name ) . toBe ( 'style' )
121
122
expect ( args [ 0 ] . expression ) . toBe ( 'b' )
122
- expect ( args [ 0 ] . def ) . toBe ( internalDirectives . style )
123
+ expect ( args [ 0 ] . def ) . toBe ( publicDirectives . style )
123
124
expect ( args [ 1 ] ) . toBe ( el )
124
125
// 3
125
126
args = vm . _bindDir . calls . argsFor ( 2 )
126
- expect ( args [ 0 ] . name ) . toBe ( 'attr ' )
127
+ expect ( args [ 0 ] . name ) . toBe ( 'bind ' )
127
128
expect ( args [ 0 ] . expression ) . toBe ( 'c' )
128
129
expect ( args [ 0 ] . arg ) . toBe ( 'title' )
129
- expect ( args [ 0 ] . def ) . toBe ( internalDirectives . attr )
130
+ expect ( args [ 0 ] . def ) . toBe ( publicDirectives . bind )
130
131
expect ( args [ 1 ] ) . toBe ( el )
131
132
} )
132
133
133
- it ( 'on- syntax' , function ( ) {
134
- el . setAttribute ( 'on-click' , 'a++' )
134
+ it ( 'v-on shorthand' , function ( ) {
135
+ el . innerHTML = '<div @click="a++"></div>'
136
+ el = el . firstChild
135
137
var linker = compile ( el , Vue . options )
136
138
linker ( vm , el )
137
139
expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 1 )
@@ -224,12 +226,12 @@ if (_.inBrowser) {
224
226
{ name : 'optimizeLiteral' }
225
227
]
226
228
el . innerHTML = '<div ' +
227
- 'bind- test-normal="a" ' +
229
+ 'v-bind: test-normal="a" ' +
228
230
'test-literal="1" ' +
229
- 'bind- optimize-literal="1" ' +
230
- 'bind- test-two-way@="a" ' +
231
- 'bind- two-way-warn@="a + 1" ' +
232
- 'bind- test-one-time*="a"></div>'
231
+ ': optimize-literal="1" ' +
232
+ ': test-two-way@="a" ' +
233
+ ': two-way-warn@="a + 1" ' +
234
+ ': test-one-time*="a"></div>'
233
235
compiler . compileAndLinkProps ( vm , el . firstChild , props )
234
236
expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 3 ) // skip literal and one time
235
237
// literal
@@ -262,8 +264,8 @@ if (_.inBrowser) {
262
264
// temporarily remove vm.$parent
263
265
var context = vm . _context
264
266
vm . _context = null
265
- el . setAttribute ( 'bind- a' , '"hi"' )
266
- el . setAttribute ( 'bind- b' , 'hi' )
267
+ el . setAttribute ( 'v-bind: a' , '"hi"' )
268
+ el . setAttribute ( ': b' , 'hi' )
267
269
compiler . compileAndLinkProps ( vm , el , [
268
270
{ name : 'a' } ,
269
271
{ name : 'b' }
@@ -291,7 +293,7 @@ if (_.inBrowser) {
291
293
} )
292
294
293
295
it ( 'partial compilation' , function ( ) {
294
- el . innerHTML = '<div bind- test="abc">{{bcd}}<p v-show="ok"></p></div>'
296
+ el . innerHTML = '<div v-bind: test="abc">{{bcd}}<p v-show="ok"></p></div>'
295
297
var linker = compile ( el , Vue . options , true )
296
298
var decompile = linker ( vm , el )
297
299
expect ( vm . _directives . length ) . toBe ( 3 )
@@ -338,7 +340,7 @@ if (_.inBrowser) {
338
340
it ( 'should teardown props and replacer directives when unlinking' , function ( ) {
339
341
var vm = new Vue ( {
340
342
el : el ,
341
- template : '<test bind- msg="msg"></test>' ,
343
+ template : '<test : msg="msg"></test>' ,
342
344
data : {
343
345
msg : 'hi'
344
346
} ,
0 commit comments