-
Notifications
You must be signed in to change notification settings - Fork 0
Add tests for the data product form functions. #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexandercyu
wants to merge
31
commits into
main
Choose a base branch
from
add-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tests for the functions in dataproduct-form.js.