make LTI Iframe title the tool name

flag=none
closes INTEROP-6915

Test plan:
- launch an LTI 2 tool in such a way that uses AddExternalToolButton
  (to register to tool)
- check that the iframe title is "Register Tool"
- launch tools in the following ways and inspect element and check that
  the iframe title is the name of the tool:
- launch an LTI 2 tool in such a way that uses
  ReregisterExternalToolButton
- launch an LTI 1.1 tool
- launch an LTI 1.3 tool

Change-Id: I1ec93a2e3ee89acb5fac689fbbf1896d635a3726
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270090
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
This commit is contained in:
Evan Battaglia 2021-07-27 11:48:24 -06:00
parent 61463046bf
commit 6b21e384d5
5 changed files with 13 additions and 4 deletions

View File

@ -80,7 +80,7 @@
webkitallowfullscreen: "true",
mozallowfullscreen: "true",
tabindex:"0",
title:t('Tool Content'),
title: @lti_launch.link_text,
style: "height:#{@lti_launch.tool_dimensions[:selection_height]};width:#{@lti_launch.tool_dimensions[:selection_width]};",
allow: Lti::Launch.iframe_allowances(request.user_agent).join('; '),
data: { 'lti-launch': true }

View File

@ -37,7 +37,8 @@ QUnit.module('ExternalApps Lti2Iframe', suiteHooks => {
props = {
handleInstall() {},
registrationUrl: 'http://localhost/register',
reregistration: false
reregistration: false,
toolName: 'The best LTI tool ever'
}
})
@ -97,6 +98,11 @@ QUnit.module('ExternalApps Lti2Iframe', suiteHooks => {
renderComponent()
equal(getIframe().getAttribute('data-lti-launch'), 'true')
})
test('sets the iframe title', () => {
renderComponent()
equal(getIframe().getAttribute('title'), 'The best LTI tool ever')
})
})
QUnit.module('"handleInstall" prop', hooks => {

View File

@ -267,6 +267,7 @@ export default class AddExternalToolButton extends React.Component {
handleInstall={this.handleLti2ToolInstalled}
registrationUrl={this.state.lti2RegistrationUrl}
hideComponent={!this.state.isLti2}
toolName={I18n.t('Register Tool')}
>
<div className="ReactModal__Footer">
<div id="footer-close-button" className="ReactModal__Footer-Actions">

View File

@ -26,7 +26,8 @@ export default class Lti2Iframe extends React.Component {
reregistration: PropTypes.bool,
registrationUrl: PropTypes.string,
handleInstall: PropTypes.func.isRequired,
hideComponent: PropTypes.bool
hideComponent: PropTypes.bool,
toolName: PropTypes.string.isRequired
}
state = {
@ -120,7 +121,7 @@ export default class Lti2Iframe extends React.Component {
src={this.getLaunchUrl()}
name="lti2_registration_frame"
className="tool_launch"
title={I18n.t('Tool Content')}
title={this.props.toolName}
style={this.state.iframeStyle}
ref={e => {
this.iframe = e

View File

@ -78,6 +78,7 @@ export default class ReregisterExternalToolButton extends React.Component {
handleInstall={this.handleReregistration}
registrationUrl={this.props.tool.reregistration_url}
reregistration
toolName={this.props.tool.name || I18n.t('Tool Content')}
/>
</Modal.Body>
</Modal>