Skip to content

Commit

Permalink
fix: removes duplicate id in text track settings
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-ben committed Jun 1, 2024
1 parent 8729e31 commit da1b6dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/tracks/text-track-settings-font.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TextTrackSettingsFont extends Component {
player,
{
id_,
legendId: `captions-background-${id_}`,
legendId: `captions-edge-style-${id_}`,
legendText: this.localize('Text Edge Style'),
className: 'vjs-edge-style vjs-track-setting',
selects: this.options_.fieldSets[1],
Expand Down
12 changes: 12 additions & 0 deletions test/unit/tracks/text-track-settings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,15 @@ QUnit.test('should associate <label>s with <select>s', function(assert) {
);

});

QUnit.test('should not duplicate ids', function(assert) {
const player = TestHelpers.makePlayer({
tracks
});

const elements = [...player.el().querySelectorAll('[id]')];
const ids = elements.map(el => el.id);
const duplicates = elements.filter(el => ids.filter(id => id === el.id).length > 1);

assert.strictEqual(duplicates.length, 0, 'there should be no duplicate ids');
});

0 comments on commit da1b6dd

Please sign in to comment.