Fix up broken js-tests.
Review Request #10291 — Created Oct. 29, 2018 and submitted
We had a few JavaScript unit tests which were broken, with two specific
causes:
- For the
ScrollManagerView
, chrome has been doing sub-pixel
scrolling, which broke our tests. I've sprinkled someMath.round()
calls around to fix this. - For the
ReviewReplyEditorModel
, an update to Backbone had broken
some tests which artificially assign an ID in order forisNew()
to
returnfalse
. The newerisNew()
checks theid
attribute
instead of the value in the object.
Ran js-tests.
-
-
reviewboard/static/rb/js/reviewRequestPage/models/tests/reviewReplyEditorModelTests.js (Diff revision 1) If we call
set('id', ...)
instead, this will take care of both. We should be doing that for IDs going forward. -
reviewboard/static/rb/js/reviewRequestPage/models/tests/reviewReplyEditorModelTests.js (Diff revision 1) Same here.
-
reviewboard/static/rb/js/ui/views/scrollManagerView.es6.js (Diff revision 1) I'm not sure it's correct to round it here. I can see rounding for the tests, but I think interfering with original values here will throw off calculations. Or if we need to round, doing it when applying the new location might be better.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+30 -32) |
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+31 -36) |
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.