"use strict";
/**
 * Test case for DefaultFieldStyler
 *
 *  Copyright (C) 2010-2019 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 DefaultFieldStyler_1 = require("../../../../src/ui/context/styler/DefaultFieldStyler");
var chai_1 = require("chai");
before(function () {
    this.jsdom = require('jsdom-global')();
});
after(function () {
    this.jsdom();
});
describe('DefaultFieldStyler', function () {
    [
        {
            label: 'setValue sets value for input field when id is found',
            field_name: 'foo',
            index: 0,
            value: 'bar',
            html_content: '<input type="text" id="q_foo_0" data-field-name="foo">',
        },
        {
            label: 'setValue sets value for input field when id is not found',
            field_name: 'baz_qux',
            index: 5,
            value: 'true',
            html_content: '<input type="text" id="q_foobar_bq34w" data-field-name="baz_qux">',
        },
    ].forEach(function (_a) {
        var label = _a.label, field_name = _a.field_name, index = _a.index, value = _a.value, html_content = _a.html_content;
        it(label, function () {
            var content = document.createElement('dd');
            content.innerHTML = html_content;
            var sut = new DefaultFieldStyler_1.DefaultFieldStyler(field_name, index);
            sut.setValue(content, value);
            var element = content.querySelector('input');
            chai_1.expect(element === null || element === void 0 ? void 0 : element.value).to.equal(value);
        });
    });
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGVmYXVsdEZpZWxkU3R5bGVyVGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkRlZmF1bHRGaWVsZFN0eWxlclRlc3QudHMiXSwib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