Skip to content

Commit

Permalink
Merge branch 'develop' into feature/album-directive
Browse files Browse the repository at this point in the history
  • Loading branch information
edoparearyee committed Jul 27, 2015
2 parents b9f2706 + a484b46 commit 5826de9
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/js/player/directives/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ angular.module("FM.player.trackDirective", [
track: "=spotifyTrack",
current: "=",
user: "=",
timer: "=?"
timer: "=?",
playCount: "=?"
},
templateUrl: "partials/track.html",
link: function($scope){
Expand Down
4 changes: 4 additions & 0 deletions app/less/default/modules/controls.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
width: 129px;
}

.no-controls.controls {
min-width: 70px;
}

fm-slider {
display: inline-block;
height: max(@thumb-height, @track-height);
Expand Down
10 changes: 10 additions & 0 deletions app/less/default/modules/footer.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@
right: 0;
width: @controls-width;
}

.no-controls {
&.track {
right: 70px;
}

&.controls {
width: 70px;
}
}
}
9 changes: 9 additions & 0 deletions app/less/default/modules/track.less
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
}
}

.track-plays {
.align-self(flex-end);

.footer &,
.queue & {
display: none;
}
}

.img-user {
.size(36px, auto);
}
Expand Down
13 changes: 12 additions & 1 deletion app/less/mobile/modules/track.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
.track-menu {
.align-self(center);
position: static;
min-width: 10px;
min-width: 15px;
margin-bottom: 0;
margin-top: 10px;

Expand Down Expand Up @@ -83,6 +83,17 @@
}
}

.track-plays {
.align-self(center);
font-size: 0.867em; // 13px
margin-right: 15px;
white-space: nowrap;

p {
margin-bottom: 0;
}
}

.track-heading {
font-size: 0.933em; // 14px
}
Expand Down
6 changes: 3 additions & 3 deletions app/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

<div ng-controller="PlayerCtrl">

<fm-track class="track" ng-show="track.track.uri" data-spotify-track="track.track" data-user="track.user" data-timer="trackPositionTimer"></fm-track>
<fm-track class="track" ng-show="track.track.uri" data-spotify-track="track.track" data-user="track.user" data-timer="trackPositionTimer" ng-class="{ 'no-controls': !isAuthenticated() }"></fm-track>

<div class="controls" ng-show="track.track.uri">
<div class="controls" ng-show="track.track.uri" ng-class="{ 'no-controls': !isAuthenticated() }">

<div class="playing-animation"
ng-switch="paused">
<img ng-switch-when="false" src="img/icons/playing-animation.gif" alt="music playing animation">
<img ng-switch-default src="img/icons/playing-stoped.png" alt="music stopped animation">
</div>

<form name="controls" class="form-inline">
<form name="controls" class="form-inline" ng-if="isAuthenticated()">

<button ng-show="paused"
ng-click="resume()"
Expand Down
1 change: 1 addition & 0 deletions app/partials/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ <h2>Top Tracks</h2>
<li class="track"
ng-repeat="track in stats.most_played_tracks"
data-spotify-track="track.track"
data-play-count="track.total"
fm-track>
</li>
</ul>
Expand Down
6 changes: 6 additions & 0 deletions app/partials/track.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
</div>
</div>

<div ng-if="playCount" class="track-right track-plays text-right">
<p>
{{ playCount }} plays
</p>
</div>

<div class="track-menu" dropdown is-open="status.isopen">
<a role="button" href class="text-muted btn-context" dropdown-toggle>
<span class="sr-only sr-only-focusable">Track menu</span>
Expand Down
12 changes: 11 additions & 1 deletion tests/e2e/specs/scenarios.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

/* https://github.com/angular/protractor/blob/master/docs/getting-started.md */

var login = function login (){
browser.executeScript("localStorage.setItem('sn_fm_access_token', 'Ijc4NWJjMDY0LTBlMDgtNGVhMy05OGQ1LTQ0NmU0OTdiZDIxMyI.CJeLpg.oPLDqjS2W-iaAKnfJ8DBwAvLx-s');");
browser.driver.sleep(2000);
};

describe("FM", function() {

var scrollTo = function scrollTo (y) {
Expand Down Expand Up @@ -100,17 +105,21 @@ describe("FM", function() {

it("should pause and resume", function() {

// login
login();

// pause
element(by.css(".controls button:nth-child(2)")).click();

var startTime = 0;
element(by.css("footer fm-track .progress-bar")).getAttribute("aria-valuenow").then(function(value){
startTime = value;
startTime = parseInt(value);
});

browser.driver.sleep(2000);

element(by.css("footer fm-track .progress-bar")).getAttribute("aria-valuenow").then(function(value){
value = parseInt(value);
expect(value).toEqual(startTime);
});

Expand All @@ -119,6 +128,7 @@ describe("FM", function() {
browser.driver.sleep(2000);

element(by.css("footer fm-track .progress-bar")).getAttribute("aria-valuenow").then(function(value){
value = parseInt(value);
expect(value > startTime).toBeTruthy();
});
});
Expand Down

0 comments on commit 5826de9

Please sign in to comment.