mirror of
https://github.com/videojs/video.js.git
synced 2024-12-02 09:11:54 +02:00
c19a3f3f48
add base documentation for language support typo fix added utility function for adding languages per conversation with @heff. Includes test. move addLanguage to core. update both core and util tests. added export property added language sandbox for demo fix comment doc udpate remove build instructions add addLanguage API to doc fix deep merge in test test update update local reference to string for compiled tests
41 lines
1.4 KiB
JavaScript
41 lines
1.4 KiB
JavaScript
module('Core');
|
|
|
|
test('should create a video tag and have access children in old IE', function(){
|
|
var fixture = document.getElementById('qunit-fixture');
|
|
|
|
fixture.innerHTML += '<video id="test_vid_id"><source type="video/mp4"></video>';
|
|
|
|
var vid = document.getElementById('test_vid_id');
|
|
|
|
ok(vid.childNodes.length === 1);
|
|
ok(vid.childNodes[0].getAttribute('type') === 'video/mp4');
|
|
});
|
|
|
|
test('should return a video player instance', function(){
|
|
var fixture = document.getElementById('qunit-fixture');
|
|
fixture.innerHTML += '<video id="test_vid_id"></video><video id="test_vid_id2"></video>';
|
|
|
|
var player = videojs('test_vid_id');
|
|
ok(player, 'created player from tag');
|
|
ok(player.id() === 'test_vid_id');
|
|
ok(videojs.players['test_vid_id'] === player, 'added player to global reference');
|
|
|
|
var playerAgain = videojs('test_vid_id');
|
|
ok(player === playerAgain, 'did not create a second player from same tag');
|
|
|
|
var tag2 = document.getElementById('test_vid_id2');
|
|
var player2 = videojs(tag2);
|
|
ok(player2.id() === 'test_vid_id2', 'created player from element');
|
|
});
|
|
|
|
test('should add the value to the languages object', function() {
|
|
var code, data, result;
|
|
|
|
code = 'es';
|
|
data = {'Hello': 'Hola'};
|
|
result = vjs.addLanguage(code, data);
|
|
|
|
ok(vjs.options['languages'][code], 'should exist');
|
|
equal(vjs.options['languages'][code], data, 'should match');
|
|
deepEqual(result[code], vjs.options['languages'][code], 'should also match');
|
|
}); |