botbuilder
Advanced tools
Comparing version 3.5.0-rc6 to 3.5.0-rc7
@@ -20,2 +20,7 @@ "use strict"; | ||
var ThumbnailCard = require('./cards/ThumbnailCard'); | ||
var VideoCard = require('./cards/VideoCard'); | ||
var AudioCard = require('./cards/AudioCard'); | ||
var AnimationCard = require('./cards/AnimationCard'); | ||
var MediaCard = require('./cards/MediaCard'); | ||
var CardMedia = require('./cards/CardMedia'); | ||
var Keyboard = require('./cards/Keyboard'); | ||
@@ -33,2 +38,7 @@ var Middleware = require('./middleware/Middleware'); | ||
exports.HeroCard = HeroCard.HeroCard; | ||
exports.VideoCard = VideoCard.VideoCard; | ||
exports.AudioCard = AudioCard.AudioCard; | ||
exports.AnimationCard = AnimationCard.AnimationCard; | ||
exports.MediaCard = MediaCard.MediaCard; | ||
exports.CardMedia = CardMedia.CardMedia; | ||
exports.CardImage = CardImage.CardImage; | ||
@@ -35,0 +45,0 @@ exports.ReceiptCard = ReceiptCard.ReceiptCard; |
@@ -5,3 +5,3 @@ { | ||
"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.", | ||
"version": "3.5.0-rc6", | ||
"version": "3.5.0-rc7", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -60,3 +60,4 @@ var assert = require('assert'); | ||
var bot = new builder.UniversalBot(connector); | ||
bot.dialog('/', function (session, args) { | ||
bot.dialog('/', function (session) { | ||
session.send('Hi'); | ||
}).triggerAction({ | ||
@@ -73,2 +74,113 @@ matches: /test/i, | ||
}); | ||
it('should reload the same dialog using a reloadAction().', function (done) { | ||
var menuLoaded = false; | ||
var connector = new builder.ConsoleConnector(); | ||
var bot = new builder.UniversalBot(connector); | ||
bot.dialog('/', function (session) { | ||
session.beginDialog('/menu'); | ||
}); | ||
bot.dialog('/menu', function (session, args) { | ||
builder.Prompts.text(session, "ChooseOption"); | ||
}).reloadAction('showMenu', null, { matches: /show menu/i }); | ||
bot.on('send', function (message) { | ||
switch (message.text) { | ||
case 'ChooseOption': | ||
if (!menuLoaded) { | ||
menuLoaded = true; | ||
connector.processMessage("show menu"); | ||
} else { | ||
done(); | ||
} | ||
break; | ||
default: | ||
assert(false); | ||
break; | ||
} | ||
}); | ||
connector.processMessage('test'); | ||
}); | ||
it('should reload the same dialog using a reloadAction() but pass additional args.', function (done) { | ||
var connector = new builder.ConsoleConnector(); | ||
var bot = new builder.UniversalBot(connector); | ||
bot.dialog('/', function (session) { | ||
session.beginDialog('/menu'); | ||
}); | ||
bot.dialog('/menu', function (session, args) { | ||
if (args && args.reloaded) { | ||
builder.Prompts.text(session, "ReloadedChooseOption"); | ||
} else { | ||
builder.Prompts.text(session, "ChooseOption"); | ||
} | ||
}).reloadAction('showMenu', null, { | ||
matches: /show menu/i, | ||
dialogArgs: { reloaded: true } | ||
}); | ||
bot.on('send', function (message) { | ||
switch (message.text) { | ||
case 'ChooseOption': | ||
connector.processMessage("show menu"); | ||
break; | ||
case 'ReloadedChooseOption': | ||
done(); | ||
break; | ||
default: | ||
assert(false); | ||
break; | ||
} | ||
}); | ||
connector.processMessage('test'); | ||
}); | ||
it('should load a diffierent dialog using beginDialogAction().', function (done) { | ||
var connector = new builder.ConsoleConnector(); | ||
var bot = new builder.UniversalBot(connector); | ||
bot.dialog('/', function (session) { | ||
builder.Prompts.text(session, "ChooseFood"); | ||
}).beginDialogAction('foodMenu', '/menu', { | ||
matches: /show menu/i, | ||
dialogArgs: { title: 'FoodOptions' } | ||
}); | ||
bot.dialog('/menu', function (session, args) { | ||
var title = args && args.title ? args.title : 'NoTitle'; | ||
session.send(title); | ||
}); | ||
bot.on('send', function (message) { | ||
switch (message.text) { | ||
case 'ChooseFood': | ||
connector.processMessage("show menu"); | ||
break; | ||
case 'FoodOptions': | ||
done(); | ||
break; | ||
default: | ||
assert(false); | ||
break; | ||
} | ||
}); | ||
connector.processMessage('test'); | ||
}); | ||
it('should end the current conversation using endConversationAction().', function (done) { | ||
var connector = new builder.ConsoleConnector(); | ||
var bot = new builder.UniversalBot(connector); | ||
bot.dialog('/', function (session) { | ||
builder.Prompts.text(session, "ChooseFood"); | ||
}).endConversationAction('quit', "goodbye", { matches: /goodbye/i }); | ||
bot.on('send', function (message) { | ||
switch (message.text) { | ||
case 'ChooseFood': | ||
connector.processMessage("goodbye"); | ||
break; | ||
case 'goodbye': | ||
done(); | ||
break; | ||
default: | ||
assert(false); | ||
break; | ||
} | ||
}); | ||
connector.processMessage('test'); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
423891
67
9288