Commit e1b3bbfc by cahrens

Enable the preview button if the submit button is enabled.

Really, the preview button should be enabled whenever there
is something to render. Since the submit button will only be
disabled upon initial rendering if there is nothing to submit,
it seems like a reasonable proxy.
parent 9b682b64
......@@ -115,7 +115,8 @@
</li>
{% if allow_latex %}
<li class="list--actions__item">
<button type="submit" class="submission__preview action action--save" aria-describedby="response__preview_explanation__{{ xblock_id }}">
<button type="submit" class="submission__preview action action--save" aria-describedby="response__preview_explanation__{{ xblock_id }}"
{{submit_enabled|yesno:",disabled" }}>
{% trans "Preview in LaTeX"%}
</button>
<div id="response__preview_explanation__{{ xblock_id }}" class="response__submission__label">
......
......@@ -85,7 +85,7 @@ class OpenAssessmentPage(BaseAssessmentPage):
"""
submit_button_selector = self._bounded_selector(button_css)
EmptyPromise(
lambda: 'is--disabled' not in " ".join(self.q(css=submit_button_selector).attrs('class')),
lambda: False == any(self.q(css=submit_button_selector).attrs('disabled')),
"Submit button is enabled."
).fulfill()
......@@ -165,8 +165,7 @@ class SubmissionPage(OpenAssessmentPage):
Returns:
bool
"""
preview_latex_button_class = self.q(css="button.submission__preview").attrs('class')[0]
return 'is--disabled' in preview_latex_button_class
return self.q(css="button.submission__preview").attrs('disabled') == ['true']
@property
def has_submitted(self):
......
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