tablefilter 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/dist/starter.html +2 -2
  2. package/dist/tablefilter/tablefilter.js +1 -1
  3. package/dist/tablefilter/tf-1-2aa33b10e0e549020c12.js +1 -0
  4. package/dist/tablefilter/tf-1-bc5a8b07e0d66035b05b.js +1 -0
  5. package/dist/tablefilter/{tf-2-3a936d22b849361acff5.js → tf-2-025e1e774794d5827df8.js} +2 -2
  6. package/dist/tablefilter.cjs.js +17614 -4
  7. package/dist/tablefilter.esm.js +15736 -5397
  8. package/dist/tablefilter.umd.js +17620 -4
  9. package/index.js +16 -1
  10. package/package.json +10 -1
  11. package/src/components/attributes.js +59 -0
  12. package/src/components/table-filter.js +193 -45
  13. package/src/components/tf-rows-counter.js +3 -6
  14. package/src/components/tf-status.js +6 -11
  15. package/src/extensions/sort/sort.js +8 -1
  16. package/src/tablefilter.js +39 -6
  17. package/.editorconfig +0 -15
  18. package/.esdoc.json +0 -14
  19. package/.eslintrc +0 -37
  20. package/.gitattributes +0 -16
  21. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  22. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -36
  23. package/.github/ISSUE_TEMPLATE/support.md +0 -17
  24. package/.github/dependabot.yml +0 -10
  25. package/.github/workflows/build-deploy.yml +0 -141
  26. package/.github/workflows/opencode-review.yml +0 -104
  27. package/.github/workflows/opencode.yml +0 -34
  28. package/AGENTS.md +0 -36
  29. package/CONTRIBUTING.md +0 -128
  30. package/Gruntfile.js +0 -252
  31. package/PULL_REQUEST_TEMPLATE.md +0 -24
  32. package/ROADMAP/README.md +0 -34
  33. package/ROADMAP/content-projection-parity.md +0 -162
  34. package/ROADMAP/hybrid-migration-strategy.md +0 -275
  35. package/ROADMAP/key-decisions-review.md +0 -215
  36. package/ROADMAP/preliminary-and-milestone-0.8.0-plan.md +0 -307
  37. package/ROADMAP/v1-webcomponents-investigation.md +0 -521
  38. package/dist/tablefilter/tablefilter.vite.js +0 -4
  39. package/dist/tablefilter/tf-1-a5c3a73bd559e47dd5a2.js +0 -1
  40. package/playwright.config.js +0 -25
  41. package/scripts/check-css-tokens.js +0 -65
  42. package/static/demos-assets/img_best-price.png +0 -0
  43. package/static/demos-assets/img_great-deal.png +0 -0
  44. package/static/demos-assets/img_maintenance.jpg +0 -0
  45. package/static/demos-assets/img_new-edition.png +0 -0
  46. package/static/demos-assets/img_sold-out.png +0 -0
  47. package/static/partials/books-table-with-images.html +0 -328
  48. package/static/partials/books.html +0 -273
  49. package/static/partials/countries-by-continent.html +0 -2592
  50. package/static/partials/countries-table-tiny.html +0 -436
  51. package/static/partials/countries-table.html +0 -12954
  52. package/static/partials/dummy-table-with-totals-footer.html +0 -353
  53. package/static/partials/dummy-table.html +0 -503
  54. package/static/partials/pre-inline-script.html +0 -17
  55. package/static/partials/pre.html +0 -1
  56. package/static/partials/style.html +0 -23
  57. package/static/partials/table-with-grouped-headers.html +0 -9258
  58. package/static/partials/tablefilter-script.html +0 -1
  59. package/static/style/active-header.styl +0 -10
  60. package/static/style/alternating-rows.styl +0 -8
  61. package/static/style/config.styl +0 -44
  62. package/static/style/custom-properties.styl +0 -43
  63. package/static/style/extensions/colsVisibility.styl +0 -71
  64. package/static/style/extensions/filtersVisibility.styl +0 -18
  65. package/static/style/ezedittable.styl +0 -93
  66. package/static/style/filter-checklist.styl +0 -52
  67. package/static/style/filters.styl +0 -111
  68. package/static/style/grid-layout.styl +0 -130
  69. package/static/style/help.styl +0 -57
  70. package/static/style/keyword.styl +0 -8
  71. package/static/style/loader.styl +0 -16
  72. package/static/style/mixins/arrow.styl +0 -63
  73. package/static/style/mixins/box-shadow.styl +0 -8
  74. package/static/style/mixins/empty-content.styl +0 -7
  75. package/static/style/noresults.styl +0 -14
  76. package/static/style/paging.styl +0 -73
  77. package/static/style/reset-button.styl +0 -21
  78. package/static/style/rows-counter.styl +0 -17
  79. package/static/style/sort.styl +0 -20
  80. package/static/style/status-bar.styl +0 -13
  81. package/static/style/table.styl +0 -44
  82. package/static/style/tablefilter.styl +0 -19
  83. package/static/style/themes/blank.png +0 -0
  84. package/static/style/themes/btn_clear_filters.png +0 -0
  85. package/static/style/themes/btn_filter.png +0 -0
  86. package/static/style/themes/btn_first_page.gif +0 -0
  87. package/static/style/themes/btn_last_page.gif +0 -0
  88. package/static/style/themes/btn_next_page.gif +0 -0
  89. package/static/style/themes/btn_previous_page.gif +0 -0
  90. package/static/style/themes/default/default.styl +0 -137
  91. package/static/style/themes/default/images/bg_infDiv.jpg +0 -0
  92. package/static/style/themes/default/images/bg_th.jpg +0 -0
  93. package/static/style/themes/default/images/btn_eraser.gif +0 -0
  94. package/static/style/themes/default/images/btn_first_page.gif +0 -0
  95. package/static/style/themes/default/images/btn_last_page.gif +0 -0
  96. package/static/style/themes/default/images/btn_next_page.gif +0 -0
  97. package/static/style/themes/default/images/btn_over_eraser.gif +0 -0
  98. package/static/style/themes/default/images/btn_over_first_page.gif +0 -0
  99. package/static/style/themes/default/images/btn_over_last_page.gif +0 -0
  100. package/static/style/themes/default/images/btn_over_next_page.gif +0 -0
  101. package/static/style/themes/default/images/btn_over_previous_page.gif +0 -0
  102. package/static/style/themes/default/images/btn_previous_page.gif +0 -0
  103. package/static/style/themes/default/images/img_loading.gif +0 -0
  104. package/static/style/themes/downsimple.png +0 -0
  105. package/static/style/themes/icn_clp.png +0 -0
  106. package/static/style/themes/icn_exp.png +0 -0
  107. package/static/style/themes/icn_filter.gif +0 -0
  108. package/static/style/themes/icn_filterActive.gif +0 -0
  109. package/static/style/themes/mytheme/images/bg_headers.jpg +0 -0
  110. package/static/style/themes/mytheme/images/bg_infDiv.jpg +0 -0
  111. package/static/style/themes/mytheme/images/btn_filter.png +0 -0
  112. package/static/style/themes/mytheme/images/btn_first_page.gif +0 -0
  113. package/static/style/themes/mytheme/images/btn_last_page.gif +0 -0
  114. package/static/style/themes/mytheme/images/btn_next_page.gif +0 -0
  115. package/static/style/themes/mytheme/images/btn_previous_page.gif +0 -0
  116. package/static/style/themes/mytheme/images/img_loading.gif +0 -0
  117. package/static/style/themes/mytheme/mytheme.styl +0 -152
  118. package/static/style/themes/skyblue/images/bg_skyblue.gif +0 -0
  119. package/static/style/themes/skyblue/images/btn_first_page.gif +0 -0
  120. package/static/style/themes/skyblue/images/btn_last_page.gif +0 -0
  121. package/static/style/themes/skyblue/images/btn_next_page.gif +0 -0
  122. package/static/style/themes/skyblue/images/btn_prev_page.gif +0 -0
  123. package/static/style/themes/skyblue/images/icn_clear_filters.png +0 -0
  124. package/static/style/themes/skyblue/images/img_loading.gif +0 -0
  125. package/static/style/themes/skyblue/skyblue.styl +0 -195
  126. package/static/style/themes/transparent/images/btn_first_page.gif +0 -0
  127. package/static/style/themes/transparent/images/btn_last_page.gif +0 -0
  128. package/static/style/themes/transparent/images/btn_next_page.gif +0 -0
  129. package/static/style/themes/transparent/images/btn_prev_page.gif +0 -0
  130. package/static/style/themes/transparent/images/icn_clear_filters.png +0 -0
  131. package/static/style/themes/transparent/images/img_loading.gif +0 -0
  132. package/static/style/themes/transparent/transparent.styl +0 -205
  133. package/static/style/themes/upsimple.png +0 -0
  134. package/static/style/toolbar.styl +0 -58
  135. package/static/templates/advanced-grid-editable.html +0 -140
  136. package/static/templates/advanced-grid-selection.html +0 -93
  137. package/static/templates/auto-filter.html +0 -46
  138. package/static/templates/columns-visibility.html +0 -67
  139. package/static/templates/data-types.html +0 -123
  140. package/static/templates/demo.html +0 -62
  141. package/static/templates/external-filters-visibility-commad.html +0 -49
  142. package/static/templates/external-filters.html +0 -125
  143. package/static/templates/filter-images.html +0 -91
  144. package/static/templates/filters-visibility.html +0 -45
  145. package/static/templates/grid-layout.html +0 -51
  146. package/static/templates/grouped-headers.html +0 -78
  147. package/static/templates/linked-filters-disabled.html +0 -56
  148. package/static/templates/linked-filters.html +0 -45
  149. package/static/templates/load-filters-on-demand.html +0 -42
  150. package/static/templates/pagination.html +0 -78
  151. package/static/templates/requirejs.html +0 -53
  152. package/static/templates/starter.html +0 -61
  153. package/static/templates/table-filter.html +0 -40
  154. package/static/templates/theme-roller.html +0 -106
  155. package/test/libs/polyfill.js +0 -359
  156. package/test/libs/qunit/qunit.css +0 -237
  157. package/test/libs/qunit/qunit.js +0 -2495
  158. package/test/playwright/axe.baseline.spec.js +0 -34
  159. package/test/playwright/axe.statusbar.spec.js +0 -35
  160. package/test/playwright/axeScan.js +0 -42
  161. package/test/playwright/ce-bridge.spec.js +0 -167
  162. package/test/playwright/qunit.all.spec.js +0 -10
  163. package/test/playwright/qunit.single.spec.js +0 -14
  164. package/test/playwright/qunitSuite.js +0 -56
  165. package/test/playwright/table-filter.config.spec.js +0 -265
  166. package/test/playwright/table-filter.demo.spec.js +0 -60
  167. package/test/playwright/table-filter.element.spec.js +0 -477
  168. package/test/playwright/tf-clear-button.spec.js +0 -135
  169. package/test/playwright/tf-rows-counter.spec.js +0 -172
  170. package/test/playwright/tf-status.spec.js +0 -258
  171. package/test/test-active-columns.html +0 -80
  172. package/test/test-active-columns.js +0 -318
  173. package/test/test-alternate-rows.html +0 -80
  174. package/test/test-alternate-rows.js +0 -335
  175. package/test/test-api.html +0 -141
  176. package/test/test-api.js +0 -795
  177. package/test/test-auto-filter.html +0 -80
  178. package/test/test-auto-filter.js +0 -43
  179. package/test/test-callbacks.html +0 -78
  180. package/test/test-callbacks.js +0 -58
  181. package/test/test-case-sensitive-query.html +0 -78
  182. package/test/test-case-sensitive-query.js +0 -39
  183. package/test/test-cell-parser.html +0 -109
  184. package/test/test-cell-parser.js +0 -80
  185. package/test/test-checklist.html +0 -78
  186. package/test/test-checklist.js +0 -267
  187. package/test/test-clear-button.html +0 -79
  188. package/test/test-clear-button.js +0 -183
  189. package/test/test-col-ops-grid-layout.html +0 -129
  190. package/test/test-col-ops-grid-layout.js +0 -134
  191. package/test/test-col-ops-paging.html +0 -129
  192. package/test/test-col-ops-paging.js +0 -154
  193. package/test/test-col-ops.html +0 -129
  194. package/test/test-col-ops.js +0 -337
  195. package/test/test-col-widths.html +0 -80
  196. package/test/test-col-widths.js +0 -40
  197. package/test/test-cols-visibility-grid-layout.html +0 -80
  198. package/test/test-cols-visibility-grid-layout.js +0 -165
  199. package/test/test-cols-visibility.html +0 -80
  200. package/test/test-cols-visibility.js +0 -121
  201. package/test/test-custom-options.html +0 -80
  202. package/test/test-custom-options.js +0 -139
  203. package/test/test-data-types.html +0 -377
  204. package/test/test-data-types.js +0 -392
  205. package/test/test-date-type.html +0 -356
  206. package/test/test-date-type.js +0 -159
  207. package/test/test-disable-enter-key.html +0 -78
  208. package/test/test-disable-enter-key.js +0 -29
  209. package/test/test-disable-filter-onchange.html +0 -78
  210. package/test/test-disable-filter-onchange.js +0 -40
  211. package/test/test-dom-changes.html +0 -78
  212. package/test/test-dom-changes.js +0 -166
  213. package/test/test-dropdown.html +0 -78
  214. package/test/test-dropdown.js +0 -246
  215. package/test/test-emitter.html +0 -78
  216. package/test/test-emitter.js +0 -57
  217. package/test/test-empty-cells-filtering.html +0 -8696
  218. package/test/test-empty-cells-filtering.js +0 -45
  219. package/test/test-exact-query-match.html +0 -78
  220. package/test/test-exact-query-match.js +0 -56
  221. package/test/test-excluded-rows.html +0 -92
  222. package/test/test-excluded-rows.js +0 -129
  223. package/test/test-external-filters.html +0 -100
  224. package/test/test-external-filters.js +0 -219
  225. package/test/test-filter-html-elements.html +0 -88
  226. package/test/test-filter-html-elements.js +0 -63
  227. package/test/test-filter-operators.html +0 -80
  228. package/test/test-filter-operators.js +0 -264
  229. package/test/test-filtering.html +0 -53
  230. package/test/test-filtering.js +0 -293
  231. package/test/test-filters-visibility-grid-layout.html +0 -80
  232. package/test/test-filters-visibility-grid-layout.js +0 -50
  233. package/test/test-filters-visibility-with-button.html +0 -80
  234. package/test/test-filters-visibility-with-button.js +0 -48
  235. package/test/test-filters-visibility.html +0 -80
  236. package/test/test-filters-visibility.js +0 -48
  237. package/test/test-grid-layout.html +0 -7736
  238. package/test/test-grid-layout.js +0 -39
  239. package/test/test-grouped-headers.html +0 -154
  240. package/test/test-grouped-headers.js +0 -107
  241. package/test/test-hash.html +0 -78
  242. package/test/test-hash.js +0 -88
  243. package/test/test-help-responsive.html +0 -79
  244. package/test/test-help-responsive.js +0 -70
  245. package/test/test-help.html +0 -78
  246. package/test/test-help.js +0 -217
  247. package/test/test-highlight-keywords.html +0 -78
  248. package/test/test-highlight-keywords.js +0 -94
  249. package/test/test-ignore-diacritics.html +0 -67
  250. package/test/test-ignore-diacritics.js +0 -117
  251. package/test/test-integration-paging-sort.html +0 -80
  252. package/test/test-integration-paging-sort.js +0 -60
  253. package/test/test-linked-filters-disabled-options-grid-layout.html +0 -80
  254. package/test/test-linked-filters-disabled-options-grid-layout.js +0 -73
  255. package/test/test-linked-filters-grid-layout.html +0 -80
  256. package/test/test-linked-filters-grid-layout.js +0 -72
  257. package/test/test-linked-filters-load-filters-on-demand.html +0 -80
  258. package/test/test-linked-filters-load-filters-on-demand.js +0 -99
  259. package/test/test-linked-filters-paging.html +0 -80
  260. package/test/test-linked-filters-paging.js +0 -99
  261. package/test/test-linked-filters.html +0 -80
  262. package/test/test-linked-filters.js +0 -138
  263. package/test/test-load-filters-on-demand.html +0 -78
  264. package/test/test-load-filters-on-demand.js +0 -124
  265. package/test/test-loader.html +0 -79
  266. package/test/test-loader.js +0 -159
  267. package/test/test-no-config.html +0 -80
  268. package/test/test-no-config.js +0 -63
  269. package/test/test-no-filters.html +0 -80
  270. package/test/test-no-filters.js +0 -172
  271. package/test/test-no-headers.html +0 -71
  272. package/test/test-no-headers.js +0 -99
  273. package/test/test-no-results-message.html +0 -262
  274. package/test/test-no-results-message.js +0 -222
  275. package/test/test-no-rows.html +0 -19
  276. package/test/test-no-rows.js +0 -10
  277. package/test/test-one-row.html +0 -29
  278. package/test/test-one-row.js +0 -18
  279. package/test/test-paging.html +0 -78
  280. package/test/test-paging.js +0 -273
  281. package/test/test-popup-filter-one-row.html +0 -38
  282. package/test/test-popup-filter-one-row.js +0 -138
  283. package/test/test-popup-filter.html +0 -78
  284. package/test/test-popup-filter.js +0 -384
  285. package/test/test-popup-filters-grouped-headers.html +0 -104
  286. package/test/test-popup-filters-grouped-headers.js +0 -206
  287. package/test/test-rows-counter.html +0 -78
  288. package/test/test-rows-counter.js +0 -114
  289. package/test/test-single-filter.html +0 -79
  290. package/test/test-single-filter.js +0 -138
  291. package/test/test-sort-custom-sorter.html +0 -244
  292. package/test/test-sort-custom-sorter.js +0 -74
  293. package/test/test-sort-grid-layout.html +0 -143
  294. package/test/test-sort-grid-layout.js +0 -86
  295. package/test/test-sort-key.html +0 -244
  296. package/test/test-sort-key.js +0 -67
  297. package/test/test-sort.html +0 -143
  298. package/test/test-sort.js +0 -126
  299. package/test/test-state.html +0 -78
  300. package/test/test-state.js +0 -369
  301. package/test/test-status-bar.html +0 -79
  302. package/test/test-status-bar.js +0 -149
  303. package/test/test-storage-cookie.html +0 -78
  304. package/test/test-storage-cookie.js +0 -82
  305. package/test/test-storage-local.html +0 -78
  306. package/test/test-storage-local.js +0 -82
  307. package/test/test-tfoot.html +0 -96
  308. package/test/test-tfoot.js +0 -123
  309. package/test/test-thead.html +0 -80
  310. package/test/test-thead.js +0 -69
  311. package/test/test-toolbar.html +0 -81
  312. package/test/test-toolbar.js +0 -218
  313. package/test/test-uneven-rows.html +0 -95
  314. package/test/test-uneven-rows.js +0 -61
  315. package/test/test-watermark.html +0 -80
  316. package/test/test-watermark.js +0 -103
  317. package/test/test.html +0 -141
  318. package/test/test.js +0 -162
  319. package/vite.config.js +0 -71
  320. package/webpack.config.js +0 -99
  321. package/webpack.dev.config.js +0 -25
  322. package/webpack.test.config.js +0 -44
