Opened 12 years ago
Closed 8 years ago
#16193 closed New feature (fixed)
Use qunit to test javascript in django source
Reported by: | Owned by: | Nick Sandford | |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | testing javascript qunit |
Cc: | cmawebsite@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Use qunit to test javascript in django source, especially in contrib.admin.
I have a patch which tests some Date functions in core.js in the admin.
Attachments (1)
Change History (12)
Changed 12 years ago by
Attachment: | 16193.diff added |
---|
comment:1 Changed 12 years ago by
Code is in /tests/qunittests/
See README in this directory for instructions how to run the tests.
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Needs documentation: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Cleanup/optimization → New feature |
Note that some similar work has been done in https://github.com/sebleier/django/tree/qunit
It'd be interesting to compare the two approaches, and also coordinate to avoid duplicating work.
See also #16122.
comment:4 follow-up: 5 Changed 12 years ago by
Patch needs improvement: | set |
---|
Well, the approach we took on Github (Sebleier's fork) is much more generic and prepared for app centric test running.
comment:5 Changed 12 years ago by
Replying to jezdez:
Well, the approach we took on Github (Sebleier's fork) is much more generic and prepared for app centric test running.
I actually played a bit with that branch a couple of weeks ago and it's looking great. I was wondering if you guys had thought of a way to test the admin interface (e.g. dynamically adding or removing inlines)? This would require generating a DOM from the up-to-date admin templates and with some test data. Perhaps we need to introduce a management command to generate fresh HTML files from the latest admin codebase, so that these can be tested with the admin javascript via qunit. I haven't thought of it much beyond that, but I'll try to get to it next week.
comment:6 Changed 12 years ago by
I see that the sebleier/qunit branch is much further developed than I initially thought. I will add my tests to this branch.
comment:7 Changed 12 years ago by
Some relevant discussion on django-dev: http://groups.google.com/group/django-developers/browse_thread/thread/e0656d72e5e863d7
comment:8 Changed 9 years ago by
Figure we just want *something* to unit test the django admin javascript as a first pass to fixing the more general problem. PR here: https://github.com/django/django/pull/3003. Needs more tests, and still 31 jshint errors.
comment:9 Changed 9 years ago by
Owner: | changed from nobody to Nick Sandford |
---|---|
Status: | new → assigned |
comment:10 Changed 8 years ago by
Cc: | cmawebsite@… added |
---|
Do we still need this now that we have selenium tests?
comment:11 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In 2d0dead224b6448072b72b37d2fbcc8dc3afa007:
DEP 0003 -- Added JavaScript unit tests.
Setup QUnit, added tests, and measured test coverage.
Thanks to Nick Sanford for the initial tests.
qunit tests patch