Lines 227-261
subtest 'branch specific js and css' => sub {
Link Here
|
227 |
my $newbranch_with = $builder->build({ |
227 |
my $newbranch_with = $builder->build({ |
228 |
source => 'Branch', |
228 |
source => 'Branch', |
229 |
value => { |
229 |
value => { |
230 |
userjs => 'console.log(\'Hello World\');', |
230 |
opacuserjs => 'console.log(\'Hello World\');', |
231 |
usercss => 'body { background-color: blue; }' |
231 |
opacusercss => 'body { background-color: blue; }' |
232 |
} |
232 |
} |
233 |
}); |
233 |
}); |
234 |
my $newbranch_none = $builder->build({ |
234 |
my $newbranch_none = $builder->build({ |
235 |
source => 'Branch', |
235 |
source => 'Branch', |
236 |
value => { |
236 |
value => { |
237 |
userjs => '', |
237 |
opacuserjs => '', |
238 |
usercss => '' |
238 |
opacusercss => '' |
239 |
} |
239 |
} |
240 |
}); |
240 |
}); |
241 |
|
241 |
|
242 |
my $plugin = Koha::Template::Plugin::Branches->new(); |
242 |
my $plugin = Koha::Template::Plugin::Branches->new(); |
243 |
|
243 |
|
244 |
my $userjs = $plugin->GetBranchSpecificJS($newbranch_with->{branchcode}); |
244 |
my $opacuserjs = $plugin->GetBranchSpecificJS($newbranch_with->{branchcode}); |
245 |
is($userjs, $newbranch_with->{userjs},'received correct JS string from function'); |
245 |
is($opacuserjs, $newbranch_with->{opacuserjs},'received correct JS string from function'); |
246 |
|
246 |
|
247 |
my $usercss = $plugin->GetBranchSpecificCSS($newbranch_with->{branchcode}); |
247 |
my $opacusercss = $plugin->GetBranchSpecificCSS($newbranch_with->{branchcode}); |
248 |
is($usercss, $newbranch_with->{usercss},'received correct CSS string from function'); |
248 |
is($opacusercss, $newbranch_with->{opacusercss},'received correct CSS string from function'); |
249 |
|
249 |
|
250 |
$userjs = $plugin->GetBranchSpecificJS($newbranch_none->{branchcode}); |
250 |
$opacuserjs = $plugin->GetBranchSpecificJS($newbranch_none->{branchcode}); |
251 |
$usercss = $plugin->GetBranchSpecificCSS($newbranch_none->{branchcode}); |
251 |
$opacusercss = $plugin->GetBranchSpecificCSS($newbranch_none->{branchcode}); |
252 |
is($userjs, q{},'received correct blank string from function when branch has none'); |
252 |
is($opacuserjs, q{},'received correct blank string from function when branch has none'); |
253 |
is($usercss, q{},'received correct blank string from function when branch has none'); |
253 |
is($opacusercss, q{},'received correct blank string from function when branch has none'); |
254 |
|
254 |
|
255 |
$userjs = $plugin->GetBranchSpecificJS(); |
255 |
$opacuserjs = $plugin->GetBranchSpecificJS(); |
256 |
$usercss = $plugin->GetBranchSpecificCSS(); |
256 |
$opacusercss = $plugin->GetBranchSpecificCSS(); |
257 |
is($userjs, q{},'received correct blank string from function when no branch set'); |
257 |
is($opacuserjs, q{},'received correct blank string from function when no branch set'); |
258 |
is($usercss, q{},'received correct blank string from function when no branch set'); |
258 |
is($opacusercss, q{},'received correct blank string from function when no branch set'); |
259 |
|
259 |
|
260 |
$schema->storage->txn_rollback; |
260 |
$schema->storage->txn_rollback; |
261 |
}; |
261 |
}; |
262 |
- |
|
|