1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-23 02:04:34 +02:00
video.js/test/unit/button.test.js
Owen Edwards 1c74e4fa0b fix: Reduce the multiple-announcement by screen readers of the new name of a button when its text label changes. (#5158)
Move the aria-live attribute to the control text element within buttons, rather than on the whole button, so it is not affected by the change of the title attribute, only by the change of the control text.

It seems like having aria-live on the button itself means that JAWS and NVDA announce the button both when the button text changes and when the title attribute changes. NVDA speaks the new label more times because it announces the button text as the label and the title as the description, so it says, for example, "pause button pause". JAWS doesn't appear to do this, so it doesn't repeat it as many times.

Partially addresses #5023
2018-05-11 14:31:28 -04:00

31 lines
690 B
JavaScript

/* eslint-env qunit */
import Button from '../../src/js/button.js';
import TestHelpers from './test-helpers.js';
QUnit.module('Button');
QUnit.test('should localize its text', function(assert) {
assert.expect(3);
const player = TestHelpers.makePlayer({
language: 'es',
languages: {
es: {
Play: 'Juego'
}
}
});
const testButton = new Button(player);
testButton.controlText_ = 'Play';
const el = testButton.createEl();
assert.ok(el.nodeName.toLowerCase().match('button'));
assert.ok(el.innerHTML.match(/vjs-control-text"?[^<>]*>Juego/));
assert.equal(el.getAttribute('title'), 'Juego');
testButton.dispose();
player.dispose();
});