Scramble: Switching to text template
parent
e71eb3c5d4
commit
386616d2d9
|
@ -46,12 +46,15 @@ handle remainder_lc => sub {
|
|||
|
||||
return unless $response;
|
||||
|
||||
return "$operation $word",
|
||||
structured_answer => {
|
||||
input => [html_enc($word)],
|
||||
operation => $operation,
|
||||
result => html_enc($response)
|
||||
};
|
||||
return "$operation $word", structured_answer => {
|
||||
data => {
|
||||
title => html_enc($response),
|
||||
subtitle => html_enc("$operation: $word")
|
||||
},
|
||||
templates => {
|
||||
group => 'text'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
25
t/Scramble.t
25
t/Scramble.t
|
@ -9,18 +9,25 @@ use DDG::Test::Goodie;
|
|||
zci answer_type => "scramble";
|
||||
zci is_cached => 0;
|
||||
|
||||
sub build_test {
|
||||
my ($text, $input) = @_;
|
||||
return test_zci($text, structured_answer => {
|
||||
data => {
|
||||
title => ignore(),
|
||||
subtitle => "Scramble of: $input"
|
||||
},
|
||||
templates => {
|
||||
group => 'text'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw( DDG::Goodie::Scramble )],
|
||||
'scramble of filter' => test_zci(
|
||||
'Scramble of filter',
|
||||
structured_answer => {
|
||||
input => ['filter'],
|
||||
operation => 'Scramble of',
|
||||
result => ignore(),
|
||||
}
|
||||
),
|
||||
'scramble of filter' => build_test('Scramble of filter', 'filter'),
|
||||
'scramble of' => undef,
|
||||
'Scramble for' => undef,
|
||||
'Scramble for' => undef,
|
||||
'Scrambles for ""' => undef,
|
||||
'Scrambles for "867-5309"' => undef,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue