Created
July 6, 2012 13:19
-
-
Save JamesMaroney/3060109 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'shared/dialog/dialog_view_host': isolate.mapAsFactory (actualDialog, dialogViewName, requestingModule)-> | |
rendermakeSpy = makeSpy 'Isolated Dialog Render' | |
closeDialog = makeSpy 'Isolated Dialog Close' | |
fakeDialog = (makeSpy 'Isolated Dialog Initializer').andCall (viewRenderer)-> | |
try | |
glee.DONT_CALL_INITIALIZE = true | |
viewRenderer jQuery('<div />'), closeDialog | |
catch ex | |
requestingModule = requestingModule.replace(/.*\//,'') | |
viewName = ex.stack.replace(/^(?:.|\n)*requirements.*\/(.*)\.js(.|\n)*/, '$1') | |
throw Error "Contract Mismatch rendering view in dialog: #{requestingModule} >>> #{viewName}:\n"+ (+ex || ex.message || ex.toString()) | |
finally | |
glee.DONT_CALL_INITIALIZE = false | |
return this | |
fakeDialog.prototype.render = rendermakeSpy | |
rendermakeSpy.andReturn fakeDialog | |
fakeDialog.render = rendermakeSpy | |
fakeDialog.close = closeDialog | |
fakeDialog.dialog = makeSpy 'Isolated Dialog.dialog' | |
for method in ['medium', 'large'] | |
fakeDialog[method] = Spy(method).andCall fakeDialog | |
return fakeDialog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment