From c85d4be38254d9663d222de5eb9836536420f08d Mon Sep 17 00:00:00 2001 From: Leonardo Zizzamia Date: Sat, 26 Dec 2015 21:21:37 -0800 Subject: [PATCH] Added test for #193 --- src/component/test/table.spec.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/component/test/table.spec.js b/src/component/test/table.spec.js index f6413ad5..e43f07aa 100644 --- a/src/component/test/table.spec.js +++ b/src/component/test/table.spec.js @@ -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' } ]; @@ -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%' }); }); @@ -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);