diff --git a/lib/DDG/Goodie/Scramble.pm b/lib/DDG/Goodie/Scramble.pm index c851d67ac..84a610a15 100644 --- a/lib/DDG/Goodie/Scramble.pm +++ b/lib/DDG/Goodie/Scramble.pm @@ -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; diff --git a/t/Scramble.t b/t/Scramble.t index beb99062e..eb5f47bb9 100644 --- a/t/Scramble.t +++ b/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, );