CallBackery
view release on metacpan or search on metacpan
t/export-qrcode.t view on Meta::CPAN
use FindBin;
use lib $FindBin::Bin.'/../thirdparty/lib/perl5';
use lib $FindBin::Bin.'/../lib';
use Mojo::Base -strict;
use Test::More;
use Test::Fatal qw(exception);
use Compress::Zlib qw(uncompress);
use CallBackery::GuiPlugin::AbstractTable;
use CallBackery::Translate qw(trm);
my $C = 'CallBackery::GuiPlugin::AbstractTable';
package TestTable;
use Mojo::Base 'CallBackery::GuiPlugin::AbstractTable', -signatures;
use CallBackery::Translate qw(trm);
has app => sub { TestApp->new };
has user => sub { TestUser->new };
sub tableCfg ($self) {
return [
{ key => 'id', label => trm('Id'), type => 'number' },
{ key => 'serial', label => trm('Serial'), type => 'str' },
{ key => 'note', label => trm('Note'), type => 'str' },
];
}
sub getTableRowCount ($self, $args) { return 3 }
sub getTableData ($self, $args) {
return [
{ id => 1, serial => 'AAA', note => 'first' },
{ id => 2, serial => 'BBB', note => 'second' },
{ id => 3, serial => 'AAA', note => 'third' },
];
}
package TestApp;
use Mojo::Base -base, -signatures;
use Mojo::Home;
use FindBin;
has home => sub { Mojo::Home->new($FindBin::Bin.'/..') };
package TestUser;
use Mojo::Base -base, -signatures;
has userInfo => sub { { lang => 'en' } };
package main;
# --- column plan ------------------------------------------------------
my $tCfg = [
{ key => 'id', label => 'Id' },
{ key => 'serial', label => 'Serial' },
{ key => 'note', label => 'Note' },
];
is_deeply(
[ map { $_->{extra} ? 'X:'.$_->{extra}{content} : $_->{col}{key} }
@{ $C->_exportColumnPlan($tCfg, undef) } ],
[ qw(id serial note) ],
'no extraCols leaves the plan untouched'
);
is_deeply(
( run in 1.012 second using v1.01-cache-2.11-cpan-54e63673c56 )