Commit 8c2c97d
authored
feat: make logger injectable in ResponsiveTable class (#628)
- Add optional logger parameter to TableOptions type
- Update ResponsiveTable constructor to accept injected logger function
- Replace hardcoded logger.warn call with injected logger instance
- Default to logger.warn when no custom logger is provided
- Update test to use mock logger function instead of spying on global logger
This change improves testability by allowing tests to inject custom loggers
and increases flexibility by enabling different logging behaviors per table
instance. The change is backward compatible as the logger parameter is
optional and defaults to the existing behavior.
Resolves dependency injection concerns and enhances unit test isolation
by removing reliance on global logger state in tests.1 parent 509eb8c commit 8c2c97d
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
108 | | - | |
| 111 | + | |
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| |||
711 | 714 | | |
712 | 715 | | |
713 | 716 | | |
| 717 | + | |
| 718 | + | |
714 | 719 | | |
715 | 720 | | |
716 | 721 | | |
717 | 722 | | |
| 723 | + | |
718 | 724 | | |
719 | 725 | | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | 726 | | |
724 | 727 | | |
725 | 728 | | |
| |||
733 | 736 | | |
734 | 737 | | |
735 | 738 | | |
736 | | - | |
| 739 | + | |
737 | 740 | | |
738 | 741 | | |
739 | 742 | | |
740 | | - | |
741 | | - | |
| 743 | + | |
742 | 744 | | |
743 | 745 | | |
744 | 746 | | |
| |||
0 commit comments