add Jasmine AJAX tests for tagging.js #812
Labels
help wanted
requires help by anyone willing to contribute
JavaScript
testing
issues are usually for adding unit tests, integration tests or any other tests for a feature
Projects
Currently tagging is done in tag forms on any note (like this one) in a form; the HTML is here:
https://github.com/publiclab/plots2/blob/master/app/views/tag/_tagging.html.erb
And the javascript is here:
https://github.com/publiclab/plots2/blob/master/app/assets/javascripts/tagging.js
This code is not tested in our Jasmine testing framework, but I've stubbed a test out in this PR (#813, which will be merged soon), but disabled the tests. The tests are not complete, and changing
xit()
toit()
will activate them, and they will fail.This issue is a request for help with building out these tests to test our major javascript functions in tagging.js. It will require asynchronous AJAX calls in Jasmine.
Note that the server will normally respond with simply the
tag_id
of the successfully deleted tag, as in this line of server-side code. That's read by the ajax response handler here:See the following resources:
Please ask if you have questions, this is a bit complex but if you're hoping to learn about integration testing of JavaScript client-side code and its interaction with a server API, this is a good example!
The text was updated successfully, but these errors were encountered: