Skip to content

Commit

Permalink
Merge pull request #10 from miya0001/update-tests
Browse files Browse the repository at this point in the history
Update tests
  • Loading branch information
hfu committed Nov 29, 2015
2 parents 6d97bf7 + c2ad308 commit 35c2d1e
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 102 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rm -rf .git
rm -r .gitignore

echo ".bowerrc
.editorconfig
.travis.yml
bin
bower.json
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ gulp.task( 'default', [ 'minify' ], function () {
} );

gulp.task('test', function() {
return qunit( './tests.html' );
return qunit( './tests/tests.html' );
});
101 changes: 0 additions & 101 deletions tests.html

This file was deleted.

48 changes: 48 additions & 0 deletions tests/tests.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<!--INSERT-BASE-->
<meta charset='UTF-8'>
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" >
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="sandbox version of gsimaps">
<title>sandmaps</title>
<link rel="shortcut icon" href="../favicon.ico">
<link rel="apple-touch-icon" sizes="152x152" href="https://avatars1.githubusercontent.com/u/15714839?v=3&s=152">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="../leaflet-0.7.3/leaflet.css">
<link rel="stylesheet" href="../jquery/jquery-ui.min.css">
<link rel="stylesheet" href="../jquery/colorpicker/jquery.simple-color-picker.css"/>
<link rel="stylesheet" href="../leaflet-plugin/leaflet.label/leaflet.label-gsi.css"/>
<link rel="stylesheet" href="../leaflet-plugin/leaflet.draw/leaflet.draw-gsi.css"/>
<link rel="stylesheet" href="../css/gsimaps.css"/>
<script src="../leaflet-0.7.3/leaflet-src.js"></script>
<script src="../jquery/jquery-1.11.1.min.js"></script>
<script src="../jquery/ZeroClipboard2.0.2/ZeroClipboard.js"></script>
<script src="../jquery/jquery.xdomainrequest.min.js"></script>
<script src="../jquery/jquery-ui.min.js"></script>
<script src="../jquery/jquery.ui.touch-punch.js"></script>
<script src="../jquery/colorpicker/jquery.simple-color-picker.js"></script>
<script src="../jquery/ah-placeholder/jquery.ah-placeholder.js"></script>
<script src="../js/proj4js-combined.js"></script>
<script src="../leaflet-plugin/leaflet.label/leaflet.label.js"></script>
<script src="../leaflet-plugin/TileLayer.GeoJSON/TileLayer.GeoJSON-gsi.js"></script>
<script src="../leaflet-plugin/leaflet-omnivore/leaflet-omnivore.min.js"></script>
<script src="../leaflet-plugin/leaflet.draw/leaflet.draw-gsi.js"></script>
<script src="../leaflet-plugin/leaflet-hash/leaflet-hash-gsi.js"></script>
<script src="../js/gsimaps.min.js"></script>
<!-- ここから地図共有時使用 ※変更・削除しないでください -->
<script type="text/javascript">
/*INSERT-SCRIPT*/
</script>
<!-- ここまで地図共有時使用 -->
</head>
<body>

<div id="map"></div>

<script type='text/javascript' src='http://code.jquery.com/qunit/qunit-1.20.0.js'></script>
<script type='text/javascript' src='tests.js'></script>
</body>
</html>
23 changes: 23 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$( window ).on( 'load', function(){
test( 'Tests for #map', function( assert ){
// 地図がロードされた後に#mapオブジェクトの各属性の値を検査する。
assert.ok( $( '#map' ).hasClass( 'leaflet-container' ), '#map should has class "leaflet-container"' );
assert.ok( $( '#map' ).hasClass( 'leaflet-fade-anim' ), '#map should has class "leaflet-fade-anim"' );
assert.ok( "0" === $( '#map' ).attr( 'tabindex' ), 'tabindex of #map should be "0"' );
assert.equal( "0px", $( '#map' ).css( 'top' ), '#map should has style "top: 0px"' );

// 地図が表示された時のURLに含まれるハッシュの値を検査。
assert.equal( "#5/35.362222/138.731389", location.hash, 'URL should has hash "#5/35.362222/138.731389"' );

// 初期状態ではlayers以下のメニューは非表示
assert.equal( "none", $( '.menu_item_frame:eq(0)' ).css( 'display' ), '.menu_item_frame:eq(0) should be hide' );
} );

test( 'Tests for Navigations', function( assert ){
// layersボタンをクリックした際にメニューが表示されるかどうかをテスト
$( '.leaflet-control-container .menu_btn:eq(0)' ).on( 'click', function(){
assert.equal( "block", $( '.menu_item_frame:eq(0)' ).css( 'display' ), '.menu_item_frame:eq(0) should be block' );
} )
$( '.leaflet-control-container .menu_btn:eq(0)' ).trigger( 'click' ); // layersボタンクリックを強制的に発火
} );
} );

0 comments on commit 35c2d1e

Please sign in to comment.