Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from dotsub/lubos-fix-fading-out
Browse files Browse the repository at this point in the history
Fix fading out

Closes #8
  • Loading branch information
lkrnac authored Dec 20, 2016
2 parents 5450dd8 + bc11230 commit b581a85
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "videojs-watermark",
"version": "1.0.0",
"version": "1.0.1",
"description": "Adds a watermark image the video player",
"repository": "https://github.com/dotsub/videojs-watermark",
"main": "es5/plugin.js",
Expand Down
6 changes: 4 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ const setupWatermark = (player, options) => {
*/
const fadeWatermark = (options) => {
setTimeout(
() => document.getElementById('vjs-watermark').classList.add('vjs-watermark-fade'),
options.fadeTime);
() => document.getElementsByClassName('vjs-watermark-content')[0]
.classList.add('vjs-watermark-fade'),
options.fadeTime
);
};

/**
Expand Down
18 changes: 18 additions & 0 deletions test/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,21 @@ QUnit.test('does add a link when URL is configured', function(assert) {
'the plugin doesn\'t add an ID to image container'
);
});

QUnit.test('fades out after player is started', function(assert) {
// GIVEN
const imageUrl = '/images/foo.png';

this.player.watermark({ image: imageUrl, fadeTime: 1 });
this.clock.tick(1);

// WHEN
this.player.trigger('play');
this.clock.tick(10);

// THEN
const imageContainer = this.player.contentEl()
.getElementsByClassName('vjs-watermark-content')[0];

assert.ok(imageContainer.classList.contains('vjs-watermark-fade'));
});

0 comments on commit b581a85

Please sign in to comment.