mirror of
https://github.com/konvajs/konva.git
synced 2026-01-22 21:02:26 +08:00
refactor tests
This commit is contained in:
48
test/unit/Group-test.ts
Normal file
48
test/unit/Group-test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { addStage, cloneAndCompareLayer, Konva } from './utis';
|
||||
|
||||
describe('Group', function () {
|
||||
// ======================================================
|
||||
it('cache group with text', function () {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Konva.Layer();
|
||||
var group = new Konva.Group({
|
||||
draggable: true,
|
||||
x: 50,
|
||||
y: 40,
|
||||
});
|
||||
var text = new Konva.Text({
|
||||
text: 'some text',
|
||||
fontSize: 20,
|
||||
fill: 'black',
|
||||
y: 50,
|
||||
});
|
||||
|
||||
var rect = new Konva.Rect({
|
||||
height: 100,
|
||||
width: 100,
|
||||
stroke: 'black',
|
||||
strokeWidth: 10,
|
||||
// cornerRadius: 1,
|
||||
});
|
||||
group.add(text);
|
||||
group.add(rect);
|
||||
layer.add(group);
|
||||
|
||||
stage.add(layer);
|
||||
|
||||
group
|
||||
.cache({
|
||||
x: -15,
|
||||
y: -15,
|
||||
width: 150,
|
||||
height: 150,
|
||||
})
|
||||
.offsetX(5)
|
||||
.offsetY(5);
|
||||
|
||||
layer.draw();
|
||||
|
||||
cloneAndCompareLayer(layer, 200);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user