Skip to content

Commit

Permalink
Making changes based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
heff committed May 12, 2015
1 parent 5fb6aed commit 13c9e04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
15 changes: 9 additions & 6 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,24 @@ class Player extends Component {
}

dimension(dimension, value) {
let property = dimension + '_';
let privDimension = dimension + '_';

if (value === undefined) {
return this[property] || 0;
return this[privDimension] || 0;
}

if (value === '') {
// If an empty string is given, reset the dimension to be automatic
this[property] = undefined;
this[privDimension] = undefined;
} else {
this[property] = parseFloat(value);
let parsedVal = parseFloat(value);

if (isNaN(this[property])) {
if (isNaN(this[privDimension])) {
Lib.log.error(`Improper value "${value}" supplied for for ${dimension}`);
return this;
}

this[privDimension] = parsedVal;
}

this.updateStyleEl_();
Expand Down Expand Up @@ -450,7 +453,7 @@ class Player extends Component {
this.on(this.tech, 'ratechange', this.handleTechRateChange);
this.on(this.tech, 'volumechange', this.handleTechVolumeChange);
this.on(this.tech, 'texttrackchange', this.onTextTrackChange);
this.on(this.tech, 'loadedmetadata', this.updateStyleEl_);
this.on(this.tech, 'loadedmetadata', this.updateStyleEl_);

if (this.controls() && !this.usingNativeControls()) {
this.addTechControlsListeners();
Expand Down
19 changes: 0 additions & 19 deletions test/unit/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,6 @@ test('should asynchronously fire error events during source selection', function
Lib.log.error.restore();
});

// test('should set the width and height of the player', function(){
// var player = TestHelpers.makePlayer({ width: 123, height: '100%' });
//
// ok(player.width() === 123);
// ok(player.el().style.width === '123px');
//
// var fixture = document.getElementById('qunit-fixture');
// var container = document.createElement('div');
// fixture.appendChild(container);
//
// // Player container needs to have height in order to have height
// // Don't want to mess with the fixture itself
// container.appendChild(player.el());
// container.style.height = '1000px';
// ok(player.height() === 1000);
//
// player.dispose();
// });

test('should set the width, height, and aspect ratio via a css class', function(){
let player = TestHelpers.makePlayer();
let getStyleText = function(styleEl){
Expand Down

0 comments on commit 13c9e04

Please sign in to comment.