mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
formatting
This commit is contained in:
@@ -5218,7 +5218,11 @@ describe('Transformer', function () {
|
|||||||
|
|
||||||
var back = tr.findOne('.back');
|
var back = tr.findOne('.back');
|
||||||
assert.notEqual(back, null, 'Back shape should exist');
|
assert.notEqual(back, null, 'Back shape should exist');
|
||||||
assert.equal(back!.draggable(), false, 'Back should not be draggable when node is not draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
false,
|
||||||
|
'Back should not be draggable when node is not draggable'
|
||||||
|
);
|
||||||
|
|
||||||
// Try to drag via back area - should not move
|
// Try to drag via back area - should not move
|
||||||
var initialX = rect.x();
|
var initialX = rect.x();
|
||||||
@@ -5237,8 +5241,16 @@ describe('Transformer', function () {
|
|||||||
y: 85,
|
y: 85,
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(rect.x(), initialX, 'Rect should not move when dragging back area of non-draggable node');
|
assert.equal(
|
||||||
assert.equal(rect.y(), initialY, 'Rect should not move when dragging back area of non-draggable node');
|
rect.x(),
|
||||||
|
initialX,
|
||||||
|
'Rect should not move when dragging back area of non-draggable node'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
rect.y(),
|
||||||
|
initialY,
|
||||||
|
'Rect should not move when dragging back area of non-draggable node'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should be draggable via back area when at least one attached node is draggable', function () {
|
it('should be draggable via back area when at least one attached node is draggable', function () {
|
||||||
@@ -5275,7 +5287,11 @@ describe('Transformer', function () {
|
|||||||
|
|
||||||
var back = tr.findOne('.back');
|
var back = tr.findOne('.back');
|
||||||
assert.notEqual(back, null, 'Back shape should exist');
|
assert.notEqual(back, null, 'Back shape should exist');
|
||||||
assert.equal(back!.draggable(), true, 'Back should be draggable when at least one node is draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
true,
|
||||||
|
'Back should be draggable when at least one node is draggable'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update back draggable when node draggable property changes', function () {
|
it('should update back draggable when node draggable property changes', function () {
|
||||||
@@ -5306,11 +5322,19 @@ describe('Transformer', function () {
|
|||||||
|
|
||||||
// Change node to non-draggable
|
// Change node to non-draggable
|
||||||
rect.draggable(false);
|
rect.draggable(false);
|
||||||
assert.equal(back!.draggable(), false, 'Back should become non-draggable when node becomes non-draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
false,
|
||||||
|
'Back should become non-draggable when node becomes non-draggable'
|
||||||
|
);
|
||||||
|
|
||||||
// Change back to draggable
|
// Change back to draggable
|
||||||
rect.draggable(true);
|
rect.draggable(true);
|
||||||
assert.equal(back!.draggable(), true, 'Back should become draggable when node becomes draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
true,
|
||||||
|
'Back should become draggable when node becomes draggable'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle mixed draggable states correctly', function () {
|
it('should handle mixed draggable states correctly', function () {
|
||||||
@@ -5347,14 +5371,26 @@ describe('Transformer', function () {
|
|||||||
|
|
||||||
var back = tr.findOne('.back');
|
var back = tr.findOne('.back');
|
||||||
assert.notEqual(back, null, 'Back shape should exist');
|
assert.notEqual(back, null, 'Back shape should exist');
|
||||||
assert.equal(back!.draggable(), true, 'Back should be draggable when at least one node is draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
true,
|
||||||
|
'Back should be draggable when at least one node is draggable'
|
||||||
|
);
|
||||||
|
|
||||||
// Make both non-draggable
|
// Make both non-draggable
|
||||||
rect1.draggable(false);
|
rect1.draggable(false);
|
||||||
assert.equal(back!.draggable(), false, 'Back should be non-draggable when all nodes are non-draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
false,
|
||||||
|
'Back should be non-draggable when all nodes are non-draggable'
|
||||||
|
);
|
||||||
|
|
||||||
// Make one draggable again
|
// Make one draggable again
|
||||||
rect2.draggable(true);
|
rect2.draggable(true);
|
||||||
assert.equal(back!.draggable(), true, 'Back should be draggable when at least one node is draggable');
|
assert.equal(
|
||||||
|
back!.draggable(),
|
||||||
|
true,
|
||||||
|
'Back should be draggable when at least one node is draggable'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user