2016-08-04 11:49:32 -04:00
|
|
|
/* eslint-env qunit */
|
2015-03-25 21:43:41 -07:00
|
|
|
import Button from '../../src/js/button.js';
|
|
|
|
import TestHelpers from './test-helpers.js';
|
2014-08-05 17:07:46 -07:00
|
|
|
|
2016-08-04 11:49:32 -04:00
|
|
|
QUnit.module('Button');
|
2015-03-10 18:01:11 -07:00
|
|
|
|
2016-08-12 13:51:31 -04:00
|
|
|
QUnit.test('should localize its text', function(assert) {
|
|
|
|
assert.expect(3);
|
2014-08-05 17:07:46 -07:00
|
|
|
|
2016-08-04 11:49:32 -04:00
|
|
|
const player = TestHelpers.makePlayer({
|
|
|
|
language: 'es',
|
|
|
|
languages: {
|
|
|
|
es: {
|
|
|
|
Play: 'Juego'
|
2014-08-05 17:07:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-08-04 11:49:32 -04:00
|
|
|
const testButton = new Button(player);
|
|
|
|
|
2015-05-29 15:56:45 -07:00
|
|
|
testButton.controlText_ = 'Play';
|
2016-08-04 11:49:32 -04:00
|
|
|
const el = testButton.createEl();
|
2014-08-05 17:07:46 -07:00
|
|
|
|
2016-08-12 13:51:31 -04:00
|
|
|
assert.ok(el.nodeName.toLowerCase().match('button'));
|
2018-05-11 11:05:29 -07:00
|
|
|
assert.ok(el.innerHTML.match(/vjs-control-text"?[^<>]*>Juego/));
|
2016-08-12 13:51:31 -04:00
|
|
|
assert.equal(el.getAttribute('title'), 'Juego');
|
2016-08-25 10:58:42 -04:00
|
|
|
|
2018-01-30 13:26:21 -05:00
|
|
|
testButton.dispose();
|
|
|
|
player.dispose();
|
2014-08-05 17:07:46 -07:00
|
|
|
});
|