Add test_trail.js, adapted from test_trail.rb
Fix tests on 0.6