diaspora/spec/javascripts/app/views/location_stream_spec.js
zaziemo 263dc6f119 refactor code that choses the tile server based on podmin's choice
and remove the possibility to disable the map feature.
By default the application uses the itles of Heidelberg University that
don't need any credentials. If podmins enable the mapbox option in the
diaspora.yml and enter their credentials the mapbox tiles are used for the map
rendering.
2015-09-09 17:03:46 +02:00

43 lines
1.5 KiB
JavaScript

describe("app.views.LocationStream", function() {
beforeEach(function(){
this.post = factory.post();
this.view = new app.views.LocationStream({model : this.post});
gon.appConfig = {map: { mapbox: {enabled: true, id: "yourID", access_token: "yourAccessToken" }}};
});
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 initialize map", function() {
expect($(".mapContainer")).toHaveClass("empty");
this.view.toggleMap();
expect($(".mapContainer")).not.toHaveClass("empty");
});
it("should change display status on every click", function() {
this.view.toggleMap();
expect($(".mapContainer")).toHaveCss({display: "block"});
this.view.toggleMap();
expect($(".mapContainer")).toHaveCss({display: "none"});
});
}),
context("without location provided", function() {
beforeEach(function(){
spec.content().html(this.view.render().el);
});
it("should not initialize the map", function() {
expect(spec.content()).not.toContainElement(".mapContainer");
});
});
});
});