var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
define(["require", "exports", "wed/transformation", "../base-config", "../wed-test-util"], function (require, exports, transformation, globalConfig, wed_test_util_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    transformation = __importStar(transformation);
    globalConfig = __importStar(globalConfig);
    const assert = chai.assert;
    describe("transformation", () => {
        let setup;
        let editor;
        before(() => {
            setup = new wed_test_util_1.EditorSetup(`${wed_test_util_1.dataPath}/wed_test_data/source_converted.xml`, globalConfig.config, document);
            ({ editor } = setup);
            return setup.init();
        });
        afterEach(() => {
            setup.reset();
        });
        after(() => {
            setup.restore();
            // tslint:disable-next-line:no-any
            editor = undefined;
        });
        describe("swapWithPreviousHomogeneousSibling", () => {
            it("swaps", () => {
                const ps = editor.dataRoot.querySelectorAll("body>p");
                transformation.swapWithPreviousHomogeneousSibling(editor, ps[1]);
                const ps2 = editor.dataRoot.querySelectorAll("body>p");
                assert.equal(ps[0], ps2[1]);
                assert.equal(ps2[1], ps[0]);
            });
            it("does nothing if the element is the first child", () => {
                const ps = editor.dataRoot.querySelectorAll("publicationStmt>p");
                transformation.swapWithPreviousHomogeneousSibling(editor, ps[0]);
                const ps2 = editor.dataRoot.querySelectorAll("publicationStmt>p");
                assert.equal(ps[0], ps2[0]);
            });
            it("does nothing if the previous element is not homogeneous", () => {
                const divs = editor.dataRoot.querySelectorAll("body>div");
                transformation.swapWithPreviousHomogeneousSibling(editor, divs[0]);
                const divs2 = editor.dataRoot.querySelectorAll("body>div");
                assert.equal(divs[0].previousSibling, divs2[0].previousSibling);
            });
        });
        describe("swapWithNextHomogeneousSibling", () => {
            it("swaps", () => {
                const ps = editor.dataRoot.querySelectorAll("body>p");
                transformation.swapWithNextHomogeneousSibling(editor, ps[0]);
                const ps2 = editor.dataRoot.querySelectorAll("body>p");
                assert.equal(ps[0], ps2[1]);
                assert.equal(ps2[1], ps[0]);
            });
            it("does nothing if the element is the last child", () => {
                const ps = editor.dataRoot.querySelectorAll("publicationStmt>p");
                transformation.swapWithNextHomogeneousSibling(editor, ps[ps.length - 1]);
                const ps2 = editor.dataRoot.querySelectorAll("publicationStmt>p");
                assert.equal(ps[ps.length - 1], ps2[ps.length - 1]);
            });
            it("does nothing if the next element is not homogeneous", () => {
                const divs = editor.dataRoot.querySelectorAll("body>div");
                transformation.swapWithNextHomogeneousSibling(editor, divs[0]);
                const divs2 = editor.dataRoot.querySelectorAll("body>div");
                assert.equal(divs[0].previousSibling, divs2[0].previousSibling);
            });
        });
    });
});
//  LocalWords:  chai xml publicationStmt previousSibling Dubeau MPL Mangalam
//# sourceMappingURL=transformation-test.js.map