Skip to content
This repository has been archived by the owner on Jun 19, 2018. It is now read-only.

Commit

Permalink
PaginatedChoiceState
Browse files Browse the repository at this point in the history
  • Loading branch information
smn committed Jul 28, 2014
1 parent 0b3669a commit c2b8622
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/go-mama-sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if (typeof api === "undefined") {

var EndState = vumigo.states.EndState;
var ChoiceState = vumigo.states.ChoiceState;
var PaginatedChoiceState = vumigo.states.PaginatedChoiceState;
var Choice = vumigo.states.Choice;
var LanguageChoice = vumigo.states.LanguageChoice;
var InteractionMachine = vumigo.state_machine.InteractionMachine;
Expand Down Expand Up @@ -254,7 +255,7 @@ function MamaSMS() {
]
));

self.add_state(new ChoiceState(
self.add_state(new PaginatedChoiceState(
'expected_month',
function(choice) {
if(choice.value == 'unknown') {
Expand All @@ -279,7 +280,12 @@ function MamaSMS() {
new Choice(10, _.gettext('Nov')),
new Choice(11, _.gettext('Dec')),
new Choice('unknown', _.gettext('Don\'t know'))
]
],
null,
null,
{
options_per_page: 5
}
));

self.add_state(new ChoiceState(
Expand Down
5 changes: 4 additions & 1 deletion test/test-go-mama-sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,14 @@ describe("Mama SMS application in multiple language", function() {
var p = tester.check_state({
user: {
current_state: 'expected_month',
pages: {
expected_month: 8
},
answers: {
user_status: 'pregnant'
}
},
content: '13',
content: '5',
next_state: 'go_to_clinic',
response: 'To sign up, we need to know which month.',
continue_session: false
Expand Down

0 comments on commit c2b8622

Please sign in to comment.