mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Default column visibility can be set per user using ColumnPreferences model
This commit is contained in:
@@ -20,6 +20,7 @@ describe "VariantOverridesCtrl", ->
|
||||
$provide.value 'variantOverrides', variantOverrides
|
||||
$provide.value 'dirtyVariantOverrides', dirtyVariantOverrides
|
||||
$provide.value 'inventoryItems', inventoryItems
|
||||
$provide.value 'columns', []
|
||||
null
|
||||
|
||||
inject ($controller, _VariantOverrides_, _DirtyVariantOverrides_, _StatusMessage_) ->
|
||||
|
||||
@@ -4,6 +4,10 @@ describe "CustomersCtrl", ->
|
||||
|
||||
beforeEach ->
|
||||
module('admin.customers')
|
||||
module ($provide) ->
|
||||
$provide.value 'columns', []
|
||||
null
|
||||
|
||||
inject ($controller, $rootScope, _CustomerResource_, $httpBackend) ->
|
||||
scope = $rootScope
|
||||
http = $httpBackend
|
||||
|
||||
@@ -5,6 +5,10 @@ describe "EnterprisesCtrl", ->
|
||||
|
||||
beforeEach ->
|
||||
module('admin.enterprises')
|
||||
module ($provide) ->
|
||||
$provide.value 'columns', []
|
||||
null
|
||||
|
||||
inject ($controller, $rootScope, _Enterprises_) ->
|
||||
scope = $rootScope
|
||||
Enterprises = _Enterprises_
|
||||
|
||||
@@ -5,6 +5,9 @@ describe "PanelRow directive", ->
|
||||
|
||||
beforeEach ->
|
||||
module 'admin.indexUtils'
|
||||
module ($provide) ->
|
||||
$provide.value 'columns', []
|
||||
null
|
||||
|
||||
beforeEach inject ($rootScope, $compile, $injector, $templateCache, _Panels_) ->
|
||||
Panels = _Panels_
|
||||
|
||||
@@ -3,19 +3,21 @@ describe "Columns service", ->
|
||||
|
||||
beforeEach ->
|
||||
module 'admin.indexUtils'
|
||||
|
||||
module ($provide) ->
|
||||
$provide.value 'columns', [
|
||||
{ column_name: 'col1', visible: true }
|
||||
{ column_name: 'col2', visible: false }
|
||||
]
|
||||
null
|
||||
inject (_Columns_) ->
|
||||
Columns = _Columns_
|
||||
|
||||
describe "setting columns", ->
|
||||
describe "initialising 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 } }
|
||||
expect(Columns.columns).toEqual { col1: { column_name: 'col1', visible: true }, col2: { column_name: 'col2', visible: false } }
|
||||
|
||||
it "calls calculateVisibleCount", ->
|
||||
spyOn(Columns, "calculateVisibleCount")
|
||||
Columns.setColumns({ name: { visible: true } })
|
||||
expect(Columns.calculateVisibleCount).toHaveBeenCalled()
|
||||
it "updates visibleCount", ->
|
||||
expect(Columns.visibleCount).toBe 1
|
||||
|
||||
describe "toggling a column", ->
|
||||
it "switches the visibility of the given column", ->
|
||||
|
||||
@@ -4,6 +4,9 @@ describe "LineItemsCtrl", ->
|
||||
|
||||
beforeEach ->
|
||||
module "admin.lineItems"
|
||||
module ($provide) ->
|
||||
$provide.value 'columns', []
|
||||
null
|
||||
|
||||
jasmine.addMatchers
|
||||
toDeepEqual: (util, customEqualityTesters) ->
|
||||
|
||||
Reference in New Issue
Block a user