diff --git a/.gitignore b/.gitignore index c092076b..edb632c1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ spec/**/*.min.js src/**/*.min.js src/**/*.min.css dist/ +e2e/results/ +e2e/reports/ +/playwright/.cache/ diff --git a/README.md b/README.md index 40aa06b0..931b0347 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,10 @@ _For a working example see one of the following demos:_ - [autohide map](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-map.html) - [autohide chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_hidden-chart.html) +- [clear button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_clear-button.html) - [collapsible button](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_close-button.html) - [custom summary](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_custom-summary.html) +- [edge scale control](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_edge-scale.html) - [follow marker](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_follow-marker.html) - [layer almostover](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_almost-over.html) - [slope chart](https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_slope-chart.html) @@ -153,6 +155,9 @@ _For a working example see one of the following demos:_ // Toggle "leaflet-distance-markers" integration distanceMarkers: false, + + // Toggle "leaflet-edgescale" integration + edgeScale: false, // Toggle "leaflet-hotline" integration hotline: true, @@ -195,19 +200,19 @@ _For a working example see one of the following demos:_ ### Build Guide -For those wishing to try cloning this repository into a local development folder (eg. /var/www): +Within your local development environment: ```shell git clone git@github.com:Raruto/leaflet-elevation.git cd ./leaflet-elevation npm i # install dependencies -npm run watch # auto-generate "dist" files +npm run dev # start dev server at: http://localhost:8080 npm run build # generate "dist" files (once) -npm run test # test "spec" files (once) +npm run test # test all ".*spec.js" files (once) ``` -After that you can start developing inside the `src` and `test` folders (eg. open "http://localhost/leaflet-elevation/test" in your browser to preview changes). Check also [CONTRIBUTING.md](.github/CONTRIBUTING.md) file for some information about it. +After that you can start developing inside the `src` and `test` folders (eg. open "http://localhost:8080/test" in your browser to preview changes). Check also [CONTRIBUTING.md](.github/CONTRIBUTING.md) file for some information about it. ### FAQ diff --git a/build/rollup.config.js b/build/rollup.config.js index 8999a649..58be53d4 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -1,12 +1,14 @@ -import { terser } from "rollup-plugin-terser"; -import resolve from 'rollup-plugin-node-resolve'; -import commonJS from 'rollup-plugin-commonjs'; +import terser from '@rollup/plugin-terser'; +import resolve from '@rollup/plugin-node-resolve'; +import commonJS from '@rollup/plugin-commonjs'; import postcss from 'rollup-plugin-postcss'; import postcssImport from 'postcss-import'; + // import postcssCopy from 'postcss-copy'; -import rollupGitVersion from 'rollup-plugin-git-version'; +// import rollupGitVersion from 'rollup-plugin-git-version'; + +import plugin from '../package.json' assert { type: "json" }; -let plugin = require('../package.json'); let plugin_name = plugin.name.replace("@raruto/", ""); let input = plugin.module; @@ -15,7 +17,6 @@ let output = { format: "umd", sourcemap: true, name: plugin_name, - }; let plugins = [ @@ -23,7 +24,7 @@ let plugins = [ commonJS({ include: '../node_modules/**' }), - rollupGitVersion(), + // rollupGitVersion(), ]; export default [ diff --git a/examples/leaflet-elevation.html b/examples/leaflet-elevation.html index f561ae5e..351635f0 100644 --- a/examples/leaflet-elevation.html +++ b/examples/leaflet-elevation.html @@ -17,8 +17,8 @@ - - + + diff --git a/examples/leaflet-elevation.spec.js b/examples/leaflet-elevation.spec.js new file mode 100644 index 00000000..7bc1e9a9 --- /dev/null +++ b/examples/leaflet-elevation.spec.js @@ -0,0 +1,19 @@ +/** + * examples/leaflet-elevation.html + */ + +import * as assert from 'uvu/assert'; +import { suite } from '../test/setup/http_server.js'; + +const test = suite('examples/leaflet-elevation.html'); + +test('eledata_loaded', async ({ page }) => { + const gpx = await page.evaluate(() => new Promise(resolve => { + controlElevation.on('eledata_loaded', (gpx) => resolve(gpx)); + })); + assert.is(gpx.name, 'via-emilia.gpx'); + assert.not.type(gpx.layer, 'undefined'); + assert.type(gpx.track_info.distance, 'number'); +}); + +test.run(); \ No newline at end of file diff --git a/examples/leaflet-elevation_almost-over.html b/examples/leaflet-elevation_almost-over.html index 2024995c..0031936f 100644 --- a/examples/leaflet-elevation_almost-over.html +++ b/examples/leaflet-elevation_almost-over.html @@ -33,8 +33,8 @@ plugins: [ // 'leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js', // 'leaflet-almostover@1.0.1/src/leaflet.almostover.js', - '@raruto/leaflet-elevation@2.2.8/dist/leaflet-elevation.min.css', - '@raruto/leaflet-elevation@2.2.8/dist/leaflet-elevation.min.js' + '@raruto/leaflet-elevation@2.3.0/dist/leaflet-elevation.min.css', + '@raruto/leaflet-elevation@2.3.0/dist/leaflet-elevation.min.js' ], // see: L.AlmostOver for more info almostOver: true, diff --git a/examples/leaflet-elevation_clear-button.html b/examples/leaflet-elevation_clear-button.html new file mode 100644 index 00000000..b50b4a4f --- /dev/null +++ b/examples/leaflet-elevation_clear-button.html @@ -0,0 +1,137 @@ + + + +
+