import {EventEmitter, MixinOf} from '@avocado/composition' import {Vector} from '@avocado/math' describe 'Vector.Mixin', -> O = null spy = null beforeEach -> O = new class extends MixinOf( EventEmitter Vector.Mixin() ) spy = jasmine.createSpy 'listener' it 'can detect changes', -> O.on 'xChanged', spy O.on 'yChanged', spy O.on 'vectorChanged', spy O.setVector [20, 20] expect(spy.callCount).toEqual 3 it 'can detect changes in the correct order', -> accum = 300 O.on 'xChanged yChanged', -> accum /= 10 O.on 'vectorChanged', -> accum += 200 O.setVector [20, 20] expect(accum).toEqual 203