-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for creating camel source
- Loading branch information
Showing
12 changed files
with
248 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 14 additions & 37 deletions
51
frontend/packages/knative-plugin/src/components/add/__tests__/EventSourceForm.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 25 additions & 7 deletions
32
frontend/packages/knative-plugin/src/components/add/event-sources/EventSourcesSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
frontend/packages/knative-plugin/src/components/add/event-sources/YAMLEditorSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
import YAMLEditorField from '@console/shared/src/components/formik-fields/YAMLEditorField'; | ||
import FormSection from '@console/dev-console/src/components/import/section/FormSection'; | ||
import { useField } from 'formik'; | ||
|
||
const YAMLEditorSection: React.FC = () => { | ||
const [field] = useField('type'); | ||
return ( | ||
<FormSection fullWidth title={field.value}> | ||
<YAMLEditorField name="yamlData" /> | ||
</FormSection> | ||
); | ||
}; | ||
|
||
export default YAMLEditorSection; |
17 changes: 17 additions & 0 deletions
17
...ages/knative-plugin/src/components/add/event-sources/__tests__/YAMLEditorSection.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import FormSection from '@console/dev-console/src/components/import/section/FormSection'; | ||
import YAMLEditorSection from '../YAMLEditorSection'; | ||
|
||
jest.mock('formik', () => ({ | ||
useField: jest.fn(() => [{ value: 'CamelSource' }, [{}, {}]]), | ||
})); | ||
|
||
describe('YAMLEditorSection', () => { | ||
const wrapper = shallow(<YAMLEditorSection />); | ||
it('should render FormSection with proper props', () => { | ||
expect(wrapper.find(FormSection)).toHaveLength(1); | ||
expect(wrapper.find(FormSection).props().title).toEqual('CamelSource'); | ||
expect(wrapper.find(FormSection).props().fullWidth).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.