Skip to content

Commit

Permalink
Merge 29a6ca4 into e92dd0a
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina committed Nov 19, 2018
2 parents e92dd0a + 29a6ca4 commit a88e815
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 52 deletions.
Expand Up @@ -64,7 +64,7 @@ describe('The AzureLoginFailedDialogContainer component should', () => {
},
};
const spy = jest.spyOn(CommandServiceImpl, 'remoteCall');
instance.onAnchorClick(mockEvent);
instance.onLinkClick(mockEvent);
expect(spy).toHaveBeenCalledWith(SharedConstants.Commands.Electron.OpenExternal, 'https://aka.ms/');
});

Expand Down
86 changes: 43 additions & 43 deletions packages/app/client/src/ui/editor/welcomePage/welcomePage.tsx
Expand Up @@ -41,7 +41,7 @@ import { GenericDocument } from '../../layout';
export interface WelcomePageProps {
accessToken?: string;
documentId?: string;
onAnchorClick: (url: string) => void;
onLinkClick: (url: string) => void;
onNewBotClick?: () => void;
onOpenBotClick?: () => void;
onBotClick?: (_e: any, path: string) => void;
Expand Down Expand Up @@ -90,10 +90,10 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
this.props.showContextMenuForBot(bot);
}

private onAnchorClick = (event: MouseEvent<HTMLAnchorElement>): void => {
private onLinkClick = (event: MouseEvent<HTMLButtonElement>): void => {
const { currentTarget: link } = event;
const { href } = link.dataset;
this.props.onAnchorClick(href);
this.props.onLinkClick(href);
}

private onDeleteBotClick = (event: React.MouseEvent<HTMLButtonElement>) => {
Expand All @@ -110,12 +110,12 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<SmallHeader className={ styles.marginFix }>Start by testing your bot</SmallHeader>
<span>Start talking to your bot by connecting to an endpoint or by opening a
bot saved locally.<br/>
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-create-bot-locally"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>More about working locally with a bot.
</a>
</button>
</span>
<Row>
<PrimaryButton className={ styles.openBot } text="Open Bot" onClick={ onOpenBotClick }/>
Expand Down Expand Up @@ -192,14 +192,13 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<dt>Plan:</dt>
<dd>
Review the bot&nbsp;
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-design-guidelines"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
design guidelines
</a>&nbsp;
for best practices&nbsp;
</button>&nbsp;for best practices&nbsp;
</dd>
</dl>
</div>
Expand All @@ -210,51 +209,51 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<dl>
<dt>Build:</dt>
<dd>
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-tools"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
Download Command Line tools
</a><br/>
</button><br/>
Create a bot&nbsp;
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-create-bot-azure"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
from Azure
</a> or&nbsp;
<a
</button> or&nbsp;
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-create-bot-locally"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
locally
</a><br/>
</button><br/>
Add services such as<br/>
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-LUIS-docs-home"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
Language Understanding (LUIS)
</a>,&nbsp;
<a
</button>,&nbsp;
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-qna-docs-home"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
QnAMaker
</a>&nbsp;
</button>&nbsp;
and&nbsp;
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-create-dispatch"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
Dispatch
</a>
</button>
</dd>
</dl>
</div>
Expand All @@ -266,21 +265,21 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<dt className={ styles.testBullet }>Test:</dt>
<dd>
Test with the&nbsp;
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-debug-with-emulator"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
Emulator
</a> <br/>
</button> <br/>
Test online in&nbsp;
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-debug-with-web-chat"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
Web Chat
</a></dd>
</button></dd>
</dl>
</div>
<div className={ styles.stepContainer }>
Expand All @@ -291,13 +290,14 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<dt>Publish:</dt>
<dd>
Publish directly to Azure or<br/>
Use <a
Use <button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-publish-continuous-deployment"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
tabIndex={ 0 }
>
Continuous Deployment
</a>
</button>
&nbsp;
</dd>
</dl>
Expand All @@ -310,13 +310,13 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<dt>Connect:</dt>
<dd>
Connect to&nbsp;
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-connect-channels"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
channels
</a>
</button>
&nbsp;
</dd>
</dl>
Expand All @@ -328,13 +328,13 @@ export class WelcomePage extends React.Component<WelcomePageProps, {}> {
<dl>
<dt>Evaluate:</dt>
<dd>
<a
<button
className={ styles.ctaLink }
data-href="https://aka.ms/bot-framework-emulator-bot-analytics"
onClick={ this.onAnchorClick }
onClick={ this.onLinkClick }
>
View analytics
</a>
</button>
</dd>
</dl>
</div>
Expand Down
Expand Up @@ -51,7 +51,7 @@ function mapStateToProps(state: RootState, ownProps: WelcomePageProps): WelcomeP
function mapDispatchToProps(dispatch: (action: Action) => void): WelcomePageProps {
const { Commands } = SharedConstants;
return {
onAnchorClick: (url) => {
onLinkClick: (url) => {
CommandServiceImpl.remoteCall(Commands.Electron.OpenExternal, url).catch();
},
onNewBotClick: () => {
Expand Down
14 changes: 7 additions & 7 deletions packages/app/main/src/commands/botCommands.spec.ts
Expand Up @@ -56,7 +56,7 @@ jest.mock('../emulator', () => ({
}));
const mockCommandRegistry = new CommandRegistryImpl();
const mockBot = BotConfigWithPathImpl.fromJSON({
'path': 'some/path.bot',
'path': path.normalize('some/path.bot'),
'name': 'AuthBot',
'description': '',
'padlock': '',
Expand Down Expand Up @@ -98,11 +98,11 @@ describe('The botCommands', () => {
const saveBotSpy = jest.spyOn((helpers as any).default, 'saveBot');

const mockBotInfo = {
path: botToSave.path,
path: path.normalize(botToSave.path),
displayName: 'AuthBot',
secret: 'secret',
chatsPath: 'some/dialogs',
transcriptsPath: 'some/transcripts'
chatsPath: path.normalize('some/dialogs'),
transcriptsPath: path.normalize('some/transcripts')
};
const command = mockCommandRegistry.getCommand(Bot.Create);
const result = await command.handler(botToSave, 'secret');
Expand Down Expand Up @@ -234,7 +234,7 @@ describe('The botCommands', () => {

it('should patch the bots list and watch for chat and transcript changes', async () => {
const mockBotInfo = {
path: 'this/is/my.json',
path: path.normalize('this/is/my.json'),
displayName: 'AuthBot',
secret: 'secret'
};
Expand All @@ -243,8 +243,8 @@ describe('The botCommands', () => {

const { handler } = mockCommandRegistry.getCommand(SharedConstants.Commands.Bot.PatchBotList);
await handler(mockBotInfo.path, mockBotInfo);
expect(transcriptWatchSpy).toHaveBeenCalledWith('this/is/transcripts');
expect(chatWatcherSpy).toHaveBeenCalledWith('this/is/dialogs');
expect(transcriptWatchSpy).toHaveBeenCalledWith(path.normalize('this/is/transcripts'));
expect(chatWatcherSpy).toHaveBeenCalledWith(path.normalize('this/is/dialogs'));
});

it('should remove a bot from the list', async () => {
Expand Down

0 comments on commit a88e815

Please sign in to comment.