mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
Merge branch 'master' into cleanup
Conflicts: app/assets/javascripts/darkswarm/services/hubs.js.coffee app/views/home/_hubs.html.haml app/views/producers/_filters.html.haml app/views/producers/index.html.haml
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//= require angular-mocks
|
||||
//= require angular-cookies
|
||||
//= require angular-backstretch.js
|
||||
//= require angularjs-file-upload
|
||||
//= require lodash.underscore.js
|
||||
//= require angular-flash.min.js
|
||||
//= require shared/mm-foundation-tpls-0.2.2.min.js
|
||||
|
||||
@@ -1,46 +1,45 @@
|
||||
describe "Hubs service", ->
|
||||
Hubs = null
|
||||
Enterprises = null
|
||||
CurrentHubMock = {}
|
||||
CurrentHubMock = {}
|
||||
hubs = [
|
||||
{
|
||||
id: 2
|
||||
active: false
|
||||
orders_close_at: new Date()
|
||||
is_distributor: true
|
||||
has_shopfront: true
|
||||
has_hub_listing: true
|
||||
}
|
||||
{
|
||||
id: 3
|
||||
active: false
|
||||
orders_close_at: new Date()
|
||||
is_distributor: true
|
||||
has_shopfront: true
|
||||
has_hub_listing: true
|
||||
}
|
||||
{
|
||||
id: 1
|
||||
active: true
|
||||
orders_close_at: new Date()
|
||||
is_distributor: true
|
||||
has_shopfront: true
|
||||
has_hub_listing: true
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
beforeEach ->
|
||||
module 'Darkswarm'
|
||||
angular.module('Darkswarm').value('enterprises', hubs)
|
||||
angular.module('Darkswarm').value('enterprises', hubs)
|
||||
module ($provide)->
|
||||
$provide.value "CurrentHub", CurrentHubMock
|
||||
$provide.value "CurrentHub", CurrentHubMock
|
||||
null
|
||||
inject ($injector)->
|
||||
Enterprises = $injector.get("Enterprises")
|
||||
Enterprises = $injector.get("Enterprises")
|
||||
Hubs = $injector.get("Hubs")
|
||||
|
||||
it "filters Enterprise.hubs into a new array", ->
|
||||
expect(Hubs.hubs[0]).toBe Enterprises.enterprises[2]
|
||||
# Because the $filter is a new sorted array
|
||||
# Because the $filter is a new sorted array
|
||||
# We check to see the objects in both arrays are still the same
|
||||
Enterprises.enterprises[2].active = false
|
||||
Enterprises.enterprises[2].active = false
|
||||
expect(Hubs.hubs[0].active).toBe false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user