Commit 1b14908d authored by Aron Carroll's avatar Aron Carroll Committed by Randall Leeds

Use camel case for angular event names

parent 8d06a91c
# Augments a button to provide loading/status flags for asynchronous actions. # Augments a button to provide loading/status flags for asynchronous actions.
# #
# Requires that the attribute provide a "target" form name. It will then listen # Requires that the attribute provide a "target" form name. It will then listen
# to "form-state" events on the scope. These events are expected to provide a # to "formState" events on the scope. These events are expected to provide a
# the form name and a status. # the form name and a status.
# #
# Example # Example
...@@ -33,7 +33,7 @@ statusButton = -> ...@@ -33,7 +33,7 @@ statusButton = ->
wrapper.insertBefore(elem) wrapper.insertBefore(elem)
wrapper.append(elem) wrapper.append(elem)
scope.$on 'form-state', (event, formName, formState) -> scope.$on 'formState', (event, formName, formState) ->
return unless formName == targetForm return unless formName == targetForm
unless formState in [STATE_LOADING, STATE_SUCCESS] unless formState in [STATE_LOADING, STATE_SUCCESS]
formState = '' formState = ''
......
...@@ -27,15 +27,15 @@ describe 'h.directives.statusButton', -> ...@@ -27,15 +27,15 @@ describe 'h.directives.statusButton', ->
it 'sets the status-button-state attribute when a loading event is triggered', -> it 'sets the status-button-state attribute when a loading event is triggered', ->
parent = $element.parent() parent = $element.parent()
$scope.$emit('form-state', 'test', 'loading') $scope.$emit('formState', 'test', 'loading')
assert.equal(parent.attr('status-button-state'), 'loading') assert.equal(parent.attr('status-button-state'), 'loading')
it 'sets the status-button-state attribute when a success event is triggered', -> it 'sets the status-button-state attribute when a success event is triggered', ->
parent = $element.parent() parent = $element.parent()
$scope.$emit('form-state', 'test', 'success') $scope.$emit('formState', 'test', 'success')
assert.equal(parent.attr('status-button-state'), 'success') assert.equal(parent.attr('status-button-state'), 'success')
it 'unsets the status-button-state attribute when another event is triggered', -> it 'unsets the status-button-state attribute when another event is triggered', ->
parent = $element.parent() parent = $element.parent()
$scope.$emit('form-state', 'test', 'reset') $scope.$emit('formState', 'test', 'reset')
assert.equal(parent.attr('status-button-state'), '') assert.equal(parent.attr('status-button-state'), '')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment