mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-21 00:47:26 +00:00
Pulling columns logic out into its own services/controller in a new indexUtils module
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
describe "ColumnsCtrl", ->
|
||||
ctrl = null
|
||||
scope = null
|
||||
Columns = null
|
||||
|
||||
beforeEach ->
|
||||
Columns = { columns: { name: { visible: true} } }
|
||||
|
||||
module('admin.indexUtils')
|
||||
inject ($controller, $rootScope) ->
|
||||
scope = $rootScope
|
||||
ctrl = $controller 'ColumnsCtrl', {$scope: scope, Columns: Columns}
|
||||
|
||||
it "initialises data", ->
|
||||
expect(scope.columns).toEqual Columns.columns
|
||||
expect(scope.predicate).toEqual ""
|
||||
expect(scope.reverse).toEqual false
|
||||
@@ -0,0 +1,15 @@
|
||||
describe "Columns service", ->
|
||||
Columns = null
|
||||
|
||||
beforeEach ->
|
||||
module 'admin.indexUtils'
|
||||
|
||||
inject (_Columns_) ->
|
||||
Columns = _Columns_
|
||||
|
||||
Columns.columns = ["something"]
|
||||
|
||||
describe "setting columns", ->
|
||||
it "sets resets @columns and copies each column of the provided object across", ->
|
||||
Columns.setColumns({ name: { visible: true } })
|
||||
expect(Columns.columns).toEqual { name: { visible: true } }
|
||||
Reference in New Issue
Block a user