UNPKG

@antv/x6

Version:

JavaScript diagramming library that uses SVG and HTML for rendering.

45 lines (36 loc) 919 B
import { applyMixins } from './mixins' describe('Ojbect', () => { describe('applyMixins', () => { class Disposable { isDisposed: boolean dispose() { this.isDisposed = true } } class Activatable { isActive: boolean activate() { this.isActive = true } deactivate() { this.isActive = false } } class SmartObject { interact() { this.activate() this.dispose() } } interface SmartObject extends Disposable, Activatable {} applyMixins(SmartObject, Disposable, Activatable) it('should do the mixing', () => { const smartObj = new SmartObject() expect(smartObj.isDisposed).toBeUndefined() expect(smartObj.isActive).toBeUndefined() smartObj.interact() expect(smartObj.isDisposed).toBeTruthy() expect(smartObj.isActive).toBeTruthy() }) }) })