Browse Source

test(theme-shared): correct directive test

pull/2822/head
TheDiaval 6 years ago
parent
commit
4eb57ba270
  1. 8
      npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts

8
npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts

@ -1,16 +1,20 @@
import { SpectatorDirective, createDirectiveFactory } from '@ngneat/spectator/jest';
import { TableSortDirective } from '../directives/table-sort.directive';
import { TableComponent } from '../components/table/table.component';
import { DummyLocalizationPipe } from './table.component.spec';
import { PaginationComponent } from '../components';
describe('TableSortDirective', () => {
let spectator: SpectatorDirective<TableSortDirective>;
let directive: TableSortDirective;
const createDirective = createDirectiveFactory({
directive: TableSortDirective,
declarations: [TableComponent, DummyLocalizationPipe, PaginationComponent],
});
beforeEach(() => {
spectator = createDirective(
`<p-table [value]="[1,4,2]" [abpTableSort]="{ order: 'asc' }"></p-table>`,
`<abp-table [value]="[1,4,2]" [abpTableSort]="{ order: 'asc' }"></abp-table>`,
);
directive = spectator.directive;
});
@ -21,7 +25,7 @@ describe('TableSortDirective', () => {
test('should change table value', () => {
expect(directive.value).toEqual([1, 4, 2]);
const table = spectator.query(Table);
const table = spectator.query(TableComponent);
expect(table.value).toEqual([1, 2, 4]);
});
});

Loading…
Cancel
Save