File: coffee.t

package info (click to toggle)
libmojolicious-plugin-assetpack-perl 2.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,888 kB
  • sloc: perl: 1,503; javascript: 52; makefile: 8; sh: 2
file content (18 lines) | stat: -rw-r--r-- 558 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use lib '.';
use t::Helper;
plan skip_all => 'TEST_COFFEE=1' unless $ENV{TEST_COFFEE} or -e '.test-everything';

my $t = t::Helper->t(pipes => [qw(CoffeeScript JavaScript)]);
$t->app->asset->process('app.js' => 'foo.coffee');
$t->get_ok('/')->status_is(200)->element_exists(qq(script[src="/asset/e4c4b04389/foo.js"]));

$t->get_ok($t->tx->res->dom->at('script')->{src})->status_is(200)
  ->content_like(qr{console.log\('hello from foo coffee'\)});

done_testing;

__DATA__
@@ index.html.ep
%= asset 'app.js'
@@ foo.coffee
console.log 'hello from foo coffee'