Просмотр исходного кода

test for new key filter syntax

Evan You 10 лет назад
Родитель
Сommit
cb8d6f3b41
1 измененных файлов с 22 добавлено и 1 удалено
  1. 22 1
      test/unit/specs/directives/on_spec.js

+ 22 - 1
test/unit/specs/directives/on_spec.js

@@ -10,7 +10,7 @@ function trigger (target, event, process) {
 }
 
 if (_.inBrowser) {
-  describe('v-on', function () {
+  describe('on-', function () {
 
     var el
     beforeEach(function () {
@@ -71,6 +71,27 @@ if (_.inBrowser) {
       })
     })
 
+    it('with new syntax key filter', function (done) {
+      new Vue({
+        el: el,
+        template: '<a on-keyup:enter="test">{{a}}</a>',
+        data: {a: 1},
+        methods: {
+          test: function () {
+            this.a++
+          }
+        }
+      })
+      var a = el.firstChild
+      trigger(a, 'keyup', function (e) {
+        e.keyCode = 13
+      })
+      _.nextTick(function () {
+        expect(a.textContent).toBe('2')
+        done()
+      })
+    })
+
     it('warn non-function values', function () {
       new Vue({
         el: el,