Mercurial > gemma
diff client/docs/developers.md @ 4329:83eb99662a91
client: improve ability to test FW diagrams
* Restructure code in fairwayavailability.js to seperate external data
retrieval and adding the data into the store. Good side effects are
that using a mutation for setting test data is easier and only
one commit call is necessary, which means less clutter in the state history.
* Adding an example how to use this for testing to docs/developers.md .
* Bump copyright year for one file.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Wed, 04 Sep 2019 17:05:43 +0200 |
parents | b372fbe15300 |
children | 8ac59c8183e8 |
line wrap: on
line diff
--- a/client/docs/developers.md Wed Sep 04 16:45:59 2019 +0200 +++ b/client/docs/developers.md Wed Sep 04 17:05:43 2019 +0200 @@ -2,3 +2,31 @@ * [How translations are handled](dev-translations.md) * [Rationale of some choices](dev-generalconsiderations.md) + +## Hints + +When testing the vuex store object can be accessed from the +webbrowsers console like + +```javascript +store = document.getElementsByTagName('a')[0].__vue__.$store +``` + +This allows for setting test values where getting real test data +is complicated. For example testing the diagramm for the +fairwayavailability (tested with Chromium 73 und gemma-2019-09-04): + +```javascript +data = store.state.fairwayavailability.csv + +data=`#time,# < LDC (164.0) [h],# >= LDC (164.0) [h],# < 230.0 [h],# >= 230.0 [h],# >= 250.0 [h] +05-2019,140,80,80,45,50 +06-2019,0,230.000,0.000,0.000 +07-2019,0,300,0.000,0.000,0.000 +08-2019,0.000,120.000,0.000,0.000,120.000 +` + +store.commit("fairwayavailability/setAvailableFairwayDepthData", data) +``` + +(Depends on the code structure in store/fairwayavailability.js.)