Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,24 @@ describe('<DefineConversation/>', () => {
const component = renderComponent();
const node = await component.findByText('OK');
fireEvent.click(node);
expect(onSubmitMock).toHaveBeenCalledWith({
description: 'Test Echo',
name: 'EchoBot-11299',
location: '',
schemaUrl:
'https://raw.githubusercontent.com/microsoft/botframework-sdk/master/schemas/component/component.schema',
});
expect(
onSubmitMock.mock.calls[0][0] ===
{
description: 'Test Echo',
name: 'EchoBot-11299',
location: '\\test-folder\\Desktop',
schemaUrl:
'https://raw.githubusercontent.com/microsoft/botframework-sdk/master/schemas/component/component.schema',
} ||
onSubmitMock.mock.calls[0][0] ===
{
description: 'Test Echo',
name: 'EchoBot-11299',
location: '/test-folder/Desktop',
schemaUrl:
'https://raw.githubusercontent.com/microsoft/botframework-sdk/master/schemas/component/component.schema',
}
).toBeTruthy;
});

it('does not allow submission when the name is invalid', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('<CreationFlow/>', () => {
storeContext.state.templateId = 'EchoBot';
storeContext.actions.createProject = async (templateId, name, description, location) => {
expect(templateId).toBe(expectedTemplateId);
expect(location === '').toBeTruthy();
expect(location === '/test-folder/Desktop' || location === '\\test-folder\\Desktop').toBeTruthy();
};
storeContext.state.focusedStorageFolder = {
name: 'Desktop',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ const DefineConversation: React.FC<DefineConversationProps> = (props) => {
},
location: {
required: true,
defaultValue:
focusedStorageFolder !== null && Object.keys(focusedStorageFolder as Record<string, any>).length
? Path.join(focusedStorageFolder.parent, focusedStorageFolder.name)
: '',
},
};
const { formData, formErrors, hasErrors, updateField, updateForm } = useForm(formConfig);
Expand All @@ -118,7 +122,10 @@ const DefineConversation: React.FC<DefineConversationProps> = (props) => {
name: getDefaultName(),
description: '',
schemaUrl: '',
location: '',
location:
focusedStorageFolder !== null && Object.keys(focusedStorageFolder as Record<string, any>).length
? Path.join(focusedStorageFolder.parent, focusedStorageFolder.name)
: '',
};
updateForm(formData);
if (props.location?.search) {
Expand Down Expand Up @@ -159,19 +166,19 @@ const DefineConversation: React.FC<DefineConversationProps> = (props) => {
[hasErrors, formData]
);

const updateLocation = (location: string) => {
const updatedFormData = {
...formData,
location,
};
updateForm(updatedFormData);
};

const onCurrentPathUpdateWrap = (newPath: string, storageId?: string) => {
onCurrentPathUpdate(newPath, storageId);
updateLocation(newPath);
updateField('location', newPath);
};

useEffect(() => {
const location =
focusedStorageFolder !== null && Object.keys(focusedStorageFolder as Record<string, any>).length
? Path.join(focusedStorageFolder.parent, focusedStorageFolder.name)
: '';
updateField('location', location);
}, [focusedStorageFolder]);

return (
<Fragment>
<DialogWrapper
Expand Down