View | Details | Raw Unified | Return to bug 32721
Collapse All | Expand All

(-)a/t/db_dependent/Template/Plugin/Branches.t (-9 / +23 lines)
Lines 220-246 subtest 'pickup_locations() tests' => sub { Link Here
220
220
221
subtest 'branch specific js and css' => sub {
221
subtest 'branch specific js and css' => sub {
222
222
223
    plan tests => 2;
223
    plan tests => 6;
224
224
225
    $schema->storage->txn_begin;
225
    $schema->storage->txn_begin;
226
226
227
    my $newbranch = $builder->build({
227
    my $newbranch_with = $builder->build({
228
        source => 'Branch',
228
        source => 'Branch',
229
        value => {
229
        value => {
230
            branchcode => 'AAA',
231
            branchname => 'Specific Branch',
232
            userjs => 'console.log(\'Hello World\');',
230
            userjs => 'console.log(\'Hello World\');',
233
            usercss => 'body { background-color: blue; }'
231
            usercss => 'body { background-color: blue; }'
234
        }
232
        }
235
    });
233
    });
234
    my $newbranch_none = $builder->build({
235
        source => 'Branch',
236
        value => {
237
            userjs => '',
238
            usercss => ''
239
        }
240
    });
236
241
237
    my $plugin = Koha::Template::Plugin::Branches->new();
242
    my $plugin = Koha::Template::Plugin::Branches->new();
238
243
239
    my $userjs = $plugin->GetBranchSpecificJS($newbranch->{branchcode});
244
    my $userjs = $plugin->GetBranchSpecificJS($newbranch_with->{branchcode});
240
    is($userjs, $newbranch->{userjs},'received correct JS string from function');
245
    is($userjs, $newbranch_with->{userjs},'received correct JS string from function');
246
247
    my $usercss = $plugin->GetBranchSpecificCSS($newbranch_with->{branchcode});
248
    is($usercss, $newbranch_with->{usercss},'received correct CSS string from function');
249
250
    $userjs = $plugin->GetBranchSpecificJS($newbranch_none->{branchcode});
251
    $usercss = $plugin->GetBranchSpecificCSS($newbranch_none->{branchcode});
252
    is($userjs, 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');
241
254
242
    my $usercss = $plugin->GetBranchSpecificCSS($newbranch->{branchcode});
255
    $userjs = $plugin->GetBranchSpecificJS();
243
    is($usercss, $newbranch->{usercss},'received correct CSS string from function');
256
    $usercss = $plugin->GetBranchSpecificCSS();
257
    is($userjs, 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');
244
259
245
    $schema->storage->txn_rollback;
260
    $schema->storage->txn_rollback;
246
};
261
};
247
- 

Return to bug 32721