mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Handling multiple enterprises at the same location
Changes: * Introduced a cluster marker to denote multiple points of interest at the same location * Seperated out a plain enterprise modal into 2 parts * A modal called EnterpriseModal for showing a list of enterprises at the same location * A box called EnterpriseBox(which by the way is also a technically a modal) that shows the details of that particular enterprise selected * If at a location there exists only a single enterprise then only the box is shown
This commit is contained in:
@@ -6,6 +6,8 @@ describe "Hubs service", ->
|
||||
{
|
||||
id: 2
|
||||
active: false
|
||||
icon_font: 'abc'
|
||||
name: 'BugSpray'
|
||||
orders_close_at: new Date()
|
||||
type: "hub"
|
||||
visible: true
|
||||
@@ -15,12 +17,36 @@ describe "Hubs service", ->
|
||||
{
|
||||
id: 3
|
||||
active: false
|
||||
icon_font: 'def'
|
||||
name: 'Toothbrush'
|
||||
orders_close_at: new Date()
|
||||
type: "hub"
|
||||
visible: true
|
||||
latitude: 100
|
||||
longitude: 200
|
||||
}
|
||||
{
|
||||
id: 4
|
||||
active: false
|
||||
icon_font: 'ghi'
|
||||
name: 'Covidness'
|
||||
orders_close_at: new Date()
|
||||
type: "hub"
|
||||
visible: true
|
||||
latitude: null
|
||||
longitude: null
|
||||
}
|
||||
{
|
||||
id: 5
|
||||
active: false
|
||||
icon_font: 'jkl'
|
||||
name: 'Toothbrush for kids'
|
||||
orders_close_at: new Date()
|
||||
type: "hub"
|
||||
visible: true
|
||||
latitude: 100
|
||||
longitude: 200
|
||||
}
|
||||
]
|
||||
|
||||
beforeEach ->
|
||||
@@ -34,7 +60,19 @@ describe "Hubs service", ->
|
||||
OfnMap = $injector.get("OfnMap")
|
||||
|
||||
it "builds MapMarkers from enterprises", ->
|
||||
expect(OfnMap.enterprises[0].id).toBe enterprises[0].id
|
||||
expect(OfnMap.enterprises[0].id[0]).toBe enterprises[0].id
|
||||
|
||||
it "excludes enterprises without latitude or longitude", ->
|
||||
expect(OfnMap.enterprises.map (e) -> e.id).not.toContain enterprises[1].id
|
||||
expect(OfnMap.enterprises.map (e) -> e.id).not.toContain [enterprises[2].id]
|
||||
|
||||
it "the MapMarkers will a field for enterprises", ->
|
||||
enterprise = enterprises[0]
|
||||
expect(OfnMap.enterprises[0].enterprises[enterprise.id]).toEqual { id: enterprise.id, name: enterprise.name, icon: enterprise.icon_font }
|
||||
|
||||
it "the MapMarkers will bunch up enterprises with the same coordinates", ->
|
||||
enterprise1 = enterprises[1]
|
||||
enterprise2 = enterprises[3]
|
||||
hash = {}
|
||||
hash[enterprise1.id] = { id: enterprise1.id, name: enterprise1.name, icon: enterprise1.icon_font }
|
||||
hash[enterprise2.id] = { id: enterprise2.id, name: enterprise2.name, icon: enterprise2.icon_font }
|
||||
expect(OfnMap.enterprises[2].enterprises).toEqual hash
|
||||
|
||||
Reference in New Issue
Block a user