Add spec to cover orders_controller watch sortOptions

This commit is contained in:
Luis Ramos
2020-04-18 10:23:02 +01:00
parent a0a361673a
commit 910cc99c2f
2 changed files with 10 additions and 2 deletions

View File

@@ -20,7 +20,6 @@ describe "CustomersCtrl", ->
{id: 109, name: "Australia", states: [{id: 55, name: "ACT", abbr: "ACT"}]}
]
inject ($controller, $rootScope, _CustomerResource_, $httpBackend) ->
scope = $rootScope
http = $httpBackend

View File

@@ -36,9 +36,18 @@ describe "ordersCtrl", ->
'q[s]': 'completed_at desc'
}))
describe "using pagination", ->
it "changes the page", ->
$scope.changePage(2)
expect($scope.page).toEqual 2
expect(Orders.index).toHaveBeenCalled()
describe "sorting products", ->
it "sorts orders", ->
spyOn $scope, "fetchResults"
$scope.sortOptions.toggle('number')
$scope.$apply()
expect($scope.sorting).toEqual 'number asc'
expect($scope.fetchResults).toHaveBeenCalled()