Skip to content

Instantly share code, notes, and snippets.

@qmaruf
Created January 30, 2014 19:38
Show Gist options
  • Save qmaruf/8717089 to your computer and use it in GitHub Desktop.
Save qmaruf/8717089 to your computer and use it in GitHub Desktop.
jasmine test for unsaved redirection
describe("display alert for unsaved publisher content", function(){
it('should display confirm dialog if text exists in status message', function(){
$('#status_message_fake_text').val('Hello world');
spyOn(window, 'confirm');
$(window).trigger('beforeunload')
expect(window.confirm).toHaveBeenCalled();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment