2021-09-22 23:14:38 +08:00
|
|
|
function equal(val1, val2, message) {
|
|
|
|
if (val1 !== val2) {
|
|
|
|
throw new Error('Not passed: ' + message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// try to import only core
|
2022-05-05 05:04:16 +08:00
|
|
|
import Konva from 'konva';
|
2021-09-22 23:14:38 +08:00
|
|
|
|
|
|
|
// no external shapes
|
|
|
|
// equal(Konva.Rect, undefined, 'no external shapes');
|
|
|
|
|
2022-05-05 05:04:16 +08:00
|
|
|
import { Rect } from 'konva/lib/shapes/Rect';
|
2021-09-22 23:14:38 +08:00
|
|
|
|
|
|
|
equal(Rect !== undefined, true, 'Rect is defined');
|
|
|
|
|
|
|
|
equal(Konva.Rect, Rect, 'Rect is injected');
|
|
|
|
|
2022-05-05 05:04:16 +08:00
|
|
|
import Konva2 from 'konva';
|
2021-09-22 23:14:38 +08:00
|
|
|
|
|
|
|
equal(Konva2.Rect, Rect, 'Rect is injected');
|
|
|
|
|
|
|
|
equal(Konva2, Konva, 'Same Konva');
|
|
|
|
|
|
|
|
// just do a simple action
|
|
|
|
const stage = new Konva.Stage();
|
|
|
|
stage.toDataURL();
|