Skip to content

Commit

Permalink
chore: update viewer component test label checks
Browse files Browse the repository at this point in the history
Related to #1291
  • Loading branch information
Skaiir committed Oct 14, 2024
1 parent ad13f8a commit 9ca3465
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('Button', function () {
// assume
const { config } = Button;
expect(config.type).to.eql('button');
expect(config.label).to.eql('Button');
expect(config.name).to.eql('Button');
expect(config.group).to.eql('action');
expect(config.keyed).to.be.false;

Expand All @@ -115,6 +115,7 @@ describe('Button', function () {

// then
expect(field).to.eql({
label: 'Button',
action: 'submit',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ describe('Checkbox', function () {
// assume
const { config } = Checkbox;
expect(config.type).to.eql('checkbox');
expect(config.label).to.eql('Checkbox');
expect(config.name).to.eql('Checkbox');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

// when
const field = config.create();

// then
expect(field).to.eql({});
expect(field).to.eql({
label: 'Checkbox',
});

// but when
const customField = config.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ describe('Checklist', function () {
// assume
const { config } = Checklist;
expect(config.type).to.eql('checklist');
expect(config.label).to.eql('Checkbox group');
expect(config.name).to.eql('Checkbox group');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

Expand All @@ -423,6 +423,7 @@ describe('Checklist', function () {

// then
expect(field).to.eql({
label: 'Checkbox group',
values: [
{
label: 'Value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,14 +895,30 @@ describe('Datetime', function () {
expect(config.keyed).to.be.true;

// when
const field = config.create();
const field = config.create({}, true);

// then
expect(field).to.eql({
subtype: 'date',
dateLabel: 'Date',
});

// but when
const timeField = config.create({
subtype: 'time',
timeLabel: 'Time',
timeSerializingFormat: 'no_timezone',
timeInterval: 15,
});

// then
expect(timeField).to.eql({
subtype: 'time',
timeLabel: 'Time',
timeSerializingFormat: 'no_timezone',
timeInterval: 15,
});

// but when
const customField = config.create({
custom: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,13 @@ describe('Dynamic List', () => {

// then
expect(config.type).to.eql('dynamiclist');
expect(config.name).to.eql('Dynamic list');
expect(config.repeatable).to.be.true;
expect(config.pathed).to.be.true;

const field = config.create();
expect(field).to.eql({
label: 'Dynamic list',
components: [],
showOutline: true,
isRepeating: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('Group', () => {
// assume
const { config } = Group;
expect(config.type).to.eql('group');
expect(config.label).to.eql('Group');
expect(config.name).to.eql('Group');
expect(config.group).to.eql('container');
expect(config.pathed).to.be.true;

Expand All @@ -112,6 +112,7 @@ describe('Group', () => {

// then
expect(field).to.eql({
label: 'Group',
components: [],
showOutline: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,20 @@ describe('IFrame', function () {
// assume
const { config } = IFrame;
expect(config.type).to.eql('iframe');
expect(config.label).to.eql('iFrame');
expect(config.name).to.eql('iFrame');
expect(config.group).to.eql('container');
expect(config.keyed).to.be.false;

// when
const field = config.create();

// then
expect(field).to.exist;
expect(field).to.eql({
label: 'iFrame',
security: {
allowScripts: true,
},
});

// but when
const customField = config.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ describe('Image', function () {
// assume
const { config } = Image;
expect(config.type).to.eql('image');
expect(config.label).to.eql('Image view');
expect(config.name).to.eql('Image view');
expect(config.group).to.eql('presentation');
expect(config.keyed).to.be.false;

// when
const field = config.create();

// then
expect(field).to.exist;
expect(field).to.eql({});

// but when
const customField = config.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,15 +769,17 @@ describe('Number', function () {
// assume
const { config } = Numberfield;
expect(config.type).to.eql('number');
expect(config.label).to.eql('Number');
expect(config.name).to.eql('Number');
expect(config.group).to.eql('basic-input');
expect(config.keyed).to.be.true;

// when
const field = config.create();

// then
expect(field).to.eql({});
expect(field).to.eql({
label: 'Number',
});

// but when
const customField = config.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ describe('Radio', function () {
// assume
const { config } = Radio;
expect(config.type).to.eql('radio');
expect(config.label).to.eql('Radio group');
expect(config.name).to.eql('Radio group');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

Expand All @@ -281,6 +281,7 @@ describe('Radio', function () {

// then
expect(field).to.eql({
label: 'Radio group',
values: [
{
label: 'Value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ describe('Select', function () {
// assume
const { config } = Select;
expect(config.type).to.eql('select');
expect(config.label).to.eql('Select');
expect(config.name).to.eql('Select');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

Expand All @@ -901,6 +901,7 @@ describe('Select', function () {

// then
expect(field).to.eql({
label: 'Select',
values: [
{
label: 'Value',
Expand All @@ -924,7 +925,7 @@ describe('Select', function () {
// assume
const { config } = Select;
expect(config.type).to.eql('select');
expect(config.label).to.eql('Select');
expect(config.name).to.eql('Select');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

Expand All @@ -950,7 +951,7 @@ describe('Select', function () {
// assume
const { config } = Select;
expect(config.type).to.eql('select');
expect(config.label).to.eql('Select');
expect(config.name).to.eql('Select');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Table } from '../../../../../src/render/components/form-fields/Table';
import { createFormContainer, expectNoViolations } from '../../../../TestHelper';

import { MockFormContext } from '../helper';
import { expect } from 'chai';

let container;

Expand Down Expand Up @@ -433,7 +434,7 @@ describe('Table', function () {
// assume
const { config } = Table;
expect(config.type).to.eql('table');
expect(config.label).to.eql('Table');
expect(config.name).to.eql('Table');
expect(config.group).to.eql('presentation');
expect(config.keyed).to.be.false;

Expand All @@ -442,6 +443,7 @@ describe('Table', function () {

// then
expect(field).to.exist;
expect(field.label).to.eql('Table');

// but when
const customField = config.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ describe('Taglist', function () {
// assume
const { config } = Taglist;
expect(config.type).to.eql('taglist');
expect(config.label).to.eql('Tag list');
expect(config.name).to.eql('Tag list');
expect(config.group).to.eql('selection');
expect(config.keyed).to.be.true;

Expand All @@ -693,6 +693,7 @@ describe('Taglist', function () {

// then
expect(field).to.eql({
label: 'Tag list',
values: [
{
label: 'Value',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Some _em_ **strong** [text](#text) \`code\`.
// assume
const { config } = Text;
expect(config.type).to.eql('text');
expect(config.label).to.eql('Text view');
expect(config.name).to.eql('Text view');
expect(config.group).to.eql('presentation');
expect(config.keyed).to.be.false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,17 @@ describe('Textarea', function () {
// assume
const { config } = Textarea;
expect(config.type).to.eql('textarea');
expect(config.label).to.eql('Text area');
expect(config.name).to.eql('Text area');
expect(config.group).to.eql('basic-input');
expect(config.keyed).to.be.true;

// when
const field = config.create();

// then
expect(field).to.eql({});
expect(field).to.eql({
label: 'Text area',
});

// but when
const customField = config.create({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,17 @@ describe('Textfield', function () {
// assume
const { config } = Textfield;
expect(config.type).to.eql('textfield');
expect(config.label).to.eql('Text field');
expect(config.name).to.eql('Text field');
expect(config.group).to.eql('basic-input');
expect(config.keyed).to.be.true;

// when
const field = config.create();

// then
expect(field).to.eql({});
expect(field).to.eql({
label: 'Text field',
});

// but when
const customField = config.create({
Expand Down

0 comments on commit 9ca3465

Please sign in to comment.