Fixed unit test

This commit is contained in:
Michael Abashian
2017-02-03 14:41:01 -05:00
parent c9eccb315e
commit 45805efe25

View File

@@ -38,16 +38,17 @@ describe('Directive: column-sort', () =>{
go: jasmine.createSpy('go')
};
this.$stateParams = {};
angular.mock.module('ColumnSortModule', ($provide) =>{
QuerySet = jasmine.createSpyObj('qs', ['search']);
QuerySet.search.and.callFake(() => { return { then: function(){} } });
GetBasePath = jasmine.createSpy('GetBasePath');
$provide.value('QuerySet', QuerySet);
$provide.value('GetBasePath', GetBasePath);
$provide.value('$state', this.$state);
QuerySet = jasmine.createSpyObj('qs', ['search']);
QuerySet.search.and.callFake(() => { return { then: function(){} }; });
GetBasePath = jasmine.createSpy('GetBasePath');
$provide.value('QuerySet', QuerySet);
$provide.value('GetBasePath', GetBasePath);
$provide.value('$state', this.$state);
$provide.value('$stateParams', this.$stateParams);
});
});
@@ -67,7 +68,7 @@ describe('Directive: column-sort', () =>{
};
$compile(this.name_field)($scope);
$compile(this.idx_field)($scope)
$compile(this.idx_field)($scope);
$scope.$digest();
expect( $(this.name_field).find('.columnSortIcon').hasClass('fa-sort-up') ).toEqual(true);
@@ -81,7 +82,7 @@ describe('Directive: column-sort', () =>{
};
$compile(this.name_field)($scope);
$compile(this.idx_field)($scope)
$compile(this.idx_field)($scope);
$scope.$digest();
@@ -95,7 +96,7 @@ describe('Directive: column-sort', () =>{
$(this.idx_field).click();
expect( $(this.name_field).find('.columnSortIcon').hasClass('fa-sort') ).toEqual(true);
expect( $(this.idx_field).find('.columnSortIcon').hasClass('fa-sort-down') ).toEqual(true)
expect( $(this.idx_field).find('.columnSortIcon').hasClass('fa-sort-down') ).toEqual(true);
});
});