-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* lu reference * update * update * minimal publish model * update resolver * update package * update * support path based resolve * support wildcard match * / ** * update * resolver support .qna file ext * define source qna in bot structure * include dialog name in source qna name * qnaIndexer update * update * create qna file for imported url & name * update * enable source qna in all up view * import url sync all locale * update import name * qna parse more infomation * keep header in qna crud * group source.qna in dialog.qna * refactor qnaUtil curd methods * refactor qna all up view * update * remove > !# @source.name in options * do not insert \n before section * update * remove source from nav tree * enable multi turn * create qna file for imported url & name * update package * imports methods * remove import in table-view * update * update * enable multiturn * remove file state * update style * handle focus states * clean install * rename * refactor create qna modal * ... menuItems for navTree * rename * create from scratch & url * clean up * fix build * update * update all up view UX * creation flow from qna scratch * edit container name * update css * update css * migrate exist qna to container * edit url source * update css * update css * clean up * update bf-lu package * update * update ux * creation back * update * fix create qna bot * update css * update container edit * update tests * update to multi projectId * fix bug and update css * fix bug * add tests * resolve merge conflict * update * use notification card * unify create qna modal * show code & back KB * rename migrated file to *-munual.source.qna * clean * update css * update styles * update tests * revert test * update showcode button test id * resolve comments * resolve types * update * required validation * edit field height * update * update * expand row index * craete QnA pair controls * update * fix empty group creation * not change backgroud when switch to scratch * update * height * update * update * resolve merge conflict * fix creation * fix bug * show + when hover Co-authored-by: liweitian <liweitian93@outlook.com> Co-authored-by: Weitian Li <weitli@microsoft.com> Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
- Loading branch information
1 parent
4e1317f
commit e5fc3df
Showing
72 changed files
with
4,668 additions
and
1,474 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
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
67 changes: 67 additions & 0 deletions
67
Composer/packages/client/__tests__/components/createQnAModal.test.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,67 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import React from 'react'; | ||
import { fireEvent } from '@bfc/test-utils'; | ||
|
||
import { renderWithRecoil } from '../testUtils/renderWithRecoil'; | ||
import CreateQnAFromUrlModal from '../../src/components/QnA/CreateQnAFromUrlModal'; | ||
import { showCreateQnAFromUrlDialogState, showCreateQnAFromUrlDialogWithScratchState } from '../../src/recoilModel'; | ||
|
||
describe('<CreateQnAFromUrlModal />', () => { | ||
const onDismiss = jest.fn(() => {}); | ||
const onSubmit = jest.fn(() => {}); | ||
const projectId = 'test-create-qna'; | ||
|
||
it('renders <CreateQnAFromUrlModal /> and create from scratch', () => { | ||
const container = renderWithRecoil( | ||
<CreateQnAFromUrlModal | ||
dialogId="test" | ||
projectId={projectId} | ||
qnaFiles={[]} | ||
onDismiss={onDismiss} | ||
onSubmit={onSubmit} | ||
/>, | ||
({ set }) => { | ||
set(showCreateQnAFromUrlDialogState(projectId), true); | ||
set(showCreateQnAFromUrlDialogWithScratchState(projectId), true); | ||
} | ||
); | ||
|
||
const { getByTestId } = container; | ||
const createFromScratchButton = getByTestId('createKnowledgeBaseFromScratch'); | ||
expect(createFromScratchButton).not.toBeNull(); | ||
fireEvent.click(createFromScratchButton); | ||
// actions tobe called | ||
}); | ||
|
||
it('create with name/url and validate the value', () => { | ||
const container = renderWithRecoil( | ||
<CreateQnAFromUrlModal | ||
dialogId="test" | ||
projectId={projectId} | ||
qnaFiles={[]} | ||
onDismiss={onDismiss} | ||
onSubmit={onSubmit} | ||
/>, | ||
() => {} | ||
); | ||
|
||
const { findByText, getByTestId } = container; | ||
const inputName = getByTestId('knowledgeLocationTextField-name') as HTMLInputElement; | ||
fireEvent.change(inputName, { target: { value: 'test' } }); | ||
|
||
const inputUrl = getByTestId('knowledgeLocationTextField-url') as HTMLInputElement; | ||
fireEvent.change(inputUrl, { target: { value: 'test' } }); | ||
|
||
expect(inputUrl.value).toBe('test'); | ||
expect(findByText(/A valid url should start with/)).not.toBeNull(); | ||
fireEvent.change(inputUrl, { target: { value: 'http://test' } }); | ||
|
||
const createKnowledgeButton = getByTestId('createKnowledgeBase'); | ||
expect(createKnowledgeButton).not.toBeNull(); | ||
fireEvent.click(createKnowledgeButton); | ||
expect(onSubmit).toBeCalled(); | ||
expect(onSubmit).toBeCalledWith({ url: 'http://test', name: 'test', multiTurn: false }); | ||
}); | ||
}); |
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.