Skip to content

Commit

Permalink
Add test linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpmcmlxxvi committed Jun 14, 2019
1 parent 8940100 commit 0d13137
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 147,854 deletions.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@
"lint:js": "eslint '*.js' 'docs/examples/js/example.*.js' 'src/js/*.js'",
"lint:md": "remark -q .",
"prepare": "npm run build",
"test": "run-s test:clean test:run test:coverage",
"test": "run-s test:clean test:lint test:run test:coverage",
"test:clean": "shx rm -rf coverage .nyc_output",
"test:coverage": "nyc report --reporter=lcov",
"test:lint": "run-s test:lint:*",
"test:lint:css": "stylelint 'test/*.css'",
"test:lint:html": "run-s test:lint:html:*",
"test:lint:html:hint": "htmlhint 'test/*.html'",
"test:lint:html:pretty": "prettier --check 'test/*.html'",
"test:lint:js": "eslint 'test/*.js'",
"test:run": "jest"
},
"files": [
Expand Down
4 changes: 4 additions & 0 deletions test/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#explorer {
width: 1000px;
height: 500px;
}
63 changes: 25 additions & 38 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenLayers Explorer Test</title>
<meta charset="utf-8">
<link href="./libs/ol3/ol.css" rel="stylesheet" type="text/css" />
<link href="./libs/w2ui/w2ui.css" rel="stylesheet" type="text/css" />
<link href="../dist/olexp.css" rel="stylesheet" type="text/css" />
<style>
#explorer {
width: 1000px;
height: 500px;
}
</style>
</head>
<body>
<div id="explorer"></div>
<div id="overlay"></div>
<script src="./libs/jquery/jquery.js"></script>
<script src="./libs/ol3/ol.js"></script>
<script src="./libs/w2ui/w2ui.js"></script>
<script src="../dist/olexp.js"></script>
<script>
const explorer = new olexp.Explorer('explorer');
const data = (() => {
const coordinate = [-77.016389, 38.904722];
const position = ol.proj.transform(coordinate, 'EPSG:4326', 'EPSG:3857');
const geometry = {type: 'Point', coordinates: position};
const geojson = {type: 'Feature', geometry: geometry, properties: {}};
const features = (new ol.format.GeoJSON()).readFeatures(geojson);
const source = new ol.source.Vector({features: features});
const element = document.getElementById('overlay');
const vector = new ol.layer.Vector({source: source});
const group = new ol.layer.Group({layers: [vector]});
const overlay = new ol.Overlay({position, element, stopEvent: false});
const tile = new ol.layer.Tile({source: new ol.source.OSM()});
return {group, overlay, tile, vector};
})();
</script>
</body>
<head>
<title>OpenLayers Explorer Test</title>
<meta charset="utf-8" />
<link
href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.14.2/ol.min.css"
rel="stylesheet"
type="text/css"
/>
<link
href="https://unpkg.com/w2ui@1.4.3/w2ui.min.css"
rel="stylesheet"
type="text/css"
/>
<link href="../dist/olexp.css" rel="stylesheet" type="text/css" />
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="explorer"></div>
<div id="overlay"></div>
<script src="https://unpkg.com/jquery@2.1.3/dist/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.14.2/ol.js"></script>
<script src="https://unpkg.com/w2ui@1.4.3/w2ui.min.js"></script>
<script src="../dist/olexp.js"></script>
<script src="index.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
window.explorer = new olexp.Explorer('explorer');
window.data = (() => {
const coordinate = [-77.016389, 38.904722];
const position = ol.proj.transform(coordinate, 'EPSG:4326', 'EPSG:3857');
const geometry = {type: 'Point', coordinates: position};
const geojson = {type: 'Feature', geometry: geometry, properties: {}};
const features = (new ol.format.GeoJSON()).readFeatures(geojson);
const source = new ol.source.Vector({features: features});
const element = document.getElementById('overlay');
const vector = new ol.layer.Vector({source: source});
const group = new ol.layer.Group({layers: [vector]});
const overlay = new ol.Overlay({position, element, stopEvent: false});
const tile = new ol.layer.Tile({source: new ol.source.OSM()});
return {group, overlay, tile, vector};
})();
Loading

0 comments on commit 0d13137

Please sign in to comment.