Merge pull request #5256 from dacook/5190-fix-order-sorting

Fix sorting of orders list
This commit is contained in:
Luis Ramos
2020-04-26 14:24:00 +01:00
committed by GitHub
3 changed files with 11 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ angular.module("admin.orders").controller "ordersCtrl", ($scope, $timeout, Reque
return unless sort && sort.predicate != ""
$scope.sorting = sort.getSortingExpr()
$scope.fetchProducts()
$scope.fetchResults()
, true
$scope.capturePayment = (order) ->

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()