WIP: Cherry-pick b2d82b6 - Using ofnSelect2 instead of plain select on BOM

This commit is contained in:
Rohan Mitchell
2016-08-31 17:21:06 +10:00
parent 46fcf7b62e
commit d574b8943b
8 changed files with 33 additions and 46 deletions

View File

@@ -37,25 +37,14 @@ describe "Enterprises service", ->
expect(result).toDeepEqual response
describe "when params are passed", ->
describe "where includeBlank param is truthy", ->
beforeEach ->
params = {includeBlank: true, someParam: 'someVal'}
$httpBackend.expectGET('/admin/enterprises.json?someParam=someVal').respond 200, response
result = Enterprises.index(params)
$httpBackend.flush()
beforeEach ->
params = { someParam: 'someVal'}
$httpBackend.expectGET('/admin/enterprises.json?someParam=someVal').respond 200, response
result = Enterprises.index(params)
$httpBackend.flush()
it "returns an array of enterprises, with a blank option appended to the beginning", ->
expect(result).toDeepEqual [{id: '0', name: 'All'} ,{ id: 5, name: 'Enterprise 1'}]
describe "where includeBlank param is falsey", ->
beforeEach ->
params = {includeBlank: false, someParam: 'someVal'}
$httpBackend.expectGET('/admin/enterprises.json?someParam=someVal').respond 200, response
result = Enterprises.index(params)
$httpBackend.flush()
it "returns an array of enterprises, with a blank option appended to the beginning", ->
expect(result).toDeepEqual response
it "returns an array of enterprises", ->
expect(result).toDeepEqual response
describe "#save", ->

View File

@@ -63,17 +63,17 @@ describe "LineItemsCtrl", ->
$timeout.flush()
describe "initialisation", ->
it "gets suppliers, adds a blank option as the first in the list", ->
expect(scope.suppliers).toDeepEqual [ { id : '0', name : 'All' }, supplier ]
it "gets suppliers", ->
expect(scope.suppliers).toDeepEqual [supplier ]
it "gets distributors, adds a blank option as the first in the list", ->
expect(scope.distributors).toDeepEqual [ { id : '0', name : 'All' }, distributor ]
it "gets distributors", ->
expect(scope.distributors).toDeepEqual [ distributor ]
it "stores enterprises in an list that is accessible by id", ->
expect(Enterprises.enterprisesByID[1]).toDeepEqual supplier
it "gets order cycles, adds a blank option as the first in the list", ->
expect(scope.orderCycles).toDeepEqual [ { id : '0', name : 'All' }, orderCycle ]
it "gets order cycles", ->
expect(scope.orderCycles).toDeepEqual [ orderCycle ]
it "gets orders, with dereferenced order cycles and distributors", ->
expect(scope.orders).toDeepEqual [ { id: 9, order_cycle: orderCycle, distributor: distributor, number: "R123456" } ]
@@ -85,9 +85,9 @@ describe "LineItemsCtrl", ->
expect(scope.RequestMonitor.loading).toBe false
it "resets the select filters", ->
expect(scope.distributorFilter).toBe '0'
expect(scope.supplierFilter).toBe '0'
expect(scope.orderCycleFilter).toBe '0'
expect(scope.distributorFilter).toBe 0
expect(scope.supplierFilter).toBe 0
expect(scope.orderCycleFilter).toBe 0
expect(scope.quickSearch).toBe = ""
it "resets the form state to pristine", ->