"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const createParent_1 = require("../../client/createParent");
const Component_1 = __importDefault(require("../../system/platform/component/Div/Component"));
const assert_1 = require("../../util/assert");
const system_1 = require("../util/system");
const root = new Component_1.default({}, system_1.system);
const parent = (0, createParent_1.parentComponent)({}, system_1.system);
const parentA = (0, createParent_1.parentComponent)({}, system_1.system);
const parentB = (0, createParent_1.parentComponent)({}, system_1.system);
const parentC = (0, createParent_1.parentComponent)({}, system_1.system);
const A = new Component_1.default({}, system_1.system);
const B = new Component_1.default({}, system_1.system);
const C = new Component_1.default({}, system_1.system);
const D = new Component_1.default({}, system_1.system);
const E = new Component_1.default({}, system_1.system);
parentA.setSubComponent('A', A);
parentA.registerRoot(A);
parentB.setSubComponent('B', B);
parentB.setSubComponent('C', C);
parentB.registerRoot(B);
parentB.registerRoot(C);
parentC.setSubComponent('D', D);
parentC.registerRoot(D);
parent.setSubComponent('parentA', parentA);
parent.setSubComponent('parentB', parentB);
parent.setSubComponent('parentC', parentC);
parent.registerRoot(parentA);
parent.registerRoot(parentB);
parent.registerRoot(parentC);
root.appendChild(parent);
let leaves;
leaves = parent.getRootLeaves();
assert_1.assert.equal(leaves[0], A);
assert_1.assert.equal(leaves[1], B);
assert_1.assert.equal(leaves[2], C);
assert_1.assert.equal(leaves[3], D);
assert_1.assert.equal(root.$domChildren[0], A);
assert_1.assert.equal(root.$domChildren[1], B);
assert_1.assert.equal(root.$domChildren[2], C);
assert_1.assert.equal(root.$domChildren[3], D);
parentB.setSubComponent('E', E);
parentB.registerRoot(E);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], A);
assert_1.assert.equal(root.$domChildren[1], B);
assert_1.assert.equal(root.$domChildren[2], C);
assert_1.assert.equal(root.$domChildren[3], E);
assert_1.assert.equal(root.$domChildren[4], D);
parentB.removeSubComponent('C');
parentB.unregisterRoot(C);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], A);
assert_1.assert.equal(root.$domChildren[1], B);
assert_1.assert.equal(root.$domChildren[2], E);
assert_1.assert.equal(root.$domChildren[3], D);
parent.removeSubComponent('parentB');
parent.unregisterRoot(parentB);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], A);
assert_1.assert.equal(root.$domChildren[1], D);
parent.setSubComponent('parentB', parentB);
parent.registerRoot(parentB, 1);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], A);
assert_1.assert.equal(root.$domChildren[1], B);
assert_1.assert.equal(root.$domChildren[2], E);
assert_1.assert.equal(root.$domChildren[3], D);
parent.removeSubComponent('parentA');
parent.unregisterRoot(parentA);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], B);
assert_1.assert.equal(root.$domChildren[1], E);
assert_1.assert.equal(root.$domChildren[2], D);
parent.setSubComponent('parentA', parentA);
parent.registerRoot(parentA, 0);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], A);
assert_1.assert.equal(root.$domChildren[1], B);
assert_1.assert.equal(root.$domChildren[2], E);
assert_1.assert.equal(root.$domChildren[3], D);
parent.reorderSubComponent(null, 'parentB', 0);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], B);
assert_1.assert.equal(root.$domChildren[1], E);
assert_1.assert.equal(root.$domChildren[2], A);
assert_1.assert.equal(root.$domChildren[3], D);
parentB.setSubComponent('C', C);
parentB.registerRoot(C, 1);
leaves = parent.getRootLeaves();
assert_1.assert.equal(root.$domChildren[0], B);
assert_1.assert.equal(root.$domChildren[1], C);
assert_1.assert.equal(root.$domChildren[2], E);
assert_1.assert.equal(root.$domChildren[3], A);
assert_1.assert.equal(root.$domChildren[4], D);
//# sourceMappingURL=composition0.js.map