Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Prevent default bug #1246

Merged
merged 4 commits into from
Aug 10, 2012
Merged

Prevent default bug #1246

merged 4 commits into from
Aug 10, 2012

Conversation

IgorMinar
Copy link
Contributor

No description provided.

the original test relied on incorrect assumptions about how jasmine async
tests work (when setTimeout is triggered) and how browser reloads a page
(the sequence of events) and thus the test passes even when the default
is not prevented.

this change fixes the test by registering an extra submit event handler
that checks if the default was prevented.

if the default was not prevented, the test will fail and the page will
be reloaded causing the test runner to panic.
this fix ensures that we prevent the default action on form submission
(full page reload) even in cases when the form is being destroyed as
a result of the submit event handler (e.g. when route change is
triggered).

The fix is more complicated than I'd like it to be mainly because
we need to ensure that we don't create circular references between
js closures and dom elements via DOM event handlers that would then
result in a memory leak.

Also the differences between IE8, IE9 and normal browsers make testing
this ugly.

Closes angular#1238
@mhevery
Copy link
Contributor

mhevery commented Aug 10, 2012

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants