Newer
Older
pixi.js / packages / mixin-get-child-by-name / test / index.js
@Matt Karl Matt Karl on 31 Oct 2017 848 bytes Next Restructure for v5 (#4387)
const { DisplayObject, Container } = require('@pixi/display');

require('../');

describe('PIXI.DisplayObject#name', function ()
{
    it('should contain property', function ()
    {
        const obj = new DisplayObject();

        expect(obj.name).to.be.not.undefined;
        expect(obj.name).to.be.null;
    });
});

describe('PIXI.Container#getChildByName', function ()
{
    it('should exist', function ()
    {
        const parent = new Container();

        expect(parent.getChildByName).to.be.not.undefined;
        expect(parent.getChildByName).to.be.function;
    });

    it('should enable getChildByName', function ()
    {
        const obj = new DisplayObject();
        const parent = new Container();

        obj.name = 'foo';
        parent.addChild(obj);
        expect(parent.getChildByName('foo')).to.equal(obj);
    });
});