ソースを参照

test for apply emit cancelling

Evan You 11 年 前
コミット
d7e0230c57
1 ファイル変更11 行追加0 行削除
  1. 11 0
      test/unit/specs/emitter_spec.js

+ 11 - 0
test/unit/specs/emitter_spec.js

@@ -62,4 +62,15 @@ describe('Emitter', function () {
     expect(spy).toHaveBeenCalledWith(1, 2, 3, 4, 5)
   })
 
+  it('apply emit cancel', function () {
+    expect(e._cancelled).toBe(false)
+    e.on('test', function () {
+      return false
+    })
+    e.applyEmit('test')
+    expect(e._cancelled).toBe(true)
+    e.applyEmit('other')
+    expect(e._cancelled).toBe(false)
+  })
+
 })