"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const component_1 = require("../../client/component");
const componentClassFromSpec_1 = require("../../client/componentClassFromSpec");
const parentElement_1 = require("../../client/platform/web/parentElement");
const Component_1 = __importDefault(require("../../system/platform/component/Div/Component"));
const assert_1 = require("../../util/assert");
const system_1 = require("../util/system");
const RandomColorBoxSpec = require('../../system/platform/core/component/RandomColorBox/spec.json');
const RandomColorBox = (0, componentClassFromSpec_1.componentClassFromSpec)(RandomColorBoxSpec, system_1.system.specs);
const root = new Component_1.default({}, system_1.system);
const parentA = new component_1.Component({}, system_1.system, (0, parentElement_1.parentElement)(system_1.system));
const parentB = new component_1.Component({}, system_1.system, (0, parentElement_1.parentElement)(system_1.system));
const A = new RandomColorBox({}, system_1.system);
const B = new RandomColorBox({}, system_1.system);
const C = new RandomColorBox({}, system_1.system);
const BBox = B.pathGetSubComponent(['box']);
const CBox = C.pathGetSubComponent(['box']);
const ADiv = A.pathGetSubComponent(['box', 'div']);
const BDiv = B.pathGetSubComponent(['box', 'div']);
const CDiv = C.pathGetSubComponent(['box', 'div']);
parentA.registerRoot(A);
parentA.$slot['default'] = A;
A.registerParentRoot(B);
A.registerParentRoot(C);
parentB.registerRoot(parentA);
parentB.$slot['default'] = parentA;
root.appendChild(parentB);
assert_1.assert.equal(BDiv.$parent, BBox);
assert_1.assert.equal(CDiv.$parent, CBox);
assert_1.assert.equal(BDiv.$rootParent, null);
assert_1.assert.equal(CDiv.$rootParent, null);
assert_1.assert.equal(B.$rootParent, ADiv);
assert_1.assert.equal(C.$rootParent, ADiv);
assert_1.assert.equal(BDiv.$domParent, ADiv);
assert_1.assert.equal(CDiv.$domParent, ADiv);
assert_1.assert.equal(A.$parentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$parentRoot.indexOf(C), 1);
assert_1.assert.equal(A.$mountParentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$mountParentRoot.indexOf(C), 1);
assert_1.assert.equal(BDiv.$slotParent, BBox);
assert_1.assert.equal(CDiv.$slotParent, CBox);
A.removeParentRoot(B);
A.removeParentRoot(C);
A.appendParentRoot(B, 'default');
A.appendParentRoot(C, 'default');
assert_1.assert.equal(BDiv.$parent, BBox);
assert_1.assert.equal(CDiv.$parent, CBox);
assert_1.assert.equal(BDiv.$rootParent, null);
assert_1.assert.equal(CDiv.$rootParent, null);
assert_1.assert.equal(B.$rootParent, ADiv);
assert_1.assert.equal(C.$rootParent, ADiv);
assert_1.assert.equal(BDiv.$domParent, ADiv);
assert_1.assert.equal(CDiv.$domParent, ADiv);
assert_1.assert.equal(A.$parentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$parentRoot.indexOf(C), 1);
assert_1.assert.equal(A.$mountParentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$mountParentRoot.indexOf(C), 1);
assert_1.assert.equal(BDiv.$slotParent, BBox);
assert_1.assert.equal(CDiv.$slotParent, CBox);
parentA.removeRoot(A);
parentA.appendRoot(A);
assert_1.assert.equal(BDiv.$parent, BBox);
assert_1.assert.equal(CDiv.$parent, CBox);
assert_1.assert.equal(BDiv.$rootParent, null);
assert_1.assert.equal(CDiv.$rootParent, null);
assert_1.assert.equal(B.$rootParent, ADiv);
assert_1.assert.equal(C.$rootParent, ADiv);
assert_1.assert.equal(BDiv.$domParent, ADiv);
assert_1.assert.equal(CDiv.$domParent, ADiv);
assert_1.assert.equal(A.$parentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$parentRoot.indexOf(C), 1);
assert_1.assert.equal(A.$mountParentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$mountParentRoot.indexOf(C), 1);
assert_1.assert.equal(BDiv.$slotParent, BBox);
assert_1.assert.equal(CDiv.$slotParent, CBox);
parentB.removeRoot(parentA);
parentB.appendRoot(parentA);
assert_1.assert.equal(BDiv.$parent, BBox);
assert_1.assert.equal(CDiv.$parent, CBox);
assert_1.assert.equal(BDiv.$rootParent, null);
assert_1.assert.equal(CDiv.$rootParent, null);
assert_1.assert.equal(B.$rootParent, ADiv);
assert_1.assert.equal(C.$rootParent, ADiv);
assert_1.assert.equal(BDiv.$domParent, ADiv);
assert_1.assert.equal(CDiv.$domParent, ADiv);
assert_1.assert.equal(A.$parentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$parentRoot.indexOf(C), 1);
assert_1.assert.equal(A.$mountParentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$mountParentRoot.indexOf(C), 1);
assert_1.assert.equal(BDiv.$slotParent, BBox);
assert_1.assert.equal(CDiv.$slotParent, CBox);
assert_1.assert.equal(A.$slotParent, parentA);
parentB.removeRoot(parentA);
parentB.appendRoot(parentA);
assert_1.assert.equal(BDiv.$parent, BBox);
assert_1.assert.equal(CDiv.$parent, CBox);
assert_1.assert.equal(BDiv.$rootParent, null);
assert_1.assert.equal(CDiv.$rootParent, null);
assert_1.assert.equal(B.$rootParent, ADiv);
assert_1.assert.equal(C.$rootParent, ADiv);
assert_1.assert.equal(BDiv.$domParent, ADiv);
assert_1.assert.equal(CDiv.$domParent, ADiv);
assert_1.assert.equal(A.$parentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$parentRoot.indexOf(C), 1);
assert_1.assert.equal(A.$mountParentRoot.indexOf(B), 0);
assert_1.assert.equal(A.$mountParentRoot.indexOf(C), 1);
assert_1.assert.equal(BDiv.$slotParent, BBox);
assert_1.assert.equal(CDiv.$slotParent, CBox);
assert_1.assert.equal(A.$slotParent, parentA);
//# sourceMappingURL=composition.js.map