content_block_ok is not enough to check for existing sidebar content
Change-Id: Iccc83498f91348ea97f46a392707d0b4ee949ff1
diff --git a/t/plugin/auth.t b/t/plugin/auth.t
index e63b1b2..9828baf 100644
--- a/t/plugin/auth.t
+++ b/t/plugin/auth.t
@@ -40,11 +40,15 @@
->text_like('#total-results', qr/\d+$/)
->content_like(qr/\"authorized\"\:null/)
->element_exists_not('div.button.top a')
+ ->element_exists_not('aside.active')
+ ->element_exists_not('aside.off')
;
$t->get_ok('/')
->status_is(200)
->element_exists('form[action=/user/login] input[name=handle_or_email]')
+ ->element_exists('aside.active')
+ ->element_exists_not('aside.off')
;
$t->post_ok('/user/login' => form => { handle_or_email => 'test', pwd => 'fail' })
@@ -84,6 +88,8 @@
->element_exists_not('div.notify-error')
->element_exists('div.notify-success')
->text_is('div.notify-success', 'Login successful')
+ ->element_exists('aside.off')
+ ->element_exists_not('aside.active')
;
# Now the user is logged in and should be able to
diff --git a/templates/partial/side.html.ep b/templates/partial/side.html.ep
index ff2df26..3f1fc0e 100644
--- a/templates/partial/side.html.ep
+++ b/templates/partial/side.html.ep
@@ -1,5 +1,7 @@
-<aside tabindex="0" class="<% unless (content_block_ok('sidebar')) { %>off<% } elsif (stash('sidebar_active')) { %>active<% } %>">
+% my $side_bar = content_block 'sidebar';
+
+<aside tabindex="0" class="<% unless (length($side_bar) > 1) { %>off<% } elsif (stash('sidebar_active')) { %>active<% } %>">
<div>
-%= content_block 'sidebar'
+ %= $side_bar
</div>
</aside>