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:
Maikel Linke
2016-04-29 12:33:33 +10:00
parent 88e9eb59cf
commit fa5fa9e228
19 changed files with 159 additions and 18 deletions

View File

@@ -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