Skip to content

Commit

Permalink
Added test for #193
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Dec 27, 2015
1 parent b68d0e5 commit c85d4be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/component/test/table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ describe('Component: table', function () {
beforeEach(inject(function ($rootScope, $compile, _sortingJSON_) {
$scope = $rootScope.$new();
$scope.resource = angular.copy(_sortingJSON_);
$scope.resource.header[2].sortable = false;
$scope.resource.something = [
{ 'name': 'Ritual Coffee Roasters' }
];
Expand Down Expand Up @@ -147,7 +148,7 @@ describe('Component: table', function () {
expect(tastyThead.isolateScope().columns[1].sortable).toEqual(true);
expect(tastyThead.isolateScope().columns[1].style).toEqual({ width : '20%' });
expect(tastyThead.isolateScope().columns[2].active).toEqual(false);
expect(tastyThead.isolateScope().columns[2].sortable).toEqual(true);
expect(tastyThead.isolateScope().columns[2].sortable).toEqual(false);
expect(tastyThead.isolateScope().columns[2].style).toEqual( { width : '30%' });
});

Expand All @@ -166,6 +167,12 @@ describe('Component: table', function () {
expect(tastyThead.isolateScope().columns[1].active).toEqual(true);
});

it('should set the sortable property when declared', function () {
expect(element.scope().header.columns[0].sortable).toEqual(undefined);
expect(element.scope().header.columns[1].sortable).toEqual(undefined);
expect(element.scope().header.columns[2].sortable).toEqual(false);
});

it('should sorting ascending and descending scope.header.sortBy when scope.sortBy is clicked', function () {
field = {'key': 'star', 'name': 'star', 'sortable': true};
tastyThead.isolateScope().sortBy(field);
Expand Down

0 comments on commit c85d4be

Please sign in to comment.