mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Auto-complete tags on customers page
- new controller serving tags for an enterprise as JSON - customers page suggesting these tags - emphasising tags that have rules
This commit is contained in:
@@ -47,3 +47,32 @@ describe "CustomersCtrl", ->
|
||||
http.flush()
|
||||
expect(scope.customers.length).toBe 1
|
||||
expect(scope.customers[0]).not.toAngularEqual customer
|
||||
|
||||
describe "scope.findTags", ->
|
||||
tags = [
|
||||
{ text: 'one' }
|
||||
{ text: 'two' }
|
||||
{ text: 'three' }
|
||||
]
|
||||
beforeEach ->
|
||||
http.expectGET('/admin/tags.json?enterprise_id=1').respond 200, tags
|
||||
|
||||
it "retrieves the tag list", ->
|
||||
promise = scope.findTags('')
|
||||
result = null
|
||||
promise.then (data) ->
|
||||
result = data
|
||||
http.flush()
|
||||
expect(result).toAngularEqual tags
|
||||
|
||||
it "filters the tag list", ->
|
||||
filtered_tags = [
|
||||
{ text: 'two' }
|
||||
{ text: 'three' }
|
||||
]
|
||||
promise = scope.findTags('t')
|
||||
result = null
|
||||
promise.then (data) ->
|
||||
result = data
|
||||
http.flush()
|
||||
expect(result).toAngularEqual filtered_tags
|
||||
|
||||
Reference in New Issue
Block a user