Commit 9fcddc5
perf(table-chart): optimize header ID sanitization and add unit tests
**Performance improvement:**
- Cache sanitized header ID value to avoid recomputing it twice per column
- Compute once at column definition, use for both header `id` and cell `aria-labelledby`
**Test coverage:**
- Added 8 unit tests for `sanitizeHeaderId()` function
- Tests verify all sanitization rules: %, #, △, spaces, and other special chars
- Provides faster diagnostics if sanitization logic changes in future
**Changes:**
- Export `sanitizeHeaderId()` for testing
- Cache sanitized value in `headerId` variable
- Added comprehensive unit test suite
Tests: 40 passed (8 new unit tests + 32 existing)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 790fe5c commit 9fcddc5
2 files changed
Lines changed: 46 additions & 4 deletions
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
147 | 148 | | |
148 | | - | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
857 | 858 | | |
858 | 859 | | |
859 | 860 | | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
860 | 864 | | |
861 | 865 | | |
862 | 866 | | |
| |||
982 | 986 | | |
983 | 987 | | |
984 | 988 | | |
985 | | - | |
| 989 | + | |
986 | 990 | | |
987 | 991 | | |
988 | 992 | | |
| |||
1069 | 1073 | | |
1070 | 1074 | | |
1071 | 1075 | | |
1072 | | - | |
| 1076 | + | |
1073 | 1077 | | |
1074 | 1078 | | |
1075 | 1079 | | |
| |||
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
28 | 66 | | |
29 | 67 | | |
30 | 68 | | |
| |||
0 commit comments