mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
1380e46c34
* 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
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
module('cc.find', SetupEngine);
|
|
|
|
test('test', function () {
|
|
var scene = cc.director.getScene();
|
|
|
|
var node = new cc.Node('');
|
|
scene.addChild(node);
|
|
|
|
ok(cc.find('/') === node, 'should found, empty name, path starts with sep');
|
|
ok(cc.find('') === node, 'should found, empty name');
|
|
|
|
var node2 = new cc.Node('.赞');
|
|
scene.addChild(node2);
|
|
ok(cc.find('/.赞') === node2, 'should found, Chinese name, path starts with sep');
|
|
ok(cc.find('.赞') === node2, 'should found, Chinese name');
|
|
|
|
var nodenode = new cc.Node('');
|
|
node.addChild(nodenode);
|
|
ok(cc.find('//') === nodenode, 'should found, empty name * 2');
|
|
ok(cc.find('/', node) === nodenode, 'should found by reference node, empty name * 2');
|
|
|
|
var node2node2 = new cc.Node('Jare Guo');
|
|
node2.addChild(node2node2);
|
|
ok(cc.find('/.赞/Jare Guo') === node2node2, 'should found, name contains space, path starts with sep');
|
|
ok(cc.find('.赞/Jare Guo') === node2node2, 'should found, name contains space');
|
|
ok(cc.find('Jare Guo', node2) === node2node2, 'should found by reference node, name contains space');
|
|
|
|
var ent2ent2ent2 = new cc.Node('FOO');
|
|
node2node2.addChild(ent2ent2ent2);
|
|
ok(cc.find('Jare Guo/FOO', node2) === ent2ent2ent2, 'should found by reference node');
|
|
});
|