UNPKG

kentico-cloud-delivery

Version:

Official Kentico Cloud Delivery SDK

43 lines 1.69 kB
"use strict"; exports.__esModule = true; var lib_1 = require("../../../lib"); describe('MultipleChoiceField', function () { var multipleChoiceValue = [ { 'name': 'Action', 'codename': 'action' }, { 'name': 'Drama', 'codename': 'drama' } ]; var field = new lib_1.Fields.MultipleChoiceField('name', multipleChoiceValue); var fieldWithNoValue = new lib_1.Fields.MultipleChoiceField('name', null); it("checks name", function () { expect(field.name).toEqual(field.name); }); it("checks value", function () { expect(field.value).toEqual(multipleChoiceValue); }); it("checks that options are defined", function () { expect(field.options).toBeDefined(); }); it("checks that correct number of options are created", function () { expect(field.options.length).toEqual(2); }); it("checks that options are of 'MultipleChoiceOption' type", function () { expect(field.options[0]).toEqual(jasmine.any(lib_1.FieldModels.MultipleChoiceOption)); }); it("checks name of the option", function () { expect(field.options[0].name).toEqual(multipleChoiceValue[0].name); }); it("checks codename of option", function () { expect(field.options[0].codename).toEqual(multipleChoiceValue[0].codename); }); it("checks that value contains empty array when no value was provided", function () { expect(fieldWithNoValue.options).toBeDefined(); expect(fieldWithNoValue.options.length).toEqual(0); }); }); //# sourceMappingURL=multiple-choice.spec.js.map