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