Always show expanded map in SPV
This commit is contained in:
parent
c1bd072e76
commit
3fb7b420eb
3 changed files with 6 additions and 55 deletions
|
|
@ -1,10 +1,6 @@
|
|||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
|
||||
|
||||
app.views.SinglePostContent = app.views.Base.extend({
|
||||
events: {
|
||||
"click .near-from": "toggleMap"
|
||||
},
|
||||
|
||||
templateName: "single-post-viewer/single-post-content",
|
||||
tooltipSelector: "time, .post_scope",
|
||||
className: "framed-content",
|
||||
|
|
@ -66,21 +62,11 @@ app.views.SinglePostContent = app.views.Base.extend({
|
|||
|
||||
tiles.addTo(map);
|
||||
|
||||
// set mapContainer size to a smaller preview size
|
||||
mapContainer.css("height", "75px");
|
||||
map.invalidateSize();
|
||||
|
||||
// put marker on map
|
||||
L.marker(location).addTo(map);
|
||||
return map;
|
||||
},
|
||||
|
||||
toggleMap: function () {
|
||||
$(".mapContainer").height($(".small-map")[0] ? 200 : 50);
|
||||
$(".leaflet-control-zoom").css("display", $(".small-map")[0] ? "block" : "none");
|
||||
$(".mapContainer").toggleClass("small-map");
|
||||
},
|
||||
|
||||
presenter : function() {
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
authorIsCurrentUser :app.currentUser.isAuthorOf(this.model),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
.near-from:hover {
|
||||
.stream_element .near-from:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ describe("app.views.SinglePostContent", function() {
|
|||
this.view.map();
|
||||
expect(L.map).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should add a map container", function() {
|
||||
expect(spec.content()).toContainElement(".mapContainer");
|
||||
});
|
||||
});
|
||||
|
||||
context("without location provided", function() {
|
||||
|
|
@ -30,47 +34,8 @@ describe("app.views.SinglePostContent", function() {
|
|||
this.view.map();
|
||||
expect(L.map).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("toggleMap", function() {
|
||||
context("with location provided", function() {
|
||||
beforeEach(function(){
|
||||
this.post.set({location : factory.location()}); // set location
|
||||
spec.content().html(this.view.render().el); // loads html element to the page
|
||||
});
|
||||
|
||||
it("should contain a map container", function() {
|
||||
expect(spec.content()).toContainElement(".mapContainer");
|
||||
});
|
||||
|
||||
it("should provide a small map", function() {
|
||||
expect($(".mapContainer")).toHaveClass("small-map");
|
||||
expect($(".mapContainer").height() < 100).toBeTruthy();
|
||||
expect($(".mapContainer")).toBeVisible();
|
||||
});
|
||||
|
||||
it("should toggle class small-map on every click", function(){
|
||||
this.view.toggleMap();
|
||||
expect($(".mapContainer")).not.toHaveClass("small-map");
|
||||
this.view.toggleMap();
|
||||
expect($(".mapContainer")).toHaveClass("small-map");
|
||||
});
|
||||
|
||||
it("should change height on every click", function() {
|
||||
this.view.toggleMap();
|
||||
expect($(".mapContainer").height() > 100).toBeTruthy();
|
||||
this.view.toggleMap();
|
||||
expect($(".mapContainer").height() < 100).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
context("without location provided", function() {
|
||||
beforeEach(function(){
|
||||
spec.content().html(this.view.render().el);
|
||||
});
|
||||
|
||||
it("should not initialize the map", function() {
|
||||
it("shouldn't add a map container", function() {
|
||||
expect(spec.content()).not.toContainElement(".mapContainer");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue