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.
- package/dist/starter.html +2 -2
- package/dist/tablefilter/tablefilter.js +1 -1
- package/dist/tablefilter/tf-1-2aa33b10e0e549020c12.js +1 -0
- package/dist/tablefilter/tf-1-bc5a8b07e0d66035b05b.js +1 -0
- package/dist/tablefilter/{tf-2-3a936d22b849361acff5.js → tf-2-025e1e774794d5827df8.js} +2 -2
- package/dist/tablefilter.cjs.js +17614 -4
- package/dist/tablefilter.esm.js +15736 -5397
- package/dist/tablefilter.umd.js +17620 -4
- package/index.js +16 -1
- package/package.json +10 -1
- package/src/components/attributes.js +59 -0
- package/src/components/table-filter.js +193 -45
- package/src/components/tf-rows-counter.js +3 -6
- package/src/components/tf-status.js +6 -11
- package/src/extensions/sort/sort.js +8 -1
- package/src/tablefilter.js +39 -6
- package/.editorconfig +0 -15
- package/.esdoc.json +0 -14
- package/.eslintrc +0 -37
- package/.gitattributes +0 -16
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -36
- package/.github/ISSUE_TEMPLATE/support.md +0 -17
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/build-deploy.yml +0 -141
- package/.github/workflows/opencode-review.yml +0 -104
- package/.github/workflows/opencode.yml +0 -34
- package/AGENTS.md +0 -36
- package/CONTRIBUTING.md +0 -128
- package/Gruntfile.js +0 -252
- package/PULL_REQUEST_TEMPLATE.md +0 -24
- package/ROADMAP/README.md +0 -34
- package/ROADMAP/content-projection-parity.md +0 -162
- package/ROADMAP/hybrid-migration-strategy.md +0 -275
- package/ROADMAP/key-decisions-review.md +0 -215
- package/ROADMAP/preliminary-and-milestone-0.8.0-plan.md +0 -307
- package/ROADMAP/v1-webcomponents-investigation.md +0 -521
- package/dist/tablefilter/tablefilter.vite.js +0 -4
- package/dist/tablefilter/tf-1-a5c3a73bd559e47dd5a2.js +0 -1
- package/playwright.config.js +0 -25
- package/scripts/check-css-tokens.js +0 -65
- package/static/demos-assets/img_best-price.png +0 -0
- package/static/demos-assets/img_great-deal.png +0 -0
- package/static/demos-assets/img_maintenance.jpg +0 -0
- package/static/demos-assets/img_new-edition.png +0 -0
- package/static/demos-assets/img_sold-out.png +0 -0
- package/static/partials/books-table-with-images.html +0 -328
- package/static/partials/books.html +0 -273
- package/static/partials/countries-by-continent.html +0 -2592
- package/static/partials/countries-table-tiny.html +0 -436
- package/static/partials/countries-table.html +0 -12954
- package/static/partials/dummy-table-with-totals-footer.html +0 -353
- package/static/partials/dummy-table.html +0 -503
- package/static/partials/pre-inline-script.html +0 -17
- package/static/partials/pre.html +0 -1
- package/static/partials/style.html +0 -23
- package/static/partials/table-with-grouped-headers.html +0 -9258
- package/static/partials/tablefilter-script.html +0 -1
- package/static/style/active-header.styl +0 -10
- package/static/style/alternating-rows.styl +0 -8
- package/static/style/config.styl +0 -44
- package/static/style/custom-properties.styl +0 -43
- package/static/style/extensions/colsVisibility.styl +0 -71
- package/static/style/extensions/filtersVisibility.styl +0 -18
- package/static/style/ezedittable.styl +0 -93
- package/static/style/filter-checklist.styl +0 -52
- package/static/style/filters.styl +0 -111
- package/static/style/grid-layout.styl +0 -130
- package/static/style/help.styl +0 -57
- package/static/style/keyword.styl +0 -8
- package/static/style/loader.styl +0 -16
- package/static/style/mixins/arrow.styl +0 -63
- package/static/style/mixins/box-shadow.styl +0 -8
- package/static/style/mixins/empty-content.styl +0 -7
- package/static/style/noresults.styl +0 -14
- package/static/style/paging.styl +0 -73
- package/static/style/reset-button.styl +0 -21
- package/static/style/rows-counter.styl +0 -17
- package/static/style/sort.styl +0 -20
- package/static/style/status-bar.styl +0 -13
- package/static/style/table.styl +0 -44
- package/static/style/tablefilter.styl +0 -19
- package/static/style/themes/blank.png +0 -0
- package/static/style/themes/btn_clear_filters.png +0 -0
- package/static/style/themes/btn_filter.png +0 -0
- package/static/style/themes/btn_first_page.gif +0 -0
- package/static/style/themes/btn_last_page.gif +0 -0
- package/static/style/themes/btn_next_page.gif +0 -0
- package/static/style/themes/btn_previous_page.gif +0 -0
- package/static/style/themes/default/default.styl +0 -137
- package/static/style/themes/default/images/bg_infDiv.jpg +0 -0
- package/static/style/themes/default/images/bg_th.jpg +0 -0
- package/static/style/themes/default/images/btn_eraser.gif +0 -0
- package/static/style/themes/default/images/btn_first_page.gif +0 -0
- package/static/style/themes/default/images/btn_last_page.gif +0 -0
- package/static/style/themes/default/images/btn_next_page.gif +0 -0
- package/static/style/themes/default/images/btn_over_eraser.gif +0 -0
- package/static/style/themes/default/images/btn_over_first_page.gif +0 -0
- package/static/style/themes/default/images/btn_over_last_page.gif +0 -0
- package/static/style/themes/default/images/btn_over_next_page.gif +0 -0
- package/static/style/themes/default/images/btn_over_previous_page.gif +0 -0
- package/static/style/themes/default/images/btn_previous_page.gif +0 -0
- package/static/style/themes/default/images/img_loading.gif +0 -0
- package/static/style/themes/downsimple.png +0 -0
- package/static/style/themes/icn_clp.png +0 -0
- package/static/style/themes/icn_exp.png +0 -0
- package/static/style/themes/icn_filter.gif +0 -0
- package/static/style/themes/icn_filterActive.gif +0 -0
- package/static/style/themes/mytheme/images/bg_headers.jpg +0 -0
- package/static/style/themes/mytheme/images/bg_infDiv.jpg +0 -0
- package/static/style/themes/mytheme/images/btn_filter.png +0 -0
- package/static/style/themes/mytheme/images/btn_first_page.gif +0 -0
- package/static/style/themes/mytheme/images/btn_last_page.gif +0 -0
- package/static/style/themes/mytheme/images/btn_next_page.gif +0 -0
- package/static/style/themes/mytheme/images/btn_previous_page.gif +0 -0
- package/static/style/themes/mytheme/images/img_loading.gif +0 -0
- package/static/style/themes/mytheme/mytheme.styl +0 -152
- package/static/style/themes/skyblue/images/bg_skyblue.gif +0 -0
- package/static/style/themes/skyblue/images/btn_first_page.gif +0 -0
- package/static/style/themes/skyblue/images/btn_last_page.gif +0 -0
- package/static/style/themes/skyblue/images/btn_next_page.gif +0 -0
- package/static/style/themes/skyblue/images/btn_prev_page.gif +0 -0
- package/static/style/themes/skyblue/images/icn_clear_filters.png +0 -0
- package/static/style/themes/skyblue/images/img_loading.gif +0 -0
- package/static/style/themes/skyblue/skyblue.styl +0 -195
- package/static/style/themes/transparent/images/btn_first_page.gif +0 -0
- package/static/style/themes/transparent/images/btn_last_page.gif +0 -0
- package/static/style/themes/transparent/images/btn_next_page.gif +0 -0
- package/static/style/themes/transparent/images/btn_prev_page.gif +0 -0
- package/static/style/themes/transparent/images/icn_clear_filters.png +0 -0
- package/static/style/themes/transparent/images/img_loading.gif +0 -0
- package/static/style/themes/transparent/transparent.styl +0 -205
- package/static/style/themes/upsimple.png +0 -0
- package/static/style/toolbar.styl +0 -58
- package/static/templates/advanced-grid-editable.html +0 -140
- package/static/templates/advanced-grid-selection.html +0 -93
- package/static/templates/auto-filter.html +0 -46
- package/static/templates/columns-visibility.html +0 -67
- package/static/templates/data-types.html +0 -123
- package/static/templates/demo.html +0 -62
- package/static/templates/external-filters-visibility-commad.html +0 -49
- package/static/templates/external-filters.html +0 -125
- package/static/templates/filter-images.html +0 -91
- package/static/templates/filters-visibility.html +0 -45
- package/static/templates/grid-layout.html +0 -51
- package/static/templates/grouped-headers.html +0 -78
- package/static/templates/linked-filters-disabled.html +0 -56
- package/static/templates/linked-filters.html +0 -45
- package/static/templates/load-filters-on-demand.html +0 -42
- package/static/templates/pagination.html +0 -78
- package/static/templates/requirejs.html +0 -53
- package/static/templates/starter.html +0 -61
- package/static/templates/table-filter.html +0 -40
- package/static/templates/theme-roller.html +0 -106
- package/test/libs/polyfill.js +0 -359
- package/test/libs/qunit/qunit.css +0 -237
- package/test/libs/qunit/qunit.js +0 -2495
- package/test/playwright/axe.baseline.spec.js +0 -34
- package/test/playwright/axe.statusbar.spec.js +0 -35
- package/test/playwright/axeScan.js +0 -42
- package/test/playwright/ce-bridge.spec.js +0 -167
- package/test/playwright/qunit.all.spec.js +0 -10
- package/test/playwright/qunit.single.spec.js +0 -14
- package/test/playwright/qunitSuite.js +0 -56
- package/test/playwright/table-filter.config.spec.js +0 -265
- package/test/playwright/table-filter.demo.spec.js +0 -60
- package/test/playwright/table-filter.element.spec.js +0 -477
- package/test/playwright/tf-clear-button.spec.js +0 -135
- package/test/playwright/tf-rows-counter.spec.js +0 -172
- package/test/playwright/tf-status.spec.js +0 -258
- package/test/test-active-columns.html +0 -80
- package/test/test-active-columns.js +0 -318
- package/test/test-alternate-rows.html +0 -80
- package/test/test-alternate-rows.js +0 -335
- package/test/test-api.html +0 -141
- package/test/test-api.js +0 -795
- package/test/test-auto-filter.html +0 -80
- package/test/test-auto-filter.js +0 -43
- package/test/test-callbacks.html +0 -78
- package/test/test-callbacks.js +0 -58
- package/test/test-case-sensitive-query.html +0 -78
- package/test/test-case-sensitive-query.js +0 -39
- package/test/test-cell-parser.html +0 -109
- package/test/test-cell-parser.js +0 -80
- package/test/test-checklist.html +0 -78
- package/test/test-checklist.js +0 -267
- package/test/test-clear-button.html +0 -79
- package/test/test-clear-button.js +0 -183
- package/test/test-col-ops-grid-layout.html +0 -129
- package/test/test-col-ops-grid-layout.js +0 -134
- package/test/test-col-ops-paging.html +0 -129
- package/test/test-col-ops-paging.js +0 -154
- package/test/test-col-ops.html +0 -129
- package/test/test-col-ops.js +0 -337
- package/test/test-col-widths.html +0 -80
- package/test/test-col-widths.js +0 -40
- package/test/test-cols-visibility-grid-layout.html +0 -80
- package/test/test-cols-visibility-grid-layout.js +0 -165
- package/test/test-cols-visibility.html +0 -80
- package/test/test-cols-visibility.js +0 -121
- package/test/test-custom-options.html +0 -80
- package/test/test-custom-options.js +0 -139
- package/test/test-data-types.html +0 -377
- package/test/test-data-types.js +0 -392
- package/test/test-date-type.html +0 -356
- package/test/test-date-type.js +0 -159
- package/test/test-disable-enter-key.html +0 -78
- package/test/test-disable-enter-key.js +0 -29
- package/test/test-disable-filter-onchange.html +0 -78
- package/test/test-disable-filter-onchange.js +0 -40
- package/test/test-dom-changes.html +0 -78
- package/test/test-dom-changes.js +0 -166
- package/test/test-dropdown.html +0 -78
- package/test/test-dropdown.js +0 -246
- package/test/test-emitter.html +0 -78
- package/test/test-emitter.js +0 -57
- package/test/test-empty-cells-filtering.html +0 -8696
- package/test/test-empty-cells-filtering.js +0 -45
- package/test/test-exact-query-match.html +0 -78
- package/test/test-exact-query-match.js +0 -56
- package/test/test-excluded-rows.html +0 -92
- package/test/test-excluded-rows.js +0 -129
- package/test/test-external-filters.html +0 -100
- package/test/test-external-filters.js +0 -219
- package/test/test-filter-html-elements.html +0 -88
- package/test/test-filter-html-elements.js +0 -63
- package/test/test-filter-operators.html +0 -80
- package/test/test-filter-operators.js +0 -264
- package/test/test-filtering.html +0 -53
- package/test/test-filtering.js +0 -293
- package/test/test-filters-visibility-grid-layout.html +0 -80
- package/test/test-filters-visibility-grid-layout.js +0 -50
- package/test/test-filters-visibility-with-button.html +0 -80
- package/test/test-filters-visibility-with-button.js +0 -48
- package/test/test-filters-visibility.html +0 -80
- package/test/test-filters-visibility.js +0 -48
- package/test/test-grid-layout.html +0 -7736
- package/test/test-grid-layout.js +0 -39
- package/test/test-grouped-headers.html +0 -154
- package/test/test-grouped-headers.js +0 -107
- package/test/test-hash.html +0 -78
- package/test/test-hash.js +0 -88
- package/test/test-help-responsive.html +0 -79
- package/test/test-help-responsive.js +0 -70
- package/test/test-help.html +0 -78
- package/test/test-help.js +0 -217
- package/test/test-highlight-keywords.html +0 -78
- package/test/test-highlight-keywords.js +0 -94
- package/test/test-ignore-diacritics.html +0 -67
- package/test/test-ignore-diacritics.js +0 -117
- package/test/test-integration-paging-sort.html +0 -80
- package/test/test-integration-paging-sort.js +0 -60
- package/test/test-linked-filters-disabled-options-grid-layout.html +0 -80
- package/test/test-linked-filters-disabled-options-grid-layout.js +0 -73
- package/test/test-linked-filters-grid-layout.html +0 -80
- package/test/test-linked-filters-grid-layout.js +0 -72
- package/test/test-linked-filters-load-filters-on-demand.html +0 -80
- package/test/test-linked-filters-load-filters-on-demand.js +0 -99
- package/test/test-linked-filters-paging.html +0 -80
- package/test/test-linked-filters-paging.js +0 -99
- package/test/test-linked-filters.html +0 -80
- package/test/test-linked-filters.js +0 -138
- package/test/test-load-filters-on-demand.html +0 -78
- package/test/test-load-filters-on-demand.js +0 -124
- package/test/test-loader.html +0 -79
- package/test/test-loader.js +0 -159
- package/test/test-no-config.html +0 -80
- package/test/test-no-config.js +0 -63
- package/test/test-no-filters.html +0 -80
- package/test/test-no-filters.js +0 -172
- package/test/test-no-headers.html +0 -71
- package/test/test-no-headers.js +0 -99
- package/test/test-no-results-message.html +0 -262
- package/test/test-no-results-message.js +0 -222
- package/test/test-no-rows.html +0 -19
- package/test/test-no-rows.js +0 -10
- package/test/test-one-row.html +0 -29
- package/test/test-one-row.js +0 -18
- package/test/test-paging.html +0 -78
- package/test/test-paging.js +0 -273
- package/test/test-popup-filter-one-row.html +0 -38
- package/test/test-popup-filter-one-row.js +0 -138
- package/test/test-popup-filter.html +0 -78
- package/test/test-popup-filter.js +0 -384
- package/test/test-popup-filters-grouped-headers.html +0 -104
- package/test/test-popup-filters-grouped-headers.js +0 -206
- package/test/test-rows-counter.html +0 -78
- package/test/test-rows-counter.js +0 -114
- package/test/test-single-filter.html +0 -79
- package/test/test-single-filter.js +0 -138
- package/test/test-sort-custom-sorter.html +0 -244
- package/test/test-sort-custom-sorter.js +0 -74
- package/test/test-sort-grid-layout.html +0 -143
- package/test/test-sort-grid-layout.js +0 -86
- package/test/test-sort-key.html +0 -244
- package/test/test-sort-key.js +0 -67
- package/test/test-sort.html +0 -143
- package/test/test-sort.js +0 -126
- package/test/test-state.html +0 -78
- package/test/test-state.js +0 -369
- package/test/test-status-bar.html +0 -79
- package/test/test-status-bar.js +0 -149
- package/test/test-storage-cookie.html +0 -78
- package/test/test-storage-cookie.js +0 -82
- package/test/test-storage-local.html +0 -78
- package/test/test-storage-local.js +0 -82
- package/test/test-tfoot.html +0 -96
- package/test/test-tfoot.js +0 -123
- package/test/test-thead.html +0 -80
- package/test/test-thead.js +0 -69
- package/test/test-toolbar.html +0 -81
- package/test/test-toolbar.js +0 -218
- package/test/test-uneven-rows.html +0 -95
- package/test/test-uneven-rows.js +0 -61
- package/test/test-watermark.html +0 -80
- package/test/test-watermark.js +0 -103
- package/test/test.html +0 -141
- package/test/test.js +0 -162
- package/vite.config.js +0 -71
- package/webpack.config.js +0 -99
- package/webpack.dev.config.js +0 -25
- package/webpack.test.config.js +0 -44
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
// Component gate (#909): the <tf-rows-counter> element registers an
|
|
2
|
-
// open shadow root exposing the `label`/`count` parts and renders the
|
|
3
|
-
// `text`/`count` attributes statically. Per the theming model
|
|
4
|
-
// (--tf-* custom properties + ::part()), it ships structure and hooks
|
|
5
|
-
// only: no invented classes and no baked-in presentational CSS. The
|
|
6
|
-
// RowsCounter bridge (#910) is a separate ticket. Fails CI on regression.
|
|
7
|
-
const { test, expect } = require('@playwright/test');
|
|
8
|
-
|
|
9
|
-
const FIXTURE = '/test/test-emitter.html';
|
|
10
|
-
const COMPONENT = '/src/components/tf-rows-counter.js';
|
|
11
|
-
|
|
12
|
-
test('registers an open shadow root exposing the label/count parts',
|
|
13
|
-
async ({ page }) => {
|
|
14
|
-
await page.goto(FIXTURE);
|
|
15
|
-
|
|
16
|
-
const result = await page.evaluate(async (component) => {
|
|
17
|
-
await import(component);
|
|
18
|
-
const defined = Boolean(customElements.get('tf-rows-counter'));
|
|
19
|
-
const el = document.createElement('tf-rows-counter');
|
|
20
|
-
document.body.appendChild(el);
|
|
21
|
-
const sr = el.shadowRoot;
|
|
22
|
-
const nodes = sr ? Array.from(sr.querySelectorAll('*')) : [];
|
|
23
|
-
return {
|
|
24
|
-
defined,
|
|
25
|
-
hasShadow: Boolean(sr),
|
|
26
|
-
mode: sr && sr.mode,
|
|
27
|
-
parts: sr ? Array.from(sr.querySelectorAll('[part]'))
|
|
28
|
-
.map((n) => n.getAttribute('part')) : [],
|
|
29
|
-
leakedToLightDom: el.querySelector('[part=label]') !== null,
|
|
30
|
-
classless: nodes.every((n) => !n.hasAttribute('class')),
|
|
31
|
-
styleless: nodes.every((n) => n.tagName !== 'STYLE')
|
|
32
|
-
};
|
|
33
|
-
}, COMPONENT);
|
|
34
|
-
|
|
35
|
-
expect(result.defined).toBe(true);
|
|
36
|
-
expect(result.hasShadow).toBe(true);
|
|
37
|
-
expect(result.mode).toBe('open');
|
|
38
|
-
expect(result.parts).toEqual(['label', 'count']);
|
|
39
|
-
expect(result.leakedToLightDom).toBe(false);
|
|
40
|
-
expect(result.classless).toBe(true);
|
|
41
|
-
expect(result.styleless).toBe(true);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('renders the text and count attributes into the shadow parts',
|
|
45
|
-
async ({ page }) => {
|
|
46
|
-
await page.goto(FIXTURE);
|
|
47
|
-
|
|
48
|
-
const result = await page.evaluate(async (component) => {
|
|
49
|
-
await import(component);
|
|
50
|
-
const el = document.createElement('tf-rows-counter');
|
|
51
|
-
el.setAttribute('text', 'Rows:');
|
|
52
|
-
el.setAttribute('count', '7');
|
|
53
|
-
document.body.appendChild(el);
|
|
54
|
-
|
|
55
|
-
const sr = el.shadowRoot;
|
|
56
|
-
const read = () => ({
|
|
57
|
-
label: sr.querySelector('[part=label]').textContent,
|
|
58
|
-
count: sr.querySelector('[part=count]').textContent
|
|
59
|
-
});
|
|
60
|
-
const initial = read();
|
|
61
|
-
|
|
62
|
-
el.setAttribute('count', '4');
|
|
63
|
-
const updated = read();
|
|
64
|
-
|
|
65
|
-
el.removeAttribute('text');
|
|
66
|
-
const cleared = read();
|
|
67
|
-
|
|
68
|
-
return { initial, updated, cleared };
|
|
69
|
-
}, COMPONENT);
|
|
70
|
-
|
|
71
|
-
expect(result.initial).toEqual({ label: 'Rows:', count: '7' });
|
|
72
|
-
expect(result.updated).toEqual({ label: 'Rows:', count: '4' });
|
|
73
|
-
expect(result.cleared).toEqual({ label: '', count: '4' });
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('setCount() sets and clears the rendered count', async ({ page }) => {
|
|
77
|
-
await page.goto(FIXTURE);
|
|
78
|
-
|
|
79
|
-
const result = await page.evaluate(async (component) => {
|
|
80
|
-
await import(component);
|
|
81
|
-
const el = document.createElement('tf-rows-counter');
|
|
82
|
-
document.body.appendChild(el);
|
|
83
|
-
const count = () =>
|
|
84
|
-
el.shadowRoot.querySelector('[part=count]').textContent;
|
|
85
|
-
|
|
86
|
-
el.setCount('Filtering...');
|
|
87
|
-
const set = count();
|
|
88
|
-
el.setCount('');
|
|
89
|
-
const empty = count();
|
|
90
|
-
el.setCount();
|
|
91
|
-
const missing = count();
|
|
92
|
-
el.setCount(0);
|
|
93
|
-
const zero = count();
|
|
94
|
-
|
|
95
|
-
return { set, empty, missing, zero };
|
|
96
|
-
}, COMPONENT);
|
|
97
|
-
|
|
98
|
-
expect(result.set).toBe('Filtering...');
|
|
99
|
-
expect(result.empty).toBe('');
|
|
100
|
-
expect(result.missing).toBe('');
|
|
101
|
-
expect(result.zero).toBe('0');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('exposes ::part() styling hooks for theming', async ({ page }) => {
|
|
105
|
-
await page.goto(FIXTURE);
|
|
106
|
-
|
|
107
|
-
const result = await page.evaluate(async (component) => {
|
|
108
|
-
await import(component);
|
|
109
|
-
const el = document.createElement('tf-rows-counter');
|
|
110
|
-
el.setAttribute('text', 'x');
|
|
111
|
-
el.setAttribute('count', 'y');
|
|
112
|
-
document.body.appendChild(el);
|
|
113
|
-
|
|
114
|
-
const style = document.createElement('style');
|
|
115
|
-
style.textContent = `
|
|
116
|
-
tf-rows-counter::part(label) { color: rgb(1, 2, 3); }
|
|
117
|
-
tf-rows-counter::part(count) { color: rgb(9, 8, 7); }
|
|
118
|
-
`;
|
|
119
|
-
document.head.appendChild(style);
|
|
120
|
-
|
|
121
|
-
const label = el.shadowRoot.querySelector('[part=label]');
|
|
122
|
-
const cnt = el.shadowRoot.querySelector('[part=count]');
|
|
123
|
-
return {
|
|
124
|
-
label: getComputedStyle(label).color,
|
|
125
|
-
count: getComputedStyle(cnt).color
|
|
126
|
-
};
|
|
127
|
-
}, COMPONENT);
|
|
128
|
-
|
|
129
|
-
expect(result.label).toBe('rgb(1, 2, 3)');
|
|
130
|
-
expect(result.count).toBe('rgb(9, 8, 7)');
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// Live region: the counter announces count changes (ROADMAP: live region).
|
|
134
|
-
test('connects as a polite ARIA status live region', async ({ page }) => {
|
|
135
|
-
await page.goto(FIXTURE);
|
|
136
|
-
|
|
137
|
-
const result = await page.evaluate(async (component) => {
|
|
138
|
-
await import(component);
|
|
139
|
-
const el = document.createElement('tf-rows-counter');
|
|
140
|
-
el.setAttribute('aria-live', 'off');
|
|
141
|
-
document.body.appendChild(el);
|
|
142
|
-
return {
|
|
143
|
-
role: el.getAttribute('role'),
|
|
144
|
-
live: el.getAttribute('aria-live'),
|
|
145
|
-
atomic: el.getAttribute('aria-atomic'),
|
|
146
|
-
nestedAria: el.shadowRoot.querySelectorAll(
|
|
147
|
-
'[role], [aria-live], [aria-atomic]'
|
|
148
|
-
).length
|
|
149
|
-
};
|
|
150
|
-
}, COMPONENT);
|
|
151
|
-
|
|
152
|
-
expect(result.role).toBe('status');
|
|
153
|
-
expect(result.live).toBe('polite');
|
|
154
|
-
expect(result.atomic).toBe('true');
|
|
155
|
-
expect(result.nestedAria).toBe(0);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test('is exposed to assistive tech as one status region', async ({ page }) => {
|
|
159
|
-
await page.goto(FIXTURE);
|
|
160
|
-
|
|
161
|
-
await page.evaluate(async (component) => {
|
|
162
|
-
await import(component);
|
|
163
|
-
const el = document.createElement('tf-rows-counter');
|
|
164
|
-
el.setAttribute('text', 'Rows:');
|
|
165
|
-
el.setAttribute('count', '42');
|
|
166
|
-
document.body.appendChild(el);
|
|
167
|
-
}, COMPONENT);
|
|
168
|
-
|
|
169
|
-
await expect(page.locator('tf-rows-counter')).toHaveRole('status');
|
|
170
|
-
const statusRegions = page.getByRole('status');
|
|
171
|
-
await expect(statusRegions).toHaveCount(1);
|
|
172
|
-
});
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
// Component gates (#905 scaffold, #906 live region): the <tf-status>
|
|
2
|
-
// element registers an open shadow root exposing the `label`/`message`
|
|
3
|
-
// parts and renders the `text`/`message` attributes statically, and its
|
|
4
|
-
// host connects as a polite ARIA status region. Per the theming model
|
|
5
|
-
// (--tf-* custom properties + ::part()), it ships structure and hooks
|
|
6
|
-
// only: no invented classes and no baked-in presentational CSS. The
|
|
7
|
-
// StatusBar bridge (#907) is a separate ticket. Fails CI on regression.
|
|
8
|
-
const { test, expect } = require('@playwright/test');
|
|
9
|
-
|
|
10
|
-
const FIXTURE = '/test/test-emitter.html';
|
|
11
|
-
const COMPONENT = '/src/components/tf-status.js';
|
|
12
|
-
|
|
13
|
-
test('registers an open shadow root exposing the label/message parts',
|
|
14
|
-
async ({ page }) => {
|
|
15
|
-
await page.goto(FIXTURE);
|
|
16
|
-
|
|
17
|
-
const result = await page.evaluate(async (component) => {
|
|
18
|
-
await import(component);
|
|
19
|
-
const defined = Boolean(customElements.get('tf-status'));
|
|
20
|
-
const el = document.createElement('tf-status');
|
|
21
|
-
document.body.appendChild(el);
|
|
22
|
-
const sr = el.shadowRoot;
|
|
23
|
-
const nodes = sr ? Array.from(sr.querySelectorAll('*')) : [];
|
|
24
|
-
return {
|
|
25
|
-
defined,
|
|
26
|
-
hasShadow: Boolean(sr),
|
|
27
|
-
mode: sr && sr.mode,
|
|
28
|
-
parts: sr ? Array.from(sr.querySelectorAll('[part]'))
|
|
29
|
-
.map((n) => n.getAttribute('part')) : [],
|
|
30
|
-
leakedToLightDom: el.querySelector('[part=label]') !== null,
|
|
31
|
-
classless: nodes.every((n) => !n.hasAttribute('class')),
|
|
32
|
-
styleless: nodes.every((n) => n.tagName !== 'STYLE')
|
|
33
|
-
};
|
|
34
|
-
}, COMPONENT);
|
|
35
|
-
|
|
36
|
-
expect(result.defined).toBe(true);
|
|
37
|
-
expect(result.hasShadow).toBe(true);
|
|
38
|
-
expect(result.mode).toBe('open');
|
|
39
|
-
expect(result.parts).toEqual(['label', 'message']);
|
|
40
|
-
expect(result.leakedToLightDom).toBe(false);
|
|
41
|
-
// The component ships no classes and no presentational styles;
|
|
42
|
-
// themes style the parts via --tf-* tokens and ::part().
|
|
43
|
-
expect(result.classless).toBe(true);
|
|
44
|
-
expect(result.styleless).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('renders the text and message attributes into the shadow parts',
|
|
48
|
-
async ({ page }) => {
|
|
49
|
-
await page.goto(FIXTURE);
|
|
50
|
-
|
|
51
|
-
const result = await page.evaluate(async (component) => {
|
|
52
|
-
await import(component);
|
|
53
|
-
const el = document.createElement('tf-status');
|
|
54
|
-
el.setAttribute('text', 'Rows:');
|
|
55
|
-
el.setAttribute('message', '1 176');
|
|
56
|
-
document.body.appendChild(el);
|
|
57
|
-
|
|
58
|
-
const sr = el.shadowRoot;
|
|
59
|
-
const read = () => ({
|
|
60
|
-
label: sr.querySelector('[part=label]').textContent,
|
|
61
|
-
message: sr.querySelector('[part=message]').textContent
|
|
62
|
-
});
|
|
63
|
-
const initial = read();
|
|
64
|
-
|
|
65
|
-
el.setAttribute('message', '42');
|
|
66
|
-
const updated = read();
|
|
67
|
-
|
|
68
|
-
el.removeAttribute('text');
|
|
69
|
-
const cleared = read();
|
|
70
|
-
|
|
71
|
-
return { initial, updated, cleared };
|
|
72
|
-
}, COMPONENT);
|
|
73
|
-
|
|
74
|
-
expect(result.initial).toEqual({ label: 'Rows:', message: '1 176' });
|
|
75
|
-
expect(result.updated).toEqual({ label: 'Rows:', message: '42' });
|
|
76
|
-
expect(result.cleared).toEqual({ label: '', message: '42' });
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('setMessage() sets and clears the rendered message',
|
|
80
|
-
async ({ page }) => {
|
|
81
|
-
await page.goto(FIXTURE);
|
|
82
|
-
|
|
83
|
-
const result = await page.evaluate(async (component) => {
|
|
84
|
-
await import(component);
|
|
85
|
-
const el = document.createElement('tf-status');
|
|
86
|
-
document.body.appendChild(el);
|
|
87
|
-
const msg = () =>
|
|
88
|
-
el.shadowRoot.querySelector('[part=message]').textContent;
|
|
89
|
-
|
|
90
|
-
el.setMessage('Filtering...');
|
|
91
|
-
const set = msg();
|
|
92
|
-
el.setMessage('');
|
|
93
|
-
const empty = msg();
|
|
94
|
-
el.setMessage();
|
|
95
|
-
const missing = msg();
|
|
96
|
-
// A falsy non-string must render, not be dropped.
|
|
97
|
-
el.setMessage(0);
|
|
98
|
-
const zero = msg();
|
|
99
|
-
|
|
100
|
-
return { set, empty, missing, zero };
|
|
101
|
-
}, COMPONENT);
|
|
102
|
-
|
|
103
|
-
expect(result.set).toBe('Filtering...');
|
|
104
|
-
expect(result.empty).toBe('');
|
|
105
|
-
expect(result.missing).toBe('');
|
|
106
|
-
expect(result.zero).toBe('0');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// #1012: legacy StatusBar injected messages with innerHTML
|
|
110
|
-
// (`msgContainer.innerHTML = t`), so configured messages may contain
|
|
111
|
-
// markup. The message part must render it as HTML; the `text` label
|
|
112
|
-
// stays text (legacy used a text node for `text`). Exercises the real
|
|
113
|
-
// consumer entry point, `setMessage()`, not just the attribute.
|
|
114
|
-
test('renders setMessage() as HTML, but text as plain text',
|
|
115
|
-
async ({ page }) => {
|
|
116
|
-
await page.goto(FIXTURE);
|
|
117
|
-
|
|
118
|
-
const result = await page.evaluate(async (component) => {
|
|
119
|
-
await import(component);
|
|
120
|
-
const el = document.createElement('tf-status');
|
|
121
|
-
el.setAttribute('text', '<i>Rows:</i>');
|
|
122
|
-
el.setMessage('Filtering <b>data</b> & more');
|
|
123
|
-
document.body.appendChild(el);
|
|
124
|
-
|
|
125
|
-
const sr = el.shadowRoot;
|
|
126
|
-
const label = sr.querySelector('[part=label]');
|
|
127
|
-
const msg = sr.querySelector('[part=message]');
|
|
128
|
-
return {
|
|
129
|
-
labelHasMarkup: label.querySelector('i') !== null,
|
|
130
|
-
labelText: label.textContent,
|
|
131
|
-
messageBold: msg.querySelector('b') &&
|
|
132
|
-
msg.querySelector('b').textContent,
|
|
133
|
-
messageText: msg.textContent
|
|
134
|
-
};
|
|
135
|
-
}, COMPONENT);
|
|
136
|
-
|
|
137
|
-
// label: markup escaped, rendered as text.
|
|
138
|
-
expect(result.labelHasMarkup).toBe(false);
|
|
139
|
-
expect(result.labelText).toBe('<i>Rows:</i>');
|
|
140
|
-
// message: markup parsed, entities decoded.
|
|
141
|
-
expect(result.messageBold).toBe('data');
|
|
142
|
-
expect(result.messageText).toBe('Filtering data & more');
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// #1014 review: `message` is injected as HTML, so the config-derived
|
|
146
|
-
// markup is sanitised (DOMPurify) at the boundary. Ordinary markup
|
|
147
|
-
// survives; scripts, event handlers and javascript: URLs do not.
|
|
148
|
-
test('sanitises injected message HTML', async ({ page }) => {
|
|
149
|
-
await page.goto(FIXTURE);
|
|
150
|
-
|
|
151
|
-
const result = await page.evaluate(async (component) => {
|
|
152
|
-
await import(component);
|
|
153
|
-
const el = document.createElement('tf-status');
|
|
154
|
-
el.setMessage(
|
|
155
|
-
'<b>safe</b>' +
|
|
156
|
-
'<img src=x onerror="window.__xss=1">' +
|
|
157
|
-
'<script>window.__xss=2<\/script>' +
|
|
158
|
-
'<a href="javascript:window.__xss=3">link</a>'
|
|
159
|
-
);
|
|
160
|
-
document.body.appendChild(el);
|
|
161
|
-
|
|
162
|
-
const msg = el.shadowRoot.querySelector('[part=message]');
|
|
163
|
-
const img = msg.querySelector('img');
|
|
164
|
-
const link = msg.querySelector('a');
|
|
165
|
-
return {
|
|
166
|
-
xss: window.__xss,
|
|
167
|
-
bold: msg.querySelector('b') && msg.querySelector('b').textContent,
|
|
168
|
-
imgKept: img !== null,
|
|
169
|
-
imgHasHandler: img !== null && img.hasAttribute('onerror'),
|
|
170
|
-
scriptPresent: msg.querySelector('script') !== null,
|
|
171
|
-
linkHref: link && link.getAttribute('href')
|
|
172
|
-
};
|
|
173
|
-
}, COMPONENT);
|
|
174
|
-
|
|
175
|
-
expect(result.xss).toBeUndefined();
|
|
176
|
-
// Benign markup is preserved (BC).
|
|
177
|
-
expect(result.bold).toBe('safe');
|
|
178
|
-
expect(result.imgKept).toBe(true);
|
|
179
|
-
// Dangerous constructs are stripped.
|
|
180
|
-
expect(result.imgHasHandler).toBe(false);
|
|
181
|
-
expect(result.scriptPresent).toBe(false);
|
|
182
|
-
expect(result.linkHref == null ||
|
|
183
|
-
!result.linkHref.startsWith('javascript:')).toBe(true);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
test('exposes ::part() styling hooks for theming', async ({ page }) => {
|
|
187
|
-
await page.goto(FIXTURE);
|
|
188
|
-
|
|
189
|
-
const result = await page.evaluate(async (component) => {
|
|
190
|
-
await import(component);
|
|
191
|
-
const el = document.createElement('tf-status');
|
|
192
|
-
el.setAttribute('text', 'x');
|
|
193
|
-
el.setAttribute('message', 'y');
|
|
194
|
-
document.body.appendChild(el);
|
|
195
|
-
|
|
196
|
-
const style = document.createElement('style');
|
|
197
|
-
style.textContent = `
|
|
198
|
-
tf-status::part(label) { color: rgb(1, 2, 3); }
|
|
199
|
-
tf-status::part(message) { color: rgb(9, 8, 7); }
|
|
200
|
-
`;
|
|
201
|
-
document.head.appendChild(style);
|
|
202
|
-
|
|
203
|
-
const label = el.shadowRoot.querySelector('[part=label]');
|
|
204
|
-
const msg = el.shadowRoot.querySelector('[part=message]');
|
|
205
|
-
return {
|
|
206
|
-
label: getComputedStyle(label).color,
|
|
207
|
-
message: getComputedStyle(msg).color
|
|
208
|
-
};
|
|
209
|
-
}, COMPONENT);
|
|
210
|
-
|
|
211
|
-
expect(result.label).toBe('rgb(1, 2, 3)');
|
|
212
|
-
expect(result.message).toBe('rgb(9, 8, 7)');
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// #906: the host is the live region. `role="status"` implies polite and
|
|
216
|
-
// atomic, so they are set (not defaulted) on connect and a consumer's
|
|
217
|
-
// value is corrected; the shadow parts stay ARIA-free so a message
|
|
218
|
-
// change is announced once, not twice.
|
|
219
|
-
test('connects as a polite ARIA status live region', async ({ page }) => {
|
|
220
|
-
await page.goto(FIXTURE);
|
|
221
|
-
|
|
222
|
-
const result = await page.evaluate(async (component) => {
|
|
223
|
-
await import(component);
|
|
224
|
-
const el = document.createElement('tf-status');
|
|
225
|
-
// Enforcement, not a default: a wrong consumer value is fixed.
|
|
226
|
-
el.setAttribute('aria-live', 'off');
|
|
227
|
-
document.body.appendChild(el);
|
|
228
|
-
return {
|
|
229
|
-
role: el.getAttribute('role'),
|
|
230
|
-
live: el.getAttribute('aria-live'),
|
|
231
|
-
atomic: el.getAttribute('aria-atomic'),
|
|
232
|
-
nestedAria: el.shadowRoot.querySelectorAll(
|
|
233
|
-
'[role], [aria-live], [aria-atomic]'
|
|
234
|
-
).length
|
|
235
|
-
};
|
|
236
|
-
}, COMPONENT);
|
|
237
|
-
|
|
238
|
-
expect(result.role).toBe('status');
|
|
239
|
-
expect(result.live).toBe('polite');
|
|
240
|
-
expect(result.atomic).toBe('true');
|
|
241
|
-
expect(result.nestedAria).toBe(0);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('is exposed to assistive tech as a single status region',
|
|
245
|
-
async ({ page }) => {
|
|
246
|
-
await page.goto(FIXTURE);
|
|
247
|
-
|
|
248
|
-
await page.evaluate(async (component) => {
|
|
249
|
-
await import(component);
|
|
250
|
-
const el = document.createElement('tf-status');
|
|
251
|
-
el.setAttribute('text', 'Rows:');
|
|
252
|
-
el.setAttribute('message', '42');
|
|
253
|
-
document.body.appendChild(el);
|
|
254
|
-
}, COMPONENT);
|
|
255
|
-
|
|
256
|
-
await expect(page.locator('tf-status')).toHaveRole('status');
|
|
257
|
-
await expect(page.getByRole('status')).toHaveCount(1);
|
|
258
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>TableFilter active columns tests</title>
|
|
6
|
-
<link rel="stylesheet" href="libs/qunit/qunit.css">
|
|
7
|
-
<script src="libs/qunit/qunit.js"></script>
|
|
8
|
-
<script src="libs/polyfill.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<table id="demo">
|
|
12
|
-
<thead>
|
|
13
|
-
<tr>
|
|
14
|
-
<th>From</th>
|
|
15
|
-
<th>Destination</th>
|
|
16
|
-
<th>Road Distance (km)</th>
|
|
17
|
-
<th>By Air (hrs)</th>
|
|
18
|
-
<th>By Rail (hrs)</th>
|
|
19
|
-
</tr>
|
|
20
|
-
</thead>
|
|
21
|
-
<tbody>
|
|
22
|
-
<tr>
|
|
23
|
-
<td><strong>Sydney</strong></td>
|
|
24
|
-
<td>Adelaide</td>
|
|
25
|
-
<td>1412</td>
|
|
26
|
-
<td>1.4</td>
|
|
27
|
-
<td>25.3</td>
|
|
28
|
-
</tr>
|
|
29
|
-
<tr>
|
|
30
|
-
<td><strong>Sydney</strong></td>
|
|
31
|
-
<td>Brisbane</td>
|
|
32
|
-
<td>982</td>
|
|
33
|
-
<td>1.5</td>
|
|
34
|
-
<td>16</td>
|
|
35
|
-
</tr>
|
|
36
|
-
<tr>
|
|
37
|
-
<td><strong>Sydney</strong></td>
|
|
38
|
-
<td>Canberra</td>
|
|
39
|
-
<td>286</td>
|
|
40
|
-
<td>.6</td>
|
|
41
|
-
<td>4.3</td>
|
|
42
|
-
</tr>
|
|
43
|
-
<tr>
|
|
44
|
-
<td><strong>Sydney</strong></td>
|
|
45
|
-
<td>Melbourne</td>
|
|
46
|
-
<td>872</td>
|
|
47
|
-
<td>1.1</td>
|
|
48
|
-
<td>10.5</td>
|
|
49
|
-
</tr>
|
|
50
|
-
<tr>
|
|
51
|
-
<td><strong>Adelaide</strong></td>
|
|
52
|
-
<td>Perth</td>
|
|
53
|
-
<td>2781</td>
|
|
54
|
-
<td>3.1</td>
|
|
55
|
-
<td>38</td>
|
|
56
|
-
</tr>
|
|
57
|
-
<tr>
|
|
58
|
-
<td><strong>Adelaide</strong></td>
|
|
59
|
-
<td>Alice Springs</td>
|
|
60
|
-
<td>1533</td>
|
|
61
|
-
<td>2</td>
|
|
62
|
-
<td>20.25</td>
|
|
63
|
-
</tr>
|
|
64
|
-
<tr>
|
|
65
|
-
<td><strong>Adelaide</strong></td>
|
|
66
|
-
<td>Brisbane</td>
|
|
67
|
-
<td>2045</td>
|
|
68
|
-
<td>2.15</td>
|
|
69
|
-
<td>40</td>
|
|
70
|
-
</tr>
|
|
71
|
-
</tbody>
|
|
72
|
-
</table>
|
|
73
|
-
|
|
74
|
-
<script src="../dist/tablefilter/tablefilter.js"></script>
|
|
75
|
-
<script src="test-active-columns.js"></script>
|
|
76
|
-
|
|
77
|
-
<div id="qunit"></div>
|
|
78
|
-
<div id="qunit-fixture"></div>
|
|
79
|
-
</body>
|
|
80
|
-
</html>
|