Skip to content

Commit

Permalink
New Form and FormUnit. Remove GridForm, FormRow and FormCol [#159416165]
Browse files Browse the repository at this point in the history
Signed-off-by: Reid Mitchell <rmitchell@pivotal.io>
  • Loading branch information
Ming Xiao authored and reidmit committed Aug 9, 2018
1 parent da2dccb commit a671728
Show file tree
Hide file tree
Showing 11 changed files with 423 additions and 1,367 deletions.
91 changes: 0 additions & 91 deletions spec/pivotal-ui-react/forms/form-col_spec.js

This file was deleted.

54 changes: 0 additions & 54 deletions spec/pivotal-ui-react/forms/form-row_spec.js

This file was deleted.

20 changes: 10 additions & 10 deletions spec/pivotal-ui-react/forms/form-unit_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ describe('FormUnit', () => {
spyOnRender(TooltipTrigger).and.callThrough();
subject = ReactDOM.render(<FormUnit {...{
className: 'my-class',
field: (<div><span>hello</span></div>)
}} />, root);
children: (<div><span>hello</span></div>)
}}/>, root);
});

it('does not render a label row when no label is provided', () => {
expect('.form-unit .label-row').not.toExist();
});

describe('when no field is provided', () => {
describe('when no children are provided', () => {
beforeEach(() => {
subject = ReactDOM.render(<FormUnit {...{
className: 'my-class',
label: 'some label'
}} />, root);
}}/>, root);
});

it('does not render a field row', () => {
Expand Down Expand Up @@ -161,18 +161,18 @@ describe('FormUnit', () => {
});

describe('when the postLabel is a function', () => {
let postLabel, setState, state;
let postLabel, state, setValues;

beforeEach(() => {
postLabel = jasmine.createSpy('postLabel').and.returnValue(<span className="returned">returned</span>);
setState = jasmine.createSpy('setState');
setValues = jasmine.createSpy('setValues');
state = {key: 'value'};

subject::setProps({postLabel, setState, state});
subject::setProps({postLabel, state, setValues});
});

it('calls the postLabel function', () => {
expect(postLabel).toHaveBeenCalledWith({setState, state});
expect(postLabel).toHaveBeenCalledWith({state, setValues});
});

it('renders the returned node', () => {
Expand Down Expand Up @@ -373,9 +373,9 @@ describe('FormUnit', () => {
});
});

describe('when there is no label, field, or help block', () => {
describe('when there is no label, children, or help block', () => {
beforeEach(() => {
subject::setProps({label: null, field: null, help: null});
subject::setProps({label: null, children: null, help: null});
});

it('renders nothing', () => {
Expand Down
Loading

0 comments on commit a671728

Please sign in to comment.