Skip to content

Conversation

@alexandercyu
Copy link
Contributor

Tests for the functions in dataproduct-form.js.

Add module exports for tests
Change gitignore to only ignore the node files in the tests directory
Add initializeUploadDiv function to the test
Add tests for dataproduct-form.js
jest configs for vanilla JS
Dependencies for tests
Package-lock file for tests node environment
Add exports for functions to be tested.
In Progress

- add tests for functions in dataproduct-form.js
-add test for updateIndex() function -> tests that the correct index number is output
- add test for initializePointInputDiv() function -> tests that the coordinate input fields are added when a geometry that is not geojson or null is chosen
- add test for initializeUploadDiv() -> tests that the function adds the textarea for geometry if geojson is chosen
- add test for createInputCoordinatesRow() -> test that a new row of inputs for geometry coordinates is created
- In progress: test addPoint() function
-Change initialization of Geometry input to use addPoint function instead of creatInputCoordinatesRow function

- TODO: find out why Remove buttons are added to the default input rows
- Refactored createInputCoordinatesRow() and addPoint() functions into one function.  Only addPoint() will be called when initializing the input rows for the Geometry section and when adding new  coordinate input rows for a geometry
- removed createInputCoordinatesRow() function
- removed calls to createInputCoordinatesRow() function
- added parameter in addPoint() to denote when the function is being called to create initial input rows or adding input rows
- removed condition in addPoint() to show the Remove button  specifically for the first input row when additional input rows are added
- uncommented page redirect that was commented for testing
- removed createInputCoordiantesRow from testing exports
- remove the previous export object for addPointTest (addPoint exported through module)
- add exports for addAuthor, addModel, addOther, geoPolygon2
- add imports for geoPolygon2, addAuthor, addModel, addOther
- remove import for createInpurCoordinatesRow
-add a beforeEach hook that sets up the HTML elements the DOM manipulator tests will use
- add tests for geoPolygon2, addAuthor, addOther
- In progress: test for addModel
- added nunjucks requirement for rendering jinja template for testing Model section inputs
- added "geojson" and "geonull" entries for testing geoPolygon2 function
- added template data and template string for nunjucks to render
Indented template tag for bette readability
Added nunjucks as a dependency
Added nunjucks as a dependency
- added ID to remove Author button, as revealed by test
Add ID for remove buttons in the Geometry section
- Comment out the dropdownTemplate function in the beforeEach setup because this doesn't generate a usable dropdown for use in the test (maybe it can be reworked later)
- add the removeEntry click event listener for the test
- change comment syntax type for readability
- create the dropdowns for Model using nunjucks strings so the function reading from the 'template' tag doesn't throw an error. (Test for Model section cannot be made due to nunjucks string)
- add test for removeEntry and makeInputRequired functions
edited test description
- try to use flatpickr for test involving calendar fields
-> doesn't work as expected
-> comment out flatpickr import and use to avoid errors when running tests

- add test for showHideModelInput function
changed .required to : required for input fields
moved dataproduct-form.js call back to top of page
- remove checkRequired function and call in submitForm function
- add condition that runs checkValidity to check for form validity
- put submitForm code in a condition that checks for form validity before executing submitForm code
- fix issue with validity error message showing on the 'Key' input field in the 'Other' section when there is a value in the 'Key' input field and no value in the 'Value' field
- added condition to encapsulate exports for tests
-replaced pseudo class 'invalid' with pseudo class 'user-invalid' to allow the validation styles to be used only when the user interacts with the form elements
- replaced the class 'required' with the pseudo class ':required' so the 'required' class no longer needs to be added to the element to show the validation styles
Removed unneeded function call
- removed wrong import statement
- removed commented code
- added flatpickr initialization
- split the test for the removeEntry function into tests for Author, Geometry
- add test for removeEntry function for the Other section
Remove the code that manually replaces newline and blanks in the geojson string input . JSON.parse automatically removes it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants