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