Permalink
Browse files

Doplneno nekolik zakladnich testu pro tridu FormFilter

  • Loading branch information...
1 parent 779b4ff commit 69b84e30de07b13a500555daf21dc71b1f76b866 @JakubMrozek committed Feb 20, 2013
Showing with 33 additions and 2 deletions.
  1. +2 −2 public/js/FormFilter.js
  2. +1 −0 public/js/UrlFilter.js
  3. +30 −0 test/frontend/unit/FormFilter.test.js
@@ -93,8 +93,8 @@ FormFilter.prototype.getApiData = function() {
query.offset = this.getOffset();
query.query = this._$scope.query || '';
query.limit = this._$scope.limit;
- query.filter = this._$scope.form.serialize();
- query.order = this._$scope.form.filter().getOrder();
+ query.filter = this.serialize();
+ query.order = this.filter().getOrder();
return query;
};
@@ -12,6 +12,7 @@
function UrlFilter(config) {
this._limit = config.limit;
this._orderColumns = config.orderColumns;
+ this._params = {};
}
@@ -0,0 +1,30 @@
+describe('FormFilter', function(){
+
+ var filter;
+ beforeEach(function(){
+ var $scope = {};
+ var config = {
+ limit: 10,
+ orderColumns: ['date', '-date'],
+ filterColumns: ['status', 'date'],
+ querySearch: true
+ };
+ var urlFilter = new UrlFilter(config);
+
+ filter = new FormFilter($scope, config, urlFilter);
+ });
+
+ it('vrati vychozi nastaveni', function() {
+ var def = {
+ offset: 0,
+ limit: 10,
+ filter: '',
+ query: '',
+ order: 'date'
+ };
+ expect(filter.getApiData()).toEqual(def);
+ });
+
+ //TODO: doplnit dalsi testy
+
+});

0 comments on commit 69b84e3

Please sign in to comment.