"use strict";
/**
 * Test case for FieldStylerFactory
 *
 *  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 FieldStylerFactory_1 = require("../../../../src/ui/context/styler/FieldStylerFactory");
var DefaultFieldStyler_1 = require("../../../../src/ui/context/styler/DefaultFieldStyler");
var CheckboxFieldStyler_1 = require("../../../../src/ui/context/styler/CheckboxFieldStyler");
var DisplayFieldStyler_1 = require("../../../../src/ui/context/styler/DisplayFieldStyler");
var chai_1 = require("chai");
describe('FieldStylerFactory', function () {
    [
        {
            label: 'creates new DefaultFieldStyler',
            field_name: 'baz',
            qtypes: { baz: { type: 'text', dim: 0 } },
            expected: DefaultFieldStyler_1.DefaultFieldStyler,
        },
        {
            label: 'creates new DefaultFieldStyler for static without qtype',
            field_name: 'foo-label',
            qtypes: { baz: { type: 'text', dim: 0 } },
            expected: DefaultFieldStyler_1.DefaultFieldStyler,
        },
        {
            label: 'creates new CheckboxFieldStyler for legacyradio type',
            field_name: 'baz',
            qtypes: { baz: { type: 'legacyradio', dim: 0 } },
            expected: CheckboxFieldStyler_1.CheckboxFieldStyler,
        },
        {
            label: 'creates new CheckboxFieldStyler for radio question type',
            field_name: 'baz',
            qtypes: { baz: { type: 'radio', dim: 0 } },
            expected: CheckboxFieldStyler_1.CheckboxFieldStyler,
        },
        {
            label: 'creates new CheckboxFieldStyler for noyes question type',
            field_name: 'baz',
            qtypes: { baz: { type: 'noyes', dim: 0 } },
            expected: CheckboxFieldStyler_1.CheckboxFieldStyler,
        },
        {
            label: 'creates new CheckboxFieldStyler for checkbox question type',
            field_name: 'baz',
            qtypes: { baz: { type: 'checkbox', dim: 0 } },
            expected: CheckboxFieldStyler_1.CheckboxFieldStyler,
        },
        {
            label: 'creates new CheckboxFieldStyler for radio with deprecated qtypes structure',
            field_name: 'baz',
            qtypes: { baz: 'radio' },
            expected: CheckboxFieldStyler_1.CheckboxFieldStyler,
        },
        {
            label: 'creates new DefaultFieldStyler for currency with deprecated qtypes structure',
            field_name: 'baz',
            qtypes: { baz: 'currency' },
            expected: DefaultFieldStyler_1.DefaultFieldStyler,
        },
    ].forEach(function (_a) {
        var label = _a.label, field_name = _a.field_name, qtypes = _a.qtypes, expected = _a.expected;
        it(label, function () {
            var styler = {};
            var arefs = { foo: 'bar', qux: 'boo' };
            var sut = new FieldStylerFactory_1.FieldStylerFactory(qtypes, arefs, styler);
            var given = sut.create(field_name, 0);
            chai_1.expect(given).to.be.instanceOf(expected);
        });
    });
    it('creates new DisplayFieldStyler for display/answer type', function () {
        var styler = {};
        var qtype = {};
        var aref = { baz: 'bar' };
        var sut = new FieldStylerFactory_1.FieldStylerFactory(qtype, aref, styler);
        var given = sut.create('baz', 0);
        chai_1.expect(given).to.be.instanceOf(DisplayFieldStyler_1.DisplayFieldStyler);
    });
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRmllbGRTdHlsZXJGYWN0b3J5VGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIkZpZWxkU3R5bGVyRmFjdG9yeVRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBbUJHOztBQUVILDJGQUErRjtBQUUvRiwyRkFBd0Y7QUFDeEYsNkZBQTBGO0FBQzFGLDJGQUF3RjtBQUd4Riw2QkFBNEI7QUFFNUIsUUFBU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