mirror of
https://github.com/cocos/cocos-engine.git
synced 2026-09-07 00:02:53 +08:00
* unit test for ts * Fix ts-jest warnings * Remove puppeteer for now * fix physics define and jest config for windows * Replace Node ref with INode ref * Fix ci issue * Fix * tweak * tweak * Fix vscode launcher * now physics framework export all physics component (#28) * tweaks
29 lines
838 B
JavaScript
29 lines
838 B
JavaScript
module('cc.Widget', SetupEngine);
|
|
|
|
test('updateAlignment', function () {
|
|
var scene = cc.director.getScene();
|
|
var dummyCanvas = new cc.Node();
|
|
dummyCanvas.width = 960;
|
|
dummyCanvas.parent = scene;
|
|
|
|
var parent = new cc.Node();
|
|
var parentWidget = parent.addComponent(cc.Widget);
|
|
parent.parent = dummyCanvas;
|
|
|
|
var child = new cc.Node();
|
|
var childWidget = child.addComponent(cc.Widget);
|
|
child.parent = parent;
|
|
|
|
parentWidget.isAlignLeft = true;
|
|
parentWidget.isAlignRight = true;
|
|
parentWidget.left = 0;
|
|
parentWidget.right = 0;
|
|
childWidget.isAlignLeft = true;
|
|
childWidget.isAlignRight = true;
|
|
childWidget.left = 0;
|
|
childWidget.right = 0;
|
|
|
|
childWidget.updateAlignment();
|
|
strictEqual(child.width, 960, 'child size should be updated even if parent size also diry');
|
|
});
|