aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/viewsets.py
diff options
context:
space:
mode:
authorTom Christie2015-03-23 11:37:12 +0000
committerTom Christie2015-03-23 11:37:12 +0000
commit35a0cbb911c641027e9123cbbb67a186e8a80072 (patch)
treec360015ea8e80d93aad9e5f8f845e36a2827b0f9 /rest_framework/viewsets.py
parentf7cd7a1c1fca4c7f0e38c5ed1762f5f498bf37a3 (diff)
downloaddjango-rest-framework-35a0cbb911c641027e9123cbbb67a186e8a80072.tar.bz2
Add 3.1.x series header
Diffstat (limited to 'rest_framework/viewsets.py')
0 files changed, 0 insertions, 0 deletions
"p">, []); $provide.factory('docsSearch', function() { return function(q) { return ['one','two','three']; }; }); }); inject(function($controller, $rootScope, $location, docsSearch) { $scope = $rootScope.$new(); ctrl = $controller('DocsNavigationCtrl', { $scope : $scope, $location : $location, docsSearch : docsSearch }); }); }); it("should search and return data from docsSearch", function() { $scope.search('1234') expect($scope.results.join(',')).toBe('one,two,three'); expect($scope.hasResults).toBe(true); }); it("should avoid searching if the search term is too short", function() { $scope.search('1') expect($scope.results.length).toBe(0); expect($scope.hasResults).toBe(false); }); it("should set the columns classname based on the total grouped results", function() { $scope.search('1234'); expect($scope.colClassName).toBe('cols-3'); $scope.search('1'); expect($scope.colClassName).toBe(null); }); it("should hide and clear the results when called", function() { $scope.hasResults = true; $scope.results = ['one']; $scope.colClassName = '...'; $scope.hideResults(); expect($scope.hasResults).toBe(false); expect($scope.results.length).toBe(0); expect($scope.colClassName).toBe(null); }); it("should hide, clear and change the path of the page when submitted", inject(function($location) { $scope.hasResults = true; $scope.results = { api : [ {url : '/home'} ], tutorial : [ {url : '/tutorial'} ] }; $scope.submit(); expect($location.path()).toBe('/home'); expect($scope.results.length).toBe(0); expect($scope.hasResults).toBe(false); })); });