Skip to content

Commit

Permalink
Optimize video tag
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Oct 21, 2020
1 parent 6a64215 commit afb052c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/tags/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
'use strict';

module.exports = function(args) {
return `<video src="${args}" preload="metadata" controls playsinline poster="">Sorry, your browser does not support the video tag.</video>`;
return `<video src="${args[0]}" preload="metadata" controlslist="nodownload" controls playsinline poster="${args[1] || ''}"></video>`;
};
6 changes: 5 additions & 1 deletion test/tags/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ describe('video', () => {
const postVideo = require('../../scripts/tags/video');

it('default', () => {
postVideo(['https://example.com/sample.mp4']).should.eql('<video src="https://example.com/sample.mp4" preload="metadata" controls playsinline poster="">Sorry, your browser does not support the video tag.</video>');
postVideo(['https://example.com/sample.mp4']).should.eql('<video src="https://example.com/sample.mp4" preload="metadata" controlslist="nodownload" controls playsinline poster=""></video>');
});

it('poster', () => {
postVideo(['https://example.com/sample.mp4', 'https://example.com/sample.jpg']).should.eql('<video src="https://example.com/sample.mp4" preload="metadata" controlslist="nodownload" controls playsinline poster="https://example.com/sample.jpg"></video>');
});
});

1 comment on commit afb052c

@stevenjoezhang
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.