Skip to content

Commit

Permalink
fix compatibility with Mojolicious 7.0
Browse files Browse the repository at this point in the history
thanks @eserte

closes #51
  • Loading branch information
jberger committed Aug 13, 2016
1 parent f67b6ed commit 484fd4d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
Revision history for Perl module Galileo

0.041 2016-08-13
- Fix compatibility with Mojolicious 7.0

0.040 2016-01-07
- Remove jQueryUI in favor of html5sortable
- Fix a couple setup app bugs (Ulrich Herbst, Dirk Koopman)++
Expand Down
2 changes: 1 addition & 1 deletion lib/Galileo.pm
@@ -1,7 +1,7 @@
package Galileo;
use Mojo::Base 'Mojolicious';

our $VERSION = '0.040';
our $VERSION = '0.041';
$VERSION = eval $VERSION;

use File::Basename 'dirname';
Expand Down
2 changes: 1 addition & 1 deletion lib/Galileo/Menu.pm
Expand Up @@ -66,7 +66,7 @@ sub store {
$self->send({ json => {
message => 'Changes saved',
success => \1,
content => b($content)->squish,
content => b($content)->trim,
} });
});
}
Expand Down
18 changes: 14 additions & 4 deletions t/basic.t
Expand Up @@ -7,10 +7,19 @@ use Test::Mojo;
use Mojo::JSON 'j';
use Mojo::DOM;
use Mojo::JSON qw/true false/;
use Mojo::Util 'trim';

my $t = Galileo::DB::Deploy->create_test_object({test => 1});
$t->ua->max_redirects(2);

my $trimmed_text_is = sub {
my ($t, $selector, $expect, $desc) = @_;
$desc //= qq[exact match for selector "$selector"];
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $text = trim($t->tx->res->dom->at($selector)->text || '');
$t->success(is $text, $expect, $desc);
};

subtest 'Anonymous User' => sub {

# landing page
Expand Down Expand Up @@ -149,7 +158,7 @@ subtest 'Edit Main Navigation Menu' => sub {
# check about page is in nav
$t->get_ok('/admin/menu')
->status_is(200)
->text_is( 'ul#main > li:nth-of-type(4) > a' => $title )
->$trimmed_text_is( 'ul#main > li:nth-of-type(4) > a' => $title )
->text_is( '#list-active-pages > #pages-2 > span' => $title );

# remove about page from list
Expand Down Expand Up @@ -196,13 +205,14 @@ subtest 'Edit Main Navigation Menu' => sub {
->new(j($t->message->[1])->{content})
->find('#nav_menu li')
->map('all_text')
->map(\&trim)
->each;
is_deeply \@items, ['Navigation', 'Home', 'Syntax', $title];

# check about page is back in nav (same as first test block)
$t->get_ok('/admin/menu')
->status_is(200)
->text_is( 'ul#main > li:nth-of-type(4) > a' => $title )
->$trimmed_text_is( 'ul#main > li:nth-of-type(4) > a' => $title )
->text_is( '#list-active-pages > #pages-2 > span' => $title );

my @ids = $t->tx->res->dom->find('#list-active-pages li')->map(attr =>'id')->each;
Expand Down Expand Up @@ -256,8 +266,8 @@ subtest 'Administer Users' => sub {
->status_is(200)
->element_exists( 'input#name[placeholder=admin]' )
->element_exists( 'input#full[value="Joe Admin"]' )
->element_exists( 'input#is_author[checked=1]' )
->element_exists( 'input#is_admin[checked=1]' );
->element_exists( 'input#is_author:checked' )
->element_exists( 'input#is_admin:checked' );

# change name
my $data = {
Expand Down

0 comments on commit 484fd4d

Please sign in to comment.