remove all externalContentReady on close

fixes PLAT-1428, PLAT-1805

test plan:
create an assignment
select a cotent-item tool from the RCE
cancel the selection by closing the modal
select the external tool for submission type
there shouldn't be any items in the RCE

Change-Id: I19c3bac821f470b8754ace9879f8a8a43fb6a19f
Reviewed-on: https://gerrit.instructure.com/90326
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
This commit is contained in:
Nathan Mills 2016-09-14 11:10:54 -06:00
parent 10c93e701c
commit e4455d09da
2 changed files with 16 additions and 0 deletions

View File

@ -140,6 +140,7 @@ define([
close: function(){
$dialog.find("iframe").attr('src', '/images/ajax-loader-medium-444.gif');
$(window).off('beforeunload', ExternalToolsPlugin.beforeUnloadHandler);
$(window).unbind("externalContentReady");
}
});
$(window).on('beforeunload', ExternalToolsPlugin.beforeUnloadHandler);

View File

@ -71,3 +71,18 @@ define [
}
}] } )
ok ExternalToolsPlugin.dialogCancelHandler.notCalled
test "it removes the externalContentReady handler on close", ()->
externalContentReadySpy = sinon.spy()
ExternalToolsPlugin.dialogCancelHandler = ()->
$dialog = ExternalToolsPlugin.buttonSelected(@buttonSpy, @fakeEditor)
$(window).bind("externalContentReady", externalContentReadySpy)
$dialog.dialog('close')
$(window).trigger("externalContentReady", { contentItems: [{
"@type": 'LtiLinkItem',
url: 'http://canvas.instructure.com/test',
placementAdvice: {
presentationDocumentTarget: ""
}
}] } )
ok externalContentReadySpy.notCalled