|
1 | 1 | import { describe, expect, test, vi } from 'vitest' |
2 | | -import { computed, effect, isSignal, signal } from '@angular/core' |
| 2 | +import { computed, effect, signal } from '@angular/core' |
3 | 3 | import { TestBed } from '@angular/core/testing' |
4 | 4 | import { injectTable, stockFeatures } from '../src' |
5 | | -import { getFnReactiveCache, testShouldBeComputedProperty } from './test-utils' |
6 | | -import type { WritableSignal } from '@angular/core' |
7 | 5 | import type { ColumnDef } from '../src' |
| 6 | +import type { WritableSignal } from '@angular/core' |
8 | 7 |
|
9 | 8 | describe('angularReactivityFeature', () => { |
10 | 9 | type Data = { id: string; title: string } |
@@ -42,136 +41,6 @@ describe('angularReactivityFeature', () => { |
42 | 41 | } |
43 | 42 |
|
44 | 43 | const table = createTestTable() |
45 | | - const tablePropertyKeys = Object.keys(table) |
46 | | - |
47 | | - describe.skip('Table property reactivity', () => { |
48 | | - test.each( |
49 | | - tablePropertyKeys.map((property) => [ |
50 | | - property, |
51 | | - testShouldBeComputedProperty(table, property), |
52 | | - ]), |
53 | | - )('property (%s) is computed -> (%s)', (name, expected) => { |
54 | | - const tableProperty = table[name as keyof typeof table] |
55 | | - expect(isSignal(tableProperty)).toEqual(expected) |
56 | | - }) |
57 | | - |
58 | | - describe('will create a computed for non detectable computed properties', () => { |
59 | | - test('getIsSomeRowsPinned', () => { |
60 | | - table.getIsSomeRowsPinned('top') |
61 | | - table.getIsSomeRowsPinned('bottom') |
62 | | - table.getIsSomeRowsPinned() |
63 | | - |
64 | | - expect(getFnReactiveCache(table.getIsSomeRowsPinned)).toHaveProperty( |
65 | | - '["top"]', |
66 | | - ) |
67 | | - expect(getFnReactiveCache(table.getIsSomeRowsPinned)).toHaveProperty( |
68 | | - '["bottom"]', |
69 | | - ) |
70 | | - expect(getFnReactiveCache(table.getIsSomeRowsPinned)).toHaveProperty( |
71 | | - '[]', |
72 | | - ) |
73 | | - }) |
74 | | - }) |
75 | | - }) |
76 | | - |
77 | | - describe.skip('Header property reactivity', () => { |
78 | | - const headers = table.getHeaderGroups() |
79 | | - headers.forEach((headerGroup, index) => { |
80 | | - const headerPropertyKeys = Object.keys(headerGroup) |
81 | | - test.each( |
82 | | - headerPropertyKeys.map((property) => [ |
83 | | - property, |
84 | | - testShouldBeComputedProperty(headerGroup, property), |
85 | | - ]), |
86 | | - )( |
87 | | - `HeaderGroup ${headerGroup.id} (${index}) - property (%s) is computed -> (%s)`, |
88 | | - (name, expected) => { |
89 | | - const tableProperty = headerGroup[name as keyof typeof headerGroup] |
90 | | - expect(isSignal(tableProperty)).toEqual(expected) |
91 | | - }, |
92 | | - ) |
93 | | - |
94 | | - const headers = headerGroup.headers |
95 | | - headers.forEach((header, cellIndex) => { |
96 | | - const headerPropertyKeys = Object.keys(header).concat( |
97 | | - Object.getOwnPropertyNames(Object.getPrototypeOf(header)), |
98 | | - ) |
99 | | - test.each( |
100 | | - headerPropertyKeys.map((property) => [ |
101 | | - property, |
102 | | - testShouldBeComputedProperty(header, property), |
103 | | - ]), |
104 | | - )( |
105 | | - `HeaderGroup ${headerGroup.id} (${index}) / Header ${header.id} - property (%s) is computed -> (%s)`, |
106 | | - (name, expected) => { |
107 | | - const tableProperty = header[name as keyof typeof header] |
108 | | - expect(isSignal(tableProperty)).toEqual(expected) |
109 | | - }, |
110 | | - ) |
111 | | - }) |
112 | | - }) |
113 | | - }) |
114 | | - |
115 | | - describe.skip('Column property reactivity', () => { |
116 | | - const columns = table.getAllColumns() |
117 | | - columns.forEach((column, index) => { |
118 | | - const columnPropertyKeys = Object.keys(column).concat( |
119 | | - Object.getOwnPropertyNames(Object.getPrototypeOf(column)), |
120 | | - ) |
121 | | - test.each( |
122 | | - columnPropertyKeys.map((property) => [ |
123 | | - property, |
124 | | - testShouldBeComputedProperty(column, property), |
125 | | - ]), |
126 | | - )( |
127 | | - `Column ${column.id} (${index}) - property (%s) is computed -> (%s)`, |
128 | | - (name, expected) => { |
129 | | - const tableProperty = column[name as keyof typeof column] |
130 | | - expect(isSignal(tableProperty)).toEqual(expected) |
131 | | - }, |
132 | | - ) |
133 | | - }) |
134 | | - }) |
135 | | - |
136 | | - describe.skip('Row and cells property reactivity', () => { |
137 | | - const flatRows = table.getRowModel().flatRows |
138 | | - flatRows.forEach((row, index) => { |
139 | | - const rowsPropertyKeys = Object.keys(row).concat( |
140 | | - Object.getOwnPropertyNames(Object.getPrototypeOf(row)), |
141 | | - ) |
142 | | - test.each( |
143 | | - rowsPropertyKeys.map((property) => [ |
144 | | - property, |
145 | | - testShouldBeComputedProperty(row, property), |
146 | | - ]), |
147 | | - )( |
148 | | - `Row ${row.id} (${index}) - property (%s) is computed -> (%s)`, |
149 | | - (name, expected) => { |
150 | | - const tableProperty = row[name as keyof typeof row] |
151 | | - expect(isSignal(tableProperty)).toEqual(expected) |
152 | | - }, |
153 | | - ) |
154 | | - |
155 | | - const cells = row.getAllCells() |
156 | | - cells.forEach((cell, cellIndex) => { |
157 | | - const cellPropertyKeys = Object.keys(cell).concat( |
158 | | - Object.getOwnPropertyNames(Object.getPrototypeOf(cell)), |
159 | | - ) |
160 | | - test.each( |
161 | | - cellPropertyKeys.map((property) => [ |
162 | | - property, |
163 | | - testShouldBeComputedProperty(cell, property), |
164 | | - ]), |
165 | | - )( |
166 | | - `Row ${row.id} (${index}) / Cell ${cell.id} - property (%s) is computed -> (%s)`, |
167 | | - (name, expected) => { |
168 | | - const tableProperty = cell[name as keyof typeof cell] |
169 | | - expect(isSignal(tableProperty)).toEqual(expected) |
170 | | - }, |
171 | | - ) |
172 | | - }) |
173 | | - }) |
174 | | - }) |
175 | 44 |
|
176 | 45 | describe('Integration', () => { |
177 | 46 | test('methods within effect will be re-trigger when options/state changes', () => { |
|
0 commit comments