Commit b3e7aed9 authored by August Thornton's avatar August Thornton Committed by SaltNPepa
Browse files

update acceptance use policy to be an actual link

Included a non-empty href attribute to the Link component
so we generated the appropriate <a> tag. had to re-work how
we populate this compononent because rendering links within
links is not desirable behavior when working with React
components.

refs FOO-2754
flag = none

Test plan:
1. Account --> Settings
2. Acceptable Use Policy --> uncheck
   "Allow passive acceptance of Terms of Service"
3. Have a user with: user.preferences[:accepted_terms] = nil
4. At the login screen verify "Acceptable Use Policy" link
   looks formatted in-line with the other links in the footer
5. Log in with that user and verify that the
   Acceptance Use Policy modal links are underlined by default
6. Accept the policy and verify the links rendered in the footer
   of the user's Dashboard are also formatted appropriately,
   specifically the "Acceptable Use Policy" link that is now
   underlined by default for better accessibility.

Change-Id: I428911ec1fcacbb66c39e45a4fe5242bb694d39d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287852

Tested-by: default avatarService Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: default avatarAhmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: August Thornton <august@instructure.com>
parent 16439037
......@@ -972,8 +972,8 @@ module ApplicationHelper
end
def add_uri_scheme_name(uri)
noSchemeName = !uri.match(%r{^(.+)://(.+)})
uri = "http://" + uri if noSchemeName
no_scheme_name = !uri.match(%r{^(.+)://(.+)})
uri = "http://" + uri if no_scheme_name
uri
end
......@@ -981,10 +981,7 @@ module ApplicationHelper
# may be overridden by a plugin
@agree_to_terms ||
I18n.t(
"I agree to the *terms of use*.",
wrapper: {
"*" => link_to('\1', "#", class: "terms_of_service_link")
}
"I agree to the *terms of use*.", wrapper: '<span class="terms_of_service_link">\1</span>'
)
end
......
......@@ -40,9 +40,7 @@
<p>
<div class="terms-of-service__link" id=terms_of_service_link></div>
<%= t "Either you're a new user or the *terms of use* has changed since you last agreed to it. Please agree to the *terms of use* before you continue.",
wrapper: {
'*' => link_to('\1', "#", class: 'terms_of_service_link'),
}
wrapper: '<span class="terms_of_service_link">\1</span>'
%>
</p>
<label class="checkbox">
......
......@@ -33,13 +33,13 @@ QUnit.module('Terms of Service Modal Link', {
test('renders correct link when preview is provided', () => {
ENV.TERMS_OF_SERVICE_CUSTOM_CONTENT = 'Hello World'
const wrapper = mount(<TermsOfServiceModal preview />)
const renderedLink = wrapper.find('button')
const renderedLink = wrapper.find('a')
equal(renderedLink.text(), 'Preview')
})
test('renders correct link when preview is not provided', () => {
ENV.TERMS_OF_SERVICE_CUSTOM_CONTENT = 'Hello World'
const wrapper = mount(<TermsOfServiceModal />)
const renderedLink = wrapper.find('button')
const renderedLink = wrapper.find('a')
equal(renderedLink.text(), 'Acceptable Use Policy')
})
......@@ -59,8 +59,8 @@ describe "self enrollment" do
move_to_click("#initial_action label[for=selfEnrollmentAuthRegCreate]")
wait_for_ajaximations
f("#student_name").send_keys("new guy")
# terms of use button should be populated by TermsOfServiceModal.js
expect(fj("button:contains('Acceptable Use Policy')")).to be_displayed
# terms of use link should be populated by TermsOfServiceModal.js
expect(fj("a:contains('Acceptable Use Policy')")).to be_displayed
driver.execute_script("$('#enroll_form label[for=selfEnrollmentAuthRegLoginAgreeTerms]').click()") # because clicking the label clicks on the links in the label
expect_new_page_load do
submit_form("#enroll_form")
......
......@@ -90,6 +90,7 @@ export default class TermsOfServiceModal extends React.Component {
elementRef={c => {
this.link = c
}}
href="#"
onClick={this.handleLinkClick}
>
{this.props.preview ? I18n.t('Preview') : termsOfServiceText}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment