Explorar o código

test for apply emit cancelling

Evan You %!s(int64=12) %!d(string=hai) anos
pai
achega
d7e0230c57
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  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)
+  })
+
 })