#488 client/core/src/components/table/index.js Front unit test
This commit is contained in:
parent
edfba5e7a7
commit
aa5b55423a
|
@ -0,0 +1,35 @@
|
|||
import './index.js';
|
||||
|
||||
fdescribe('Component vnTable', () => {
|
||||
let $scope;
|
||||
let $element;
|
||||
let controller;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$element = angular.element(`
|
||||
<vn-table model="model">
|
||||
<vn-thead class="ng-scope">
|
||||
<vn-tr>
|
||||
<vn-th field="id"></vn-th>
|
||||
<vn-th field="salesPerson" class="active"></vn-th>
|
||||
<vn-th field="shipped" class="active"></vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
</vn-table>`);
|
||||
controller = $componentController('vnTable', {$scope, $element, $transclude: () => {}});
|
||||
}));
|
||||
|
||||
describe('setActiveArrow()', () => {
|
||||
it(`should remove the active class from all table headers and then add it to the one in field`, () => {
|
||||
controller.field = 'id';
|
||||
|
||||
controller.setActiveArrow();
|
||||
|
||||
expect($element[0].getElementsByClassName('active')[0].getAttribute('field')).toEqual('id');
|
||||
expect($element[0].getElementsByClassName('active').length).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue