add aXe testing to assignment views
also correct ignore rules from html-lang to html-has-lang test plan: - run the spec files edited in this patch normally with yarn run jspec-watch path/to/spec - tests should all pass as expected - run the spec files edited in this patch with the new command yarn run a11y-report path/to/spec - you should get aXe errors on existing a11y violations Change-Id: I239d81fbfcfc8cdbec89d88e5966308de3b6aae7 Reviewed-on: https://gerrit.instructure.com/130892 Reviewed-by: Steven Burnett <sburnett@instructure.com> Tested-by: Jenkins Product-Review: Matt Berns <mberns@instructure.com> QA-Review: Matt Berns <mberns@instructure.com>
This commit is contained in:
parent
37b34d71e4
commit
3c91cd73cf
|
@ -32,7 +32,7 @@ define ['jquery', 'underscore', 'axe-core'], ($, _, axe) ->
|
||||||
isAccessible: ($el, done, options={}) ->
|
isAccessible: ($el, done, options={}) ->
|
||||||
if options.a11yReport
|
if options.a11yReport
|
||||||
if __A11Y_REPORT
|
if __A11Y_REPORT
|
||||||
options.ignores = ':html-lang, :document-title, :region, :meta-viewport, :skip-link'
|
options.ignores = ':html-has-lang, :document-title, :region, :meta-viewport, :skip-link'
|
||||||
else
|
else
|
||||||
ok(true)
|
ok(true)
|
||||||
return done()
|
return done()
|
||||||
|
|
|
@ -25,8 +25,9 @@ define [
|
||||||
'compiled/views/assignments/ToggleShowByView'
|
'compiled/views/assignments/ToggleShowByView'
|
||||||
'jquery'
|
'jquery'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
], (Backbone, AssignmentGroup, Course, AssignmentGroupCollection, AssignmentGroupListView, IndexView, ToggleShowByView, $, fakeENV) ->
|
], (Backbone, AssignmentGroup, Course, AssignmentGroupCollection, AssignmentGroupListView, IndexView, ToggleShowByView, $, fakeENV, assertions) ->
|
||||||
|
|
||||||
|
|
||||||
fixtures = $('#fixtures')
|
fixtures = $('#fixtures')
|
||||||
|
@ -81,6 +82,11 @@ define [
|
||||||
assignmentGroups = null
|
assignmentGroups = null
|
||||||
fixtures.empty()
|
fixtures.empty()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = assignmentIndex()
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'should filter by search term', ->
|
test 'should filter by search term', ->
|
||||||
|
|
||||||
view = assignmentIndex()
|
view = assignmentIndex()
|
||||||
|
|
|
@ -27,8 +27,9 @@ define [
|
||||||
'helpers/I18nStubber'
|
'helpers/I18nStubber'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
'jsx/shared/conditional_release/CyoeHelper'
|
'jsx/shared/conditional_release/CyoeHelper'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
], (Backbone, Assignment, Submission, AssignmentListItemView, $, tz, juneau, french, I18nStubber, fakeENV, CyoeHelper) ->
|
], (Backbone, Assignment, Submission, AssignmentListItemView, $, tz, juneau, french, I18nStubber, fakeENV, CyoeHelper, assertions) ->
|
||||||
screenreaderText = null
|
screenreaderText = null
|
||||||
nonScreenreaderText = null
|
nonScreenreaderText = null
|
||||||
|
|
||||||
|
@ -175,6 +176,11 @@ define [
|
||||||
tz.restore(@snapshot)
|
tz.restore(@snapshot)
|
||||||
I18nStubber.popFrame()
|
I18nStubber.popFrame()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = createView(@model, canManage: true)
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test "initializes child views if can manage", ->
|
test "initializes child views if can manage", ->
|
||||||
view = createView(@model, canManage: true)
|
view = createView(@model, canManage: true)
|
||||||
ok view.publishIconView
|
ok view.publishIconView
|
||||||
|
|
|
@ -24,8 +24,9 @@ define [
|
||||||
'compiled/views/assignments/AssignmentGroupWeightsView'
|
'compiled/views/assignments/AssignmentGroupWeightsView'
|
||||||
'jquery'
|
'jquery'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
], (Backbone, AssignmentGroupCollection, Course, AssignmentGroup, AssignmentSettingsView, AssignmentGroupWeightsView, $, fakeENV) ->
|
], (Backbone, AssignmentGroupCollection, Course, AssignmentGroup, AssignmentSettingsView, AssignmentGroupWeightsView, $, fakeENV, assertions) ->
|
||||||
|
|
||||||
group = (opts = {}) ->
|
group = (opts = {}) ->
|
||||||
new AssignmentGroup $.extend({group_weight: 50}, opts)
|
new AssignmentGroup $.extend({group_weight: 50}, opts)
|
||||||
|
@ -49,6 +50,11 @@ define [
|
||||||
setup: -> fakeENV.setup()
|
setup: -> fakeENV.setup()
|
||||||
teardown: -> fakeENV.teardown()
|
teardown: -> fakeENV.teardown()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = createView(true)
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'sets the checkbox to the right value on open', ->
|
test 'sets the checkbox to the right value on open', ->
|
||||||
view = createView(weighted: true)
|
view = createView(weighted: true)
|
||||||
ok view.$('#apply_assignment_group_weights').prop('checked')
|
ok view.$('#apply_assignment_group_weights').prop('checked')
|
||||||
|
|
|
@ -29,6 +29,7 @@ define [
|
||||||
'timezone/fr_FR'
|
'timezone/fr_FR'
|
||||||
'helpers/I18nStubber'
|
'helpers/I18nStubber'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
'compiled/behaviors/tooltip'
|
'compiled/behaviors/tooltip'
|
||||||
], (
|
], (
|
||||||
|
@ -44,7 +45,8 @@ define [
|
||||||
juneau,
|
juneau,
|
||||||
french,
|
french,
|
||||||
I18nStubber,
|
I18nStubber,
|
||||||
fakeENV) ->
|
fakeENV,
|
||||||
|
assertions) ->
|
||||||
|
|
||||||
fixtures = $('#fixtures')
|
fixtures = $('#fixtures')
|
||||||
|
|
||||||
|
@ -163,6 +165,11 @@ define [
|
||||||
tz.restore(@snapshot)
|
tz.restore(@snapshot)
|
||||||
I18nStubber.popFrame()
|
I18nStubber.popFrame()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = createView(@assignment1)
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test "initialize generates a new assignment for creation", ->
|
test "initialize generates a new assignment for creation", ->
|
||||||
view = createView(@group)
|
view = createView(@group)
|
||||||
equal view.model.get("assignment_group_id"), @group.get("id")
|
equal view.model.get("assignment_group_id"), @group.get("id")
|
||||||
|
|
|
@ -25,8 +25,9 @@ define [
|
||||||
'compiled/views/assignments/CreateGroupView'
|
'compiled/views/assignments/CreateGroupView'
|
||||||
'jquery'
|
'jquery'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
], (_, Backbone, AssignmentGroupCollection, AssignmentGroup, Assignment, Course, CreateGroupView, $, fakeENV) ->
|
], (_, Backbone, AssignmentGroupCollection, AssignmentGroup, Assignment, Course, CreateGroupView, $, fakeENV, assertions) ->
|
||||||
|
|
||||||
group = (opts = {}) ->
|
group = (opts = {}) ->
|
||||||
new AssignmentGroup $.extend({
|
new AssignmentGroup $.extend({
|
||||||
|
@ -55,6 +56,11 @@ define [
|
||||||
fakeENV.teardown()
|
fakeENV.teardown()
|
||||||
$("form[id^=ui-id-]").remove()
|
$("form[id^=ui-id-]").remove()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = createView()
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'hides drop options for no assignments', ->
|
test 'hides drop options for no assignments', ->
|
||||||
view = createView()
|
view = createView()
|
||||||
view.render()
|
view.render()
|
||||||
|
|
|
@ -24,9 +24,9 @@ define [
|
||||||
'compiled/models/Assignment'
|
'compiled/models/Assignment'
|
||||||
'compiled/views/assignments/DeleteGroupView'
|
'compiled/views/assignments/DeleteGroupView'
|
||||||
'jquery'
|
'jquery'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
'helpers/fakeENV'
|
], (_, Backbone, AssignmentGroupCollection, AssignmentCollection, AssignmentGroup, Assignment, DeleteGroupView, $, assertions) ->
|
||||||
], (_, Backbone, AssignmentGroupCollection, AssignmentCollection, AssignmentGroup, Assignment, DeleteGroupView, $) ->
|
|
||||||
|
|
||||||
group = (assignments=true, id) ->
|
group = (assignments=true, id) ->
|
||||||
new AssignmentGroup
|
new AssignmentGroup
|
||||||
|
@ -51,6 +51,11 @@ define [
|
||||||
$("#fixtures").empty()
|
$("#fixtures").empty()
|
||||||
$("form.dialogFormView").remove()
|
$("form.dialogFormView").remove()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = createView(false, true)
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'it should delete a group without assignments', ->
|
test 'it should delete a group without assignments', ->
|
||||||
@stub(window, "confirm").returns(true)
|
@stub(window, "confirm").returns(true)
|
||||||
view = createView(false, true)
|
view = createView(false, true)
|
||||||
|
|
|
@ -23,7 +23,8 @@ define [
|
||||||
'jst/assignments/EditView'
|
'jst/assignments/EditView'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
'Backbone'
|
'Backbone'
|
||||||
], ($, _, Assignment, EditHeaderView, editViewTemplate, fakeENV, Backbone) ->
|
'helpers/assertions'
|
||||||
|
], ($, _, Assignment, EditHeaderView, editViewTemplate, fakeENV, Backbone, assertions) ->
|
||||||
|
|
||||||
defaultAssignmentOpts =
|
defaultAssignmentOpts =
|
||||||
name: 'Test Assignment'
|
name: 'Test Assignment'
|
||||||
|
@ -52,6 +53,11 @@ define [
|
||||||
fakeENV.teardown()
|
fakeENV.teardown()
|
||||||
$(document).off 'submit'
|
$(document).off 'submit'
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = editHeaderView()
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'renders', ->
|
test 'renders', ->
|
||||||
view = editHeaderView()
|
view = editHeaderView()
|
||||||
ok view.$('.header-bar-right').length > 0, 'header bar is rendered'
|
ok view.$('.header-bar-right').length > 0, 'header bar is rendered'
|
||||||
|
|
|
@ -30,6 +30,7 @@ define [
|
||||||
'compiled/views/assignments/PeerReviewsSelector'
|
'compiled/views/assignments/PeerReviewsSelector'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
'compiled/userSettings'
|
'compiled/userSettings'
|
||||||
|
'helpers/assertions'
|
||||||
'helpers/jquery.simulate'
|
'helpers/jquery.simulate'
|
||||||
], (
|
], (
|
||||||
$,
|
$,
|
||||||
|
@ -45,7 +46,8 @@ define [
|
||||||
GroupCategorySelector,
|
GroupCategorySelector,
|
||||||
PeerReviewsSelector,
|
PeerReviewsSelector,
|
||||||
fakeENV,
|
fakeENV,
|
||||||
userSettings) ->
|
userSettings,
|
||||||
|
assertions) ->
|
||||||
|
|
||||||
s_params = 'some super secure params'
|
s_params = 'some super secure params'
|
||||||
|
|
||||||
|
@ -112,6 +114,11 @@ define [
|
||||||
editView: ->
|
editView: ->
|
||||||
editView.apply(this, arguments)
|
editView.apply(this, arguments)
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = @editView()
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'renders', ->
|
test 'renders', ->
|
||||||
view = @editView()
|
view = @editView()
|
||||||
equal view.$('#assignment_name').val(), 'Test Assignment'
|
equal view.$('#assignment_name').val(), 'Test Assignment'
|
||||||
|
|
|
@ -19,7 +19,8 @@ define [
|
||||||
'compiled/views/assignments/SectionDropdownView'
|
'compiled/views/assignments/SectionDropdownView'
|
||||||
'compiled/models/AssignmentOverride'
|
'compiled/models/AssignmentOverride'
|
||||||
'compiled/models/Section'
|
'compiled/models/Section'
|
||||||
], ( SectionDropdownView, AssignmentOverride, Section ) ->
|
'helpers/assertions'
|
||||||
|
], ( SectionDropdownView, AssignmentOverride, Section, assertions ) ->
|
||||||
|
|
||||||
QUnit.module "SectionDropdownView",
|
QUnit.module "SectionDropdownView",
|
||||||
setup: ->
|
setup: ->
|
||||||
|
@ -31,6 +32,10 @@ define [
|
||||||
@view = new SectionDropdownView( sections: @sections, override: @override )
|
@view = new SectionDropdownView( sections: @sections, override: @override )
|
||||||
@view.render()
|
@view.render()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible @view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test "updates the course_section_id when the form element changes", ->
|
test "updates the course_section_id when the form element changes", ->
|
||||||
@view.$el.val('2').trigger 'change'
|
@view.$el.val('2').trigger 'change'
|
||||||
strictEqual @override.get('course_section_id'), '2'
|
strictEqual @override.get('course_section_id'), '2'
|
||||||
|
|
|
@ -19,7 +19,8 @@ define [
|
||||||
'compiled/views/assignments/SpeedgraderLinkView'
|
'compiled/views/assignments/SpeedgraderLinkView'
|
||||||
'compiled/models/Assignment'
|
'compiled/models/Assignment'
|
||||||
'jquery'
|
'jquery'
|
||||||
], (SpeedgraderLinkView, Assignment, $) ->
|
'helpers/assertions'
|
||||||
|
], (SpeedgraderLinkView, Assignment, $, assertions) ->
|
||||||
|
|
||||||
QUnit.module "SpeedgraderLinkView",
|
QUnit.module "SpeedgraderLinkView",
|
||||||
setup: ->
|
setup: ->
|
||||||
|
@ -36,6 +37,10 @@ define [
|
||||||
@view.remove()
|
@view.remove()
|
||||||
$('#fixtures').empty()
|
$('#fixtures').empty()
|
||||||
|
|
||||||
|
test 'it should be accessible', (assert) ->
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible @view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test "#toggleSpeedgraderLink toggles visibility of speedgrader link on change", ->
|
test "#toggleSpeedgraderLink toggles visibility of speedgrader link on change", ->
|
||||||
@model.set 'published', true
|
@model.set 'published', true
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ define [
|
||||||
'compiled/views/assignments/ToggleShowByView'
|
'compiled/views/assignments/ToggleShowByView'
|
||||||
'jquery'
|
'jquery'
|
||||||
'helpers/fakeENV'
|
'helpers/fakeENV'
|
||||||
], (_, Backbone, AssignmentGroup, Assignment, Course, AssignmentGroupCollection, AssignmentGroupListView, IndexView, ToggleShowByView, $, fakeENV) ->
|
'helpers/assertions'
|
||||||
|
], (_, Backbone, AssignmentGroup, Assignment, Course, AssignmentGroupCollection, AssignmentGroupListView, IndexView, ToggleShowByView, $, fakeENV, assertions) ->
|
||||||
|
|
||||||
|
|
||||||
COURSE_SUBMISSIONS_URL = "/courses/1/submissions"
|
COURSE_SUBMISSIONS_URL = "/courses/1/submissions"
|
||||||
|
@ -86,6 +87,11 @@ define [
|
||||||
$(".ui-dialog").remove()
|
$(".ui-dialog").remove()
|
||||||
$("ul[id^=ui-id-]").remove()
|
$("ul[id^=ui-id-]").remove()
|
||||||
|
|
||||||
|
test 'should be accessible', (assert) ->
|
||||||
|
view = createView(true)
|
||||||
|
done = assert.async()
|
||||||
|
assertions.isAccessible view, done, {'a11yReport': true}
|
||||||
|
|
||||||
test 'should sort assignments into groups correctly', ->
|
test 'should sort assignments into groups correctly', ->
|
||||||
|
|
||||||
view = createView()
|
view = createView()
|
||||||
|
|
Loading…
Reference in New Issue