Skip to content

Commit

Permalink
tests to prove that the field group component is NOT showing a * indi…
Browse files Browse the repository at this point in the history
…cator #2766
  • Loading branch information
Josh Pollock committed Nov 19, 2018
1 parent 71cc344 commit 9e33d6d
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion clients/tests/unit/render/CalderaFormsFieldGroup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import {CalderaFormsFieldGroup} from "../../../render/components";
import renderer from 'react-test-renderer';
const handler = () => {
};
import {shallow, mount} from 'enzyme';
import EnzymeAdapter from '../createEnzymeAdapter'


describe('CalderaFormsFieldGroup component', () => {
const fieldIdAttr = 'fld_5843941_1';
const fieldConfig = {
Expand Down Expand Up @@ -186,4 +190,33 @@ describe('chooses inner field', () => {
expect(testInstance.findByType('div').props.className).toBe('form-group cf2-field-group');
});

})
});

describe( 'DOM testing of CalderaFormsFieldGroup component', () => {
const textFieldConfig = {
fieldCaption: "",
fieldDefault: "new default",
fieldId: "cf2-fdl1",
fieldIdAttr: "fdl1_1",
fieldLabel: "Text 2 Field",
fieldPlaceHolder: "",
fieldValue: "",
outterIdAttr: "cf2-fdl1_1",
required: false,
type: "text",
isRequired: true
};

it('Shows required indicator when it should', () => {
const component = mount(<CalderaFormsFieldGroup
onChange={handler}
field={textFieldConfig}
shouldDisable={true}
getFieldConfig={() => {}}
/>);

expect(component.contains('*')).toBe(true);
expect(component.find('.field_required').length).toBe(1);

});
});

0 comments on commit 9e33d6d

Please sign in to comment.