Configure it setting value for:
- help_files_path: where the help files will be found
- - help_files_ext: what is the extension for the help files (default html)
+ - help_files_ext: what is the extension for the help files (default: html)
+ - wrapper_tag: what tag will be used to wrap the shippet (default: span)
+ - wrapper_css_class: what css class will be applied to the wrapper tag (default: help_text)
Create files with the text/html to be included and store them at help_files_path.
default => 'html',
);
+has wrapper_css_class => (
+ is => 'ro',
+ isa => Str,
+ default => 'help_text',
+);
+
+has wrapper_tag => (
+ is => 'ro',
+ isa => Str,
+ default => 'span',
+);
+
+
sub get_help_text_for {
my ($self, $help_key) = @_;
confess('No $help_key provided') unless $help_key;
my $file = $self->_get_file($fn);
- return $file->slurp if ( -e $file );
+ if ( -e $file ) {
+ return sprintf('<%s class="%s">%s</%s>',
+ $self->wrapper_tag,
+ $self->wrapper_css_class,
+ $file->slurp,
+ $self->wrapper_tag
+ );
+ }
croak "Cannot find help text '$help_key' in $file";
}
use Test::WWW::Mechanize::Catalyst 'TestApp';
my $mech = Test::WWW::Mechanize::Catalyst->new;
$mech->get_ok('http://localhost/', 'get main page');
-$mech->content_like(qr/fnarblarghfnee/i, 'see if it has our text');
+$mech->content_like(qr/fnar<span class="help_text">blargh<\/span>fnee/i, 'see if it has our text');
done_testing;