mirror of https://github.com/abpframework/abp.git
2 changed files with 30 additions and 1 deletions
@ -0,0 +1,27 @@ |
|||
import { SpectatorDirective, createDirectiveFactory, SpyObject } from '@ngneat/spectator/jest'; |
|||
import { TableSortDirective } from '../directives/table-sort.directive'; |
|||
import { TableModule, Table } from 'primeng/table'; |
|||
|
|||
describe('TableSortDirective', () => { |
|||
let spectator: SpectatorDirective<TableSortDirective>; |
|||
let directive: TableSortDirective; |
|||
const createDirective = createDirectiveFactory({ |
|||
directive: TableSortDirective, |
|||
imports: [TableModule], |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
spectator = createDirective(`<p-table [value]="[1,4,2]" [abpTableSort]="{ order: 'asc' }"></p-table>`); |
|||
directive = spectator.directive; |
|||
}); |
|||
|
|||
test('should be created', () => { |
|||
expect(directive).toBeTruthy(); |
|||
}); |
|||
|
|||
test('should change table value', () => { |
|||
expect(directive.value).toEqual([1, 4, 2]); |
|||
const table = spectator.query(Table); |
|||
expect(table.value).toEqual([1, 2, 4]); |
|||
}); |
|||
}); |
|||
Loading…
Reference in new issue