This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1069630 - Updated "album rating bar" and "caption/share bar" with…
… ARIA roles/labels
- Loading branch information
1 parent
c18cd46
commit a6c85c5
Showing
5 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* global PlayerView, loadBodyHTML, MockL10n */ | ||
|
||
'use strict'; | ||
|
||
require('/js/ui/views/player_view.js'); | ||
require('/shared/test/unit/mocks/mock_l10n.js'); | ||
require('/shared/test/unit/load_body_html_helper.js'); | ||
|
||
suite('Player View Test', function() { | ||
var pv, ratings; | ||
var realL10n = navigator.mozL10n; | ||
function testRatingsAriaChecked(checkedIndex) { | ||
pv.setRatings(checkedIndex); | ||
Array.prototype.forEach.call(ratings, function(rating, index) { | ||
assert.equal(checkedIndex - 1 === index ? 'true' : 'false', | ||
rating.getAttribute('aria-checked')); | ||
}); | ||
} | ||
|
||
suiteSetup(function() { | ||
navigator.mozL10n = MockL10n; | ||
//Insert the star-rating bar into the dom | ||
loadBodyHTML('/index.html'); | ||
|
||
//Initialize the Player View | ||
pv = PlayerView; | ||
|
||
//Override #setSeekBar with stub to avoid excess work in init() | ||
sinon.stub(pv, 'setSeekBar'); | ||
pv.init(); | ||
ratings = pv.ratings; | ||
}); | ||
|
||
suiteTeardown(function() { | ||
navigator.mozL10n = realL10n; | ||
}); | ||
|
||
suite('#setRating accessibility', function() { | ||
test('aria-checked="true" when star matches star-rating. false otherwise', | ||
function() { | ||
[0, 1, 2, 3, 4, 5].forEach(testRatingsAriaChecked); | ||
}); | ||
}); | ||
}); |