-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Reviewed Additional Javascript Tests #247
base: master
Are you sure you want to change the base?
Conversation
signalhandlers.patch_url_conf calls get_urlconf with a single argument.
It's awkward to be able to drop the success handler anywhere, but not be able to move it aftewards.
If we disable the submit button in the submit handler, the browser won't submit its value. We need this value to determine which button was pressed.
Models with WidgyFields should define a get_action_links method. It takes a root_node and returns a list of links. This is used for preview links. - Removes the dependency in core on widgy_mezzanine for preview links - Removes the VersionCommitAdmin.get_commit_name and get_commit_preview_url methods. - Removes an attempt at making forms.WidgyField work for non-model forms. We'll revisit this when it comes up. - Adds preview and diff links for every owner of a VersionTracker.
Because "Django uses different formats for displaying data to those it uses for parsing data", when using i18n and having a LANGUAGE_CODE other than 'en', but still viewing the page in English, the widget will output with the wrong format.
require.js loads data-main asynchronously, so our inline javascript to instantiate widgy sometimes runs before require is configured. This results in require not being able to find libraries, and widgy fails to start. This fixes the intermittent 'blank widgy editor' bug. Also fixes a hardcoding of `/static/` paths when `{% static %}` should be used instead.
Why not both?
This test has not been testing anything for a while, because passing HTTP_COOKIE to the test-client methods was overriding the test client's cookies, including the session that had a logged-in user. The test verified that a 403 was being returned, but the 403 wasn't from where we expected (the UnauthenticatedWidgySite). Also, UnauthenticatedWidgySite was overriding `authorize`, which doesn't exist any more. The new method is called `authorize_view`, but this wasn't detected because the test isn't robust enough. This patch mocks widgy_site.authorize_view method to ensure it's called, instead of relying on the PermissionDenied exception. This also allows us to get rid of UnauthenticatedWidgySite.
Debug toolbar loads all the panel modules regardless of settings.DEBUG. If we monkey patch at the module level, we'll always replace get_templates_hierarchy, even in production mode.
Until Django bug #20806 is fixed, we should memoize select_template because we call it many times with long lists of templates to choose from. This results in a large speedup while rendering the editors for large trees.
The request to fetch compatibility data for the shelf can start before Widgy is done rendering. This results in less latency for the shelf to be ready.
Instead of making a .drag_placeholder element and trying to get it to behave exactly like the shelf item, just clone the shelf item. This prevents the rest of the items from moving at all when picking up a widget. Co-Authored-By: Antoine Catton <acatton@fusionbox.com>
Co-Authored-By: Justin Stollsteimer <jstollsteimer@gmail.com>
Use django-require to bundle Widgy's js during collectstatic. `widgy-main.js` is a stub that gets turned into the widgy js bundle during collectstatic. This allows us to always include it during development. Since it doesn't do anything, require.js will work as normal (lazily loading everything), until the bundle gets built.
* require: cachebust require.js in development Fix css paths to make it work with CachedStaticFilesStorage Use the require.js optimizer
|
||
var create_editor = function(node) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions are general camelcased in widgy's javascript. I know it's not important, but it would be nice to be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you are getting at here. What would you like changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you call it createEditor
instead please?
@rockymeza, I made the remaining changes, how do you want this squashed since we have some changes from @clarkbarz at some point there? |
Hi @zmetcalf, I'm not sure how we should go about restructuring the commits. @gavinwahl, thoughts? |
js_tests/tests/test_draggableview.js
Outdated
_ = requirejs('underscore'); | ||
|
||
describe('DraggableView', function() { | ||
var TestView = DraggableView.extend({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this class.
@zmetcalf, we're getting a lot closer to a merge! I just have some more comments that we should address before squashing. I think some of the comments must have gotten lost as you were making updates. |
@clarkbarz reviewed the javascript tests in pull request #128, which was requested in #127.