@antv/x6
Version:
JavaScript diagramming library that uses SVG and HTML for rendering.
34 lines • 1.02 kB
JavaScript
import { applyMixins } from './mixins';
describe('Ojbect', () => {
describe('applyMixins', () => {
class Disposable {
dispose() {
this.isDisposed = true;
}
}
class Activatable {
activate() {
this.isActive = true;
}
deactivate() {
this.isActive = false;
}
}
class SmartObject {
interact() {
this.activate();
this.dispose();
}
}
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();
});
});
});
//# sourceMappingURL=mixins.test.js.map