@@ -1,34 +0,0 @@
1
- // Accessibility baseline (#896, report-only): scan the flagship
2
- // demo page and attach violations without failing. The whole-page
3
- // findings (filter inputs/selects without labels) are tracked by
4
- // #948; per-component enforcement lives in axe.statusbar.spec.js.
5
- const { test, expect } = require('@playwright/test');
6
- const { scanAccessibility } = require('./axeScan');
7
-
8
- const DEMO_PAGE = 'demos/demo.html';
9
-
10
- // Axe needs longer than the default 30s on this large fixture.
11
- test.setTimeout(120000);
12
-
13
- test(`Axe baseline (report-only): ${DEMO_PAGE}`, async (
14
- { page }, testInfo
15
- ) => {
16
- await page.goto(`/${DEMO_PAGE}`);
17
- await page.waitForSelector('#demo');
18
- // fltrow: default flts_row_css_class (src/tablefilter.js)
19
- // state: attached — the status bar is empty (zero height) until a
20
- // message arrives, so a visibility wait would only resolve when
21
- // the stylesheet happens to give the empty container height.
22
- await page.waitForSelector('#demo .fltrow, #demo .status', {
23
- state: 'attached',
24
- timeout: 15000
25
- });
26
-
27
- const violations =
28
- await scanAccessibility(page, testInfo, DEMO_PAGE);
29
-
30
- // Report-only: the scan ran and produced a structured report.
31
- // TODO(#948): assert zero violations once the whole-page
32
- // findings (unlabelled filter inputs/selects) are fixed.
33
- expect(Array.isArray(violations)).toBe(true);
34
- });
@@ -1,35 +0,0 @@
1
- // Accessibility enforcement (#897): the status bar must report zero
2
- // axe violations, scoped to its own container so unrelated page
3
- // findings (filter inputs/selects, tracked by #948) do not mask a
4
- // real status-bar regression. Fails CI on any violation.
5
- const { test, expect } = require('@playwright/test');
6
- const { scanAccessibility } = require('./axeScan');
7
-
8
- const DEMO_PAGE = 'demos/demo.html';
9
- const STATUS_SCOPE = '.status';
10
-
11
- // Page load plus the scan outlast the 30s default.
12
- test.setTimeout(60000);
13
-
14
- test(`Axe zero-violations: status bar on ${DEMO_PAGE}`, async (
15
- { page }, testInfo
16
- ) => {
17
- await page.goto(`/${DEMO_PAGE}`);
18
-
19
- // The bar is empty until a message arrives, so it has no height
20
- // (none at all without the stylesheet): assert attachment, not
21
- // visibility. Auto-retries, and fails fast with a clear message
22
- // if the container class ever changes.
23
- const statusBar = page.locator(STATUS_SCOPE);
24
- await expect(statusBar, 'status bar container is not attached')
25
- .toBeAttached({ timeout: 15000 });
26
-
27
- const violations = await scanAccessibility(
28
- page, testInfo, `status bar on ${DEMO_PAGE}`,
29
- { include: STATUS_SCOPE }
30
- );
31
-
32
- expect(
33
- violations.map((v) => `${v.id}: ${v.nodes.length} node(s)`)
34
- ).toEqual([]);
35
- });
@@ -1,42 +0,0 @@
1
- // Accessibility scanner (#896 report-only, #897 scoped enforcement):
2
- // runs AxeBuilder against a loaded page, logs a summary and attaches
3
- // the violation report. Callers decide whether to assert.
4
- const { AxeBuilder } = require('@axe-core/playwright');
5
-
6
- // Full WCAG 2.x A/AA tag set; the AA target needs the A levels too.
7
- const WCAG_TAGS = [
8
- 'wcag2a', 'wcag2aa',
9
- 'wcag21a', 'wcag21aa',
10
- 'wcag22a', 'wcag22aa'
11
- ];
12
-
13
- // `include` narrows the audit to a CSS scope (per-component gates,
14
- // e.g. .status in #897); omit it to scan the whole page.
15
- async function scanAccessibility(page, testInfo, label, { include } = {}) {
16
- const builder = new AxeBuilder({ page }).withTags(WCAG_TAGS);
17
- if (include) {
18
- builder.include(include);
19
- }
20
- const results = await builder.analyze();
21
- const summary = results.violations.map((violation) => ({
22
- id: violation.id,
23
- impact: violation.impact,
24
- nodes: violation.nodes.length,
25
- description: violation.description
26
- }));
27
- await testInfo.attach(`${label} axe report`, {
28
- body: JSON.stringify(
29
- { page: label, failures: summary.length, summary },
30
- null,
31
- 2
32
- ),
33
- contentType: 'application/json'
34
- });
35
- console.log(
36
- `axe ${label}: ${summary.length} violation(s) ` +
37
- `(${summary.map((item) => item.id).join(', ') || 'none'})`
38
- );
39
- return results.violations;
40
- }
41
-
42
- module.exports = { WCAG_TAGS, scanAccessibility };
@@ -1,167 +0,0 @@
1
- // CE bridge integration (#912): unlike the component specs, which mount
2
- // the custom element directly, these tests load the component into the
3
- // page and then initialise TableFilter, so `customElements.get(...)` is
4
- // truthy and the feature routes through `initCE()` instead of
5
- // `initLegacy()` (see ROADMAP/hybrid-migration-strategy.md). Each test
6
- // asserts the host element, that interaction still reaches TableFilter,
7
- // and that destroy() removes the host. Fails CI on regression.
8
- const { test, expect } = require('@playwright/test');
9
-
10
- const FIXTURE = '/test/test-emitter.html';
11
- const TABLE_HTML =
12
- '<tbody><tr><th>From</th></tr><tr><td>Sydney</td></tr></tbody>';
13
-
14
- test('clear button bridge uses tf-clear-button', async ({ page }) => {
15
- await page.goto(FIXTURE);
16
-
17
- const result = await page.evaluate(async (tableHtml) => {
18
- await import('/src/components/tf-clear-button.js');
19
-
20
- const table = document.createElement('table');
21
- table.id = 'ce-clear';
22
- table.innerHTML = tableHtml;
23
- document.body.appendChild(table);
24
-
25
- const tf = new TableFilter('ce-clear', {
26
- base_path: '/dist/tablefilter/',
27
- btn_reset: { text: 'Clear' }
28
- });
29
- tf.init();
30
-
31
- const clearButton = tf.feature('clearButton');
32
- const host = clearButton.container;
33
- const isCE = !!host && host.nodeName === 'TF-CLEAR-BUTTON';
34
-
35
- let hits = 0;
36
- tf.clearFilters = () => { hits++; };
37
- const button = host && host.shadowRoot
38
- ? host.shadowRoot.querySelector('button') : null;
39
- if (button) {
40
- button.click();
41
- }
42
-
43
- clearButton.destroy();
44
- return {
45
- isCE,
46
- hasButton: !!button,
47
- hits,
48
- removed: !host.isConnected
49
- };
50
- }, TABLE_HTML);
51
-
52
- expect(result.isCE).toBe(true);
53
- expect(result.hasButton).toBe(true);
54
- expect(result.hits).toBe(1);
55
- expect(result.removed).toBe(true);
56
- });
57
-
58
- test('icon markup stays on the legacy path when the element is loaded',
59
- async ({ page }) => {
60
- await page.goto(FIXTURE);
61
-
62
- const result = await page.evaluate(async (tableHtml) => {
63
- await import('/src/components/tf-clear-button.js');
64
-
65
- const table = document.createElement('table');
66
- table.id = 'ce-clear-icon';
67
- table.innerHTML = tableHtml;
68
- document.body.appendChild(table);
69
-
70
- // Icons on (the default): this.html is <input class="reset">,
71
- // the element the themes paint the eraser icon on. The element
72
- // renders a bare <button>, so this must stay on the legacy path.
73
- const tf = new TableFilter('ce-clear-icon', {
74
- base_path: '/dist/tablefilter/',
75
- btn_reset: true
76
- });
77
- tf.init();
78
-
79
- const clearButton = tf.feature('clearButton');
80
- const host = clearButton.container;
81
- const icon = host ? host.querySelector('input.reset') : null;
82
-
83
- clearButton.destroy();
84
- return {
85
- registered: Boolean(customElements.get('tf-clear-button')),
86
- tag: host ? host.nodeName : null,
87
- hasIcon: !!icon
88
- };
89
- }, TABLE_HTML);
90
-
91
- expect(result.registered).toBe(true);
92
- expect(result.tag).toBe('SPAN');
93
- expect(result.hasIcon).toBe(true);
94
- });
95
-
96
- test('status bar bridge uses tf-status', async ({ page }) => {
97
- await page.goto(FIXTURE);
98
-
99
- const result = await page.evaluate(async (tableHtml) => {
100
- await import('/src/components/tf-status.js');
101
-
102
- const table = document.createElement('table');
103
- table.id = 'ce-status';
104
- table.innerHTML = tableHtml;
105
- document.body.appendChild(table);
106
-
107
- const tf = new TableFilter('ce-status', {
108
- base_path: '/dist/tablefilter/',
109
- status_bar: true
110
- });
111
- tf.init();
112
-
113
- const statusBar = tf.feature('statusBar');
114
- const host = statusBar.container;
115
- const isCE = !!host && host.nodeName === 'TF-STATUS';
116
-
117
- statusBar.message('hello');
118
- // message() is applied on a timeout.
119
- await new Promise((resolve) => setTimeout(resolve, 30));
120
- const message = statusBar.msgContainer
121
- ? statusBar.msgContainer.innerHTML : null;
122
-
123
- statusBar.destroy();
124
- return { isCE, message, removed: !host.isConnected };
125
- }, TABLE_HTML);
126
-
127
- expect(result.isCE).toBe(true);
128
- expect(result.message).toBe('hello');
129
- expect(result.removed).toBe(true);
130
- });
131
-
132
- test('rows counter bridge uses tf-rows-counter', async ({ page }) => {
133
- await page.goto(FIXTURE);
134
-
135
- const result = await page.evaluate(async (tableHtml) => {
136
- await import('/src/components/tf-rows-counter.js');
137
-
138
- const table = document.createElement('table');
139
- table.id = 'ce-rows';
140
- table.innerHTML = tableHtml;
141
- document.body.appendChild(table);
142
-
143
- const tf = new TableFilter('ce-rows', {
144
- base_path: '/dist/tablefilter/',
145
- rows_counter: true
146
- });
147
- tf.init();
148
-
149
- const rowsCounter = tf.feature('rowsCounter');
150
- const host = rowsCounter.container;
151
- const isCE = !!host && host.nodeName === 'TF-ROWS-COUNTER';
152
-
153
- rowsCounter.refresh();
154
- const label = rowsCounter.label
155
- ? rowsCounter.label.innerHTML : null;
156
- const countPart = host.shadowRoot.querySelector('[part="count"]');
157
- const countText = countPart ? countPart.textContent : null;
158
-
159
- rowsCounter.destroy();
160
- return { isCE, label, countText, removed: !host.isConnected };
161
- }, TABLE_HTML);
162
-
163
- expect(result.isCE).toBe(true);
164
- expect(result.label).toBe('1');
165
- expect(result.countText).toBe('1');
166
- expect(result.removed).toBe(true);
167
- });
@@ -1,10 +0,0 @@
1
- // All-suites QUnit runner (#894): every test/*.html fixture runs
2
- // headlessly in Chromium and must report zero failures.
3
- const { test, expect } = require('@playwright/test');
4
- const { discoverSuites, runQUnitSuite } = require('./qunitSuite');
5
-
6
- for (const qunitFile of discoverSuites()) {
7
- test(`QUnit suite: ${qunitFile}`, async ({ page }) => {
8
- await runQUnitSuite(page, expect, qunitFile);
9
- });
10
- }
@@ -1,14 +0,0 @@
1
- // Single-file QUnit harness (#893): loads one existing QUnit HTML
2
- // suite in headless Chromium and asserts zero failures. Override
3
- // the suite with QUNIT_FILE, e.g.
4
- // QUNIT_FILE=test/test-dropdown.html npx playwright test
5
- // test/playwright/qunit.single.spec.js
6
- const { test, expect } = require('@playwright/test');
7
- const { runQUnitSuite } = require('./qunitSuite');
8
-
9
- const qunitFile =
10
- process.env.QUNIT_FILE || 'test/test-emitter.html';
11
-
12
- test(`QUnit single suite: ${qunitFile}`, async ({ page }) => {
13
- await runQUnitSuite(page, expect, qunitFile);
14
- });
@@ -1,56 +0,0 @@
1
- // Shared QUnit page driver: loads one existing QUnit HTML suite in a
2
- // Playwright page and asserts zero failures. Used by the single-suite
3
- // spec (#893) and the all-suites spec (#894).
4
- const { readdirSync } = require('fs');
5
- const { join } = require('path');
6
-
7
- // All QUnit fixtures live directly in test/*.html.
8
- function discoverSuites() {
9
- return readdirSync(join(__dirname, '..'))
10
- .filter((file) => file.endsWith('.html'))
11
- .sort()
12
- .map((file) => `test/${file}`);
13
- }
14
-
15
- async function runQUnitSuite(page, expect, qunitFile) {
16
- const errors = [];
17
- page.on('pageerror', (err) => errors.push(String(err)));
18
-
19
- await page.goto(`/${qunitFile}`);
20
-
21
- // QUnit 1.x renders the summary into #qunit-testresult once done.
22
- await page.waitForSelector('#qunit-testresult', {
23
- timeout: 15000
24
- });
25
- await page.waitForFunction(
26
- () => {
27
- const el =
28
- document.querySelector('#qunit-testresult');
29
- return el && /completed/i.test(el.textContent || '');
30
- },
31
- { timeout: 15000 }
32
- );
33
-
34
- const summary = await page.evaluate(() => {
35
- const el = document.querySelector('#qunit-testresult');
36
- const count = (cls) => {
37
- const node = el && el.querySelector(`.${cls}`);
38
- return node ? Number(node.textContent) : NaN;
39
- };
40
- const text = el ?
41
- el.textContent.trim().replace(/\s+/g, ' ') :
42
- '';
43
- return {
44
- text,
45
- total: count('total'),
46
- failed: count('failed')
47
- };
48
- });
49
-
50
- expect(errors, `page errors: ${errors.join('; ')}`).toEqual([]);
51
- expect(summary.failed, `QUnit summary: ${summary.text}`).toBe(0);
52
- expect(summary.total, `no tests ran in ${qunitFile}`)
53
- .toBeGreaterThan(0);
54
- }
55
-
56
- module.exports = { discoverSuites, runQUnitSuite };
@@ -1,265 +0,0 @@
1
- // Component gate (#901): declarative configuration — the `config`
2
- // JSON attribute merged with kebab-case attributes mapped onto the
3
- // engine's snake_case options, attributes winning over the blob,
4
- // valueless attributes enabling their flag, and HTML presentation
5
- // attributes staying out of the engine config. Fails CI on regression.
6
-
7
- const { test, expect } = require('@playwright/test');
8
-
9
- const FIXTURE = '/test/test-emitter.html';
10
- const COMPONENT = '/src/components/table-filter.js';
11
-
12
- const VALID_TABLE =
13
- '<table><tbody>' +
14
- '<tr><th>City</th></tr>' +
15
- '<tr><td>Sydney</td></tr>' +
16
- '<tr><td>Adelaide</td></tr>' +
17
- '</tbody></table>';
18
-
19
- // Mounts a <table-filter> with the given extra markup inside the
20
- // element tag, then reports selected engine state as primitives.
21
- async function mount(page, elementAttrs, body) {
22
- return page.evaluate(
23
- async ({ elementAttrs, component, table, body }) => {
24
- await import(component);
25
- const host = document.createElement('div');
26
- host.innerHTML =
27
- '<table-filter' + elementAttrs + '>' + table +
28
- '</table-filter>';
29
- document.body.appendChild(host);
30
- const el = host.querySelector('table-filter');
31
- const tf = el.tf;
32
- const result = {
33
- hasTf: Boolean(tf),
34
- initialized: Boolean(tf && tf.isInitialized()),
35
- watermark: tf && tf.watermark,
36
- caseSensitive: tf && tf.caseSensitive,
37
- onSlcChange: tf && tf.onSlcChange,
38
- paging: tf && tf.paging,
39
- colTypes: tf && tf.colTypes,
40
- hasConfig: tf && tf.hasConfig,
41
- modCount: tf ? Object.keys(tf.Mod).length : null,
42
- protoIsPlain: tf ?
43
- Object.getPrototypeOf(tf.cfg) === Object.prototype :
44
- null,
45
- cfgKeys: tf ? Object.keys(tf.cfg) : null,
46
- validRows: null,
47
- filterValue: null,
48
- basePath: tf && tf.basePath,
49
- themes: tf && tf.themes,
50
- fltCssClass: tf && tf.fltCssClass,
51
- fltsRowCssClass: tf && tf.fltsRowCssClass,
52
- fltMultiCssClass: tf && tf.fltMultiCssClass,
53
- fltSmallCssClass: tf && tf.fltSmallCssClass,
54
- singleFltCssClass: tf && tf.singleFltCssClass,
55
- btnCssClass: tf && tf.btnCssClass
56
- };
57
- if (body === 'filter-lowercase') {
58
- tf.setFilterValue(0, 'sydney');
59
- tf.filter();
60
- result.validRows = tf.getValidRowsNb();
61
- }
62
- if (body === 'filter-match') {
63
- tf.setFilterValue(0, 'Sydney');
64
- tf.filter();
65
- result.validRows = tf.getValidRowsNb();
66
- }
67
- return result;
68
- },
69
- {
70
- elementAttrs,
71
- component: COMPONENT,
72
- table: VALID_TABLE,
73
- body: body || null
74
- }
75
- );
76
- }
77
-
78
- test('attributes map onto engine options', async ({ page }) => {
79
- await page.goto(FIXTURE);
80
- const result = await mount(
81
- page,
82
- ' watermark="Search" case-sensitive="true" ' +
83
- 'col-types=\'["string"]\''
84
- );
85
- expect(result.watermark).toBe('Search');
86
- expect(result.caseSensitive).toBe(true);
87
- expect(result.colTypes).toEqual(['string']);
88
- expect(result.initialized).toBe(true);
89
- });
90
-
91
- test('config attribute maps a JSON object', async ({ page }) => {
92
- await page.goto(FIXTURE);
93
- const result = await mount(
94
- page,
95
- ' config=\'{"watermark":"Blob","on_change":false}\''
96
- );
97
- expect(result.watermark).toBe('Blob');
98
- expect(result.onSlcChange).toBe(false);
99
- });
100
-
101
- test('attributes win over the config attribute', async ({ page }) => {
102
- await page.goto(FIXTURE);
103
- const result = await mount(
104
- page,
105
- ' config=\'{"watermark":"Blob"}\' watermark="Explicit"'
106
- );
107
- expect(result.watermark).toBe('Explicit');
108
- });
109
-
110
- test('for and id are never mapped into the config', async ({ page }) => {
111
- await page.goto(FIXTURE);
112
- const result = await mount(page, ' for="demo" id="host-el"');
113
- expect(result.cfgKeys).not.toContain('for');
114
- expect(result.cfgKeys).not.toContain('id');
115
- });
116
-
117
- test('valueless attributes enable their flag (HTML convention)', async ({
118
- page
119
- }) => {
120
- await page.goto(FIXTURE);
121
- // <table-filter paging> is the roadmap's primary declarative usage:
122
- // presence must enable paging, not `Boolean('') === false`.
123
- const result = await mount(page, ' paging');
124
- expect(result.paging).toBe(true);
125
- expect(result.initialized).toBe(true);
126
- });
127
-
128
- test('presentation attributes are not engine config', async ({ page }) => {
129
- await page.goto(FIXTURE);
130
- const result = await mount(
131
- page,
132
- ' class="card" style="color:red" data-x="1" aria-label="grid" ' +
133
- 'role="region" title="Cities"'
134
- );
135
- // A stray class/style/data/aria attribute must not count as
136
- // configuration: it would flip hasConfig and cut constructed
137
- // features down to the config-path subset.
138
- expect(result.cfgKeys).toEqual([]);
139
- expect(result.hasConfig).toBe(false);
140
- expect(result.modCount).toBeGreaterThan(3);
141
- });
142
-
143
- test('boolean spellings the JSON parser rejects are coerced', async ({
144
- page
145
- }) => {
146
- await page.goto(FIXTURE);
147
- const result = await mount(
148
- page,
149
- ' case-sensitive="False" on-change="FALSE"'
150
- );
151
- // Without coercion these stay strings and Boolean('False') is true.
152
- expect(result.caseSensitive).toBe(false);
153
- expect(result.onSlcChange).toBe(false);
154
-
155
- const truthy = await mount(page, ' case-sensitive="True"');
156
- expect(truthy.caseSensitive).toBe(true);
157
- });
158
-
159
- test('prototype-reaching attribute names are ignored', async ({ page }) => {
160
- await page.goto(FIXTURE);
161
- const result = await mount(
162
- page,
163
- ' __proto__=\'{"paging":true}\' constructor="x" prototype="y"'
164
- );
165
- // Assigning config['__proto__'] would invoke the Object.prototype
166
- // setter and swap the config's prototype instead of setting paging.
167
- expect(result.protoIsPlain).toBe(true);
168
- expect(result.hasConfig).toBe(false);
169
- expect(result.paging).toBe(false);
170
- });
171
-
172
- test('no config keeps engine defaults and hasConfig false', async ({
173
- page
174
- }) => {
175
- await page.goto(FIXTURE);
176
- const result = await mount(page, '');
177
- // An empty {} reaching the constructor would flip hasConfig and
178
- // change feature instantiation; the mapping must omit it.
179
- expect(result.hasConfig).toBe(false);
180
- expect(result.watermark).toBe('');
181
- expect(result.initialized).toBe(true);
182
- });
183
-
184
- test('invalid config JSON warns and still inits on defaults', async ({
185
- page
186
- }) => {
187
- await page.goto(FIXTURE);
188
- const warnings = [];
189
- page.on('console', (msg) => {
190
- if (msg.type() === 'warning') {
191
- warnings.push(msg.text());
192
- }
193
- });
194
- const result = await mount(page, ' config="{not json"');
195
- expect(result.initialized).toBe(true);
196
- expect(result.watermark).toBe('');
197
- expect(warnings.join('\n')).toContain('<table-filter>');
198
- });
199
-
200
- // Styling configurability lives in the core engine, not only in the
201
- // features (#993): the loader keys (base_path, themes) and the core
202
- // filter class options must reach the engine through the declarative
203
- // surface. NOTE: the `style_path` / `stylesheet` / `themes_path`
204
- // overrides are currently ignored by the engine (#822), so asserting
205
- // them here would encode the bug; that is tracked separately.
206
- test('styling configuration reaches the engine', async ({ page }) => {
207
- // base_path drives the stylesheet/theme the engine loads on init, and
208
- // its loader throws from `file.onerror` when a file 404s. Serve the
209
- // fake path so this test asserts config mapping, not asset
210
- // availability (otherwise it emits unhandled load errors).
211
- await page.route('**/assets/tf/**', (route) =>
212
- route.fulfill({
213
- status: 200,
214
- contentType: 'text/css',
215
- body: ''
216
- }));
217
- await page.goto(FIXTURE);
218
- const result = await mount(
219
- page,
220
- ' base-path="/assets/tf/" flt-css-class="my-flt" ' +
221
- 'flts-row-css-class="my-fltrow" btn-css-class="my-btn" ' +
222
- 'single-filter=\'{"css_class":"my-single"}\' ' +
223
- 'config=\'{"themes":[{"name":"skyblue"}],' +
224
- '"flt_multi_css_class":"my-multi"}\''
225
- );
226
- expect(result.initialized).toBe(true);
227
- // Core stylesheet/theme loader key.
228
- expect(result.basePath).toBe('/assets/tf/');
229
- expect(result.themes).toContainEqual({ name: 'skyblue' });
230
- // Core filter class options.
231
- expect(result.fltsRowCssClass).toBe('my-fltrow');
232
- expect(result.fltCssClass).toBe('my-flt');
233
- expect(result.fltMultiCssClass).toBe('my-multi');
234
- expect(result.singleFltCssClass).toBe('my-single');
235
- expect(result.btnCssClass).toBe('my-btn');
236
- });
237
-
238
- test('core styling defaults are unchanged when unset', async ({ page }) => {
239
- await page.goto(FIXTURE);
240
- const result = await mount(page, '');
241
- expect(result.basePath).toBe('tablefilter/');
242
- expect(result.fltsRowCssClass).toBe('fltrow');
243
- expect(result.fltCssClass).toBe('flt');
244
- expect(result.fltMultiCssClass).toBe('flt_multi');
245
- expect(result.fltSmallCssClass).toBe('flt_s');
246
- expect(result.singleFltCssClass).toBe('single_flt');
247
- });
248
-
249
- test('mapped option drives filtering behaviour', async ({ page }) => {
250
- await page.goto(FIXTURE);
251
- const match = await mount(page, '', 'filter-match');
252
- expect(match.validRows).toBe(1);
253
-
254
- const caseSensitive = await mount(
255
- page,
256
- ' case-sensitive="true"',
257
- 'filter-lowercase'
258
- );
259
- // case_sensitive is on: lowercase 'sydney' must not match 'Sydney'
260
- expect(caseSensitive.validRows).toBe(0);
261
-
262
- const insensitive = await mount(page, '', 'filter-lowercase');
263
- // default is case-insensitive: 'sydney' matches
264
- expect(insensitive.validRows).toBe(1);
265
- });