"use strict";
/**
 *  Test case for ExpandAncestorAwareStyler
 *
 *  Copyright (C) 2010-2020 R-T Specialty, LLC.
 *
 *  This file is part of the Liza Data Collection Framework
 *
 *  Liza is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
Object.defineProperty(exports, "__esModule", { value: true });
var ExpandAncestorAwareStyler_1 = require("../../../src/ui/styler/ExpandAncestorAwareStyler");
var chai_1 = require("chai");
var sinon = require('sinon');
before(function () {
    this.jsdom = require('jsdom-global')();
});
after(function () {
    this.jsdom();
});
describe('ui.styler.ExpandAncestorAwareStyler', function () {
    describe('style', function () {
        it("sets the element's ancestor's margin", function () {
            var container = document.createElement('div');
            container.innerHTML = "<div id=\"ggparent\">\n                    <div id=\"gparent\">\n                        <div id=\"parent\">\n                            <div class=\"foo\">\n                                Foo bar\n                            </div>\n                        </div>\n                    </div>\n                </div>";
            var element = container.querySelector('.foo');
            var ggparent = container.querySelector('#ggparent');
            element.getBoundingClientRect = sinon.stub().returns({ bottom: 100 });
            ggparent.getBoundingClientRect = sinon.stub().returns({ bottom: 25 });
            if (element === null) {
                throw new Error('Unable to find element');
            }
            var sut = new ExpandAncestorAwareStyler_1.ExpandAncestorAwareStyler();
            sut.style(element, 3);
            chai_1.expect(ggparent.style.marginBottom).to.equal('75px');
        });
    });
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRXhwYW5kQW5jZXN0b3JBd2FyZVN0eWxlclRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJFeHBhbmRBbmNlc3RvckF3YX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