mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
New Arrow shape ⤵️
This commit is contained in:
38
test/unit/plugins/Arrow-test.js
Normal file
38
test/unit/plugins/Arrow-test.js
Normal file
@@ -0,0 +1,38 @@
|
||||
suite('Arrow', function() {
|
||||
// ======================================================
|
||||
test('add arrow', function() {
|
||||
var stage = addStage();
|
||||
var layer = new Kinetic.Layer();
|
||||
|
||||
var arrow = new Kinetic.Arrow({
|
||||
points: [73,160, 340, 23],
|
||||
stroke: 'blue',
|
||||
fill : 'blue',
|
||||
strokeWidth: 1,
|
||||
draggable: true,
|
||||
tension: 0
|
||||
});
|
||||
|
||||
layer.add(arrow);
|
||||
stage.add(layer);
|
||||
|
||||
arrow.setPoints([1, 2, 3, 4]);
|
||||
assert.equal(arrow.points()[0], 1);
|
||||
|
||||
arrow.setPoints([5,6,7,8]);
|
||||
assert.equal(arrow.getPoints()[0], 5);
|
||||
arrow.setPoints([73, 160, 340, 23, 50,100, 80, 50]);
|
||||
arrow.tension(0);
|
||||
|
||||
arrow.pointerLength(15);
|
||||
assert.equal(arrow.pointerLength(), 15);
|
||||
|
||||
arrow.pointerWidth(15);
|
||||
assert.equal(arrow.pointerWidth(), 15);
|
||||
|
||||
assert.equal(arrow.getClassName(), 'Arrow');
|
||||
|
||||
layer.draw();
|
||||
showHit(layer);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user