mirror of
https://github.com/konvajs/konva.git
synced 2026-01-22 03:11:53 +08:00
better layers width() and height() workflow
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
<script src="unit/Node-test.js"></script>
|
||||
<script src="unit/Container-test.js"></script>
|
||||
<script src="unit/Stage-test.js"></script>
|
||||
<script src="unit/BaseLayer-test.js"></script>
|
||||
<script src="unit/Layer-test.js"></script>
|
||||
<script src="unit/Group-test.js"></script>
|
||||
<script src="unit/FastLayer-test.js"></script>
|
||||
|
||||
25
test/unit/BaseLayer-test.js
Normal file
25
test/unit/BaseLayer-test.js
Normal file
@@ -0,0 +1,25 @@
|
||||
suite('BaseLayer', function() {
|
||||
|
||||
// ======================================================
|
||||
test.only('width and height', function() {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Kinetic.FastLayer();
|
||||
assert.equal(layer.width(), undefined, 'while layer is not on stage width is undefined');
|
||||
assert.equal(layer.height(), undefined, 'while layer is not on stage height is undefined');
|
||||
|
||||
layer.width(10);
|
||||
assert.equal(layer.width(), undefined, 'while layer is not on stage changing width doing nothing');
|
||||
layer.height(10);
|
||||
assert.equal(layer.height(), undefined, 'while layer is not on stage changing height doing nothing');
|
||||
stage.add(layer);
|
||||
|
||||
assert.equal(layer.width(), stage.width(), 'while layer is on stage width is stage`s width');
|
||||
assert.equal(layer.height(), stage.height(), 'while layer is on stage height is stage`s height');
|
||||
|
||||
layer.width(10);
|
||||
assert.equal(layer.width(), stage.width(), 'while layer is on stage changing width doing nothing');
|
||||
layer.height(10);
|
||||
assert.equal(layer.height(), stage.height(), 'while layer is on stage changing height doing nothing');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user