Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Loccasions 8:
App or= {}
App.MapProviders or= {}
App.MapProviders.Leaflet = ->
# Create new map
createMap: (elementId) ->
@map = new L.Map(elementId)
@addBaseMap()
map
addBaseMap: ()->
# TODO: This should probably be private
cloudmadeUrl = 'http://{s}.tile.cloudmade.com/640718c4d80b45d6a279dff45f8a6dae/997/256/{z}/{x}/{y}.png'
cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade'
layer = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution})
@addLayerToMap(layer)
addLayerToMap: (layer) ->
@map.addLayer(layer)
setViewForMap: (options) ->
point = new L.LatLng(options.latitude, options.longitude)
@map.setView(point, options.zoomLevel)
describe("Event model", function() {
beforeEach(function() {
this.event = new App.Event({
name: "New Event",
description: "My Jasmine Event"
});
});
describe("when instantiated with attributes", function() {
it("should have a name and description", function() {
expect(this.event.get("name")).toEqual("New Event");
expect(this.event.get("description")).toEqual("My Jasmine Event");
});
});
describe("when saving", function() {
it("should not save when name is empty", function() {
var eventSpy = sinon.spy();
this.event.bind("error", eventSpy);
this.event.save({"name":""});
expect(eventSpy.calledOnce).toBeTruthy();
console.dir(eventSpy.args);
// Make sure it passes in the event
expect(eventSpy.args[0][0].cid).toEqual(this.event.cid);
expect(eventSpy.args[0][1]).toEqual("must have a valid name.");
});
});
describe("url", function() {
it("should have a value if model is not part of a collection", function() {
expect(this.event.url()).toEqual("/events");
});
it ("should reflect the collection url if part of a collection", function() {
var collection = {
url: "/loccasions"
};
this.event.collection = collection;
expect(this.event.url()).toEqual("/loccasions");
});
});
});
App or= {}
App.EventListView = Backbone.View.extend
el: "#eventsList"
//Added after first test run
,initialize: ->
@collection.bind("add", @eventAdded, @)
# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
# - lib/source1.js
# - lib/source2.js
# - dist/**/*.js
#
src_files:
- spec/javascripts/helpers/jquery.js
- vendor/assets/javascripts/backbone/underscore-min.js
- vendor/assets/javascripts/backbone/backbone-min.js
- vendor/assets/javascripts/leaflet/leaflet.js
- app/assets/**/*.coffee
# stylesheets
#
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# stylesheets:
# - css/style.css
# - stylesheets/*.css
#
stylesheets:
- stylesheets/**/*.css
# helpers
#
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
# Default: ["helpers/**/*.js"]
#
# EXAMPLE:
#
# helpers:
# - helpers/**/*.js
#
helpers:
- helpers/**/*.js
# spec_files
#
# Return an array of filepaths relative to spec_dir to include.
# Default: ["**/*[sS]pec.js"]
#
# EXAMPLE:
#
# spec_files:
# - **/*[sS]pec.js
#
spec_files:
- '**/*[sS]pec.js'
# src_dir
#
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
# Default: project root
#
# EXAMPLE:
#
# src_dir: public
#
src_dir:
# spec_dir
#
# Spec directory path. Your spec_files must be returned relative to this path.
# Default: spec/javascripts
#
# EXAMPLE:
#
# spec_dir: spec/javascripts
#
spec_dir: spec/javascripts
# asset_pipeline_paths
#
# Paths you would like to be served by the Sprockets asset pipeline.
#
# If you include your spec_dir (eg: - spec/javascripts ) here,
# Jasmine will use the Sprockets asset pipeline to build your spec files.
#
# Default: []
#
# EXAMPLE:
# asset_pipeline_paths:
# - app/assets
# - spec/javascripts
asset_pipeline_paths:
- app/assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.