tablefilter 0.7.5 → 0.7.7
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-7e29d0dbe6e0e0a4ff05.js +1 -0
- package/dist/tablefilter/{tf-2-3a936d22b849361acff5.js → tf-2-0ea691278d572212426a.js} +2 -2
- package/dist/tablefilter.cjs.js +17787 -4
- package/dist/tablefilter.esm.js +15910 -5398
- package/dist/tablefilter.umd.js +17793 -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-pager.js +325 -0
- package/src/components/tf-results-per-page.js +181 -0
- 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/modules/paging.js +270 -46
- 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,384 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var id = function (id){ return document.getElementById(id); };
|
|
3
|
-
|
|
4
|
-
var tf = new TableFilter('demo', {
|
|
5
|
-
base_path: '../dist/tablefilter/',
|
|
6
|
-
col_2: 'multiple',
|
|
7
|
-
col_3: 'select',
|
|
8
|
-
col_4: 'none',
|
|
9
|
-
popup_filters: true
|
|
10
|
-
});
|
|
11
|
-
tf.init();
|
|
12
|
-
|
|
13
|
-
var popupFilter = tf.feature('popupFilter');
|
|
14
|
-
module('Sanity checks');
|
|
15
|
-
test('Pop-up filter component', function() {
|
|
16
|
-
notEqual(popupFilter, null, 'PopupFilter instanciated');
|
|
17
|
-
deepEqual(popupFilter.fltElms instanceof Array,
|
|
18
|
-
true, 'Type of fltElms property');
|
|
19
|
-
deepEqual(
|
|
20
|
-
popupFilter.adjustToContainer,
|
|
21
|
-
true,
|
|
22
|
-
'Popup filter width adjusts to container'
|
|
23
|
-
);
|
|
24
|
-
deepEqual(tf.headersRow, 1, 'Headers row index');
|
|
25
|
-
// issue 99: getHeadersText for pick-list filter types
|
|
26
|
-
deepEqual(
|
|
27
|
-
tf.getHeadersText()[2],
|
|
28
|
-
'Road Distance (km)',
|
|
29
|
-
'Expected header text for multiple filter type'
|
|
30
|
-
);
|
|
31
|
-
deepEqual(
|
|
32
|
-
tf.getHeadersText()[3],
|
|
33
|
-
'By Air (hrs)',
|
|
34
|
-
'Expected header text for multiple filter type'
|
|
35
|
-
);
|
|
36
|
-
deepEqual(tf.dom().rows[tf.headersRow-1].style.display, 'none',
|
|
37
|
-
'Extra row hidden');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
module('UI elements');
|
|
41
|
-
test('Pop-up filter UI elements', function() {
|
|
42
|
-
var flt1 = id(tf.fltIds[3]);
|
|
43
|
-
var flt2 = id(tf.fltIds[2]);
|
|
44
|
-
var fltIcn1 = popupFilter.fltIcons[3];
|
|
45
|
-
var fltIcn2 = popupFilter.fltIcons[2];
|
|
46
|
-
var fltIcn3 = popupFilter.fltIcons[4];
|
|
47
|
-
|
|
48
|
-
notEqual(flt1, null, 'Filter element exists');
|
|
49
|
-
notEqual(flt2, null, 'Filter element exists');
|
|
50
|
-
deepEqual(flt2.hasAttribute('multiple'), true, 'Multiple select exists');
|
|
51
|
-
deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
|
|
52
|
-
deepEqual(fltIcn2.nodeName, 'IMG', 'Filter icon exists');
|
|
53
|
-
deepEqual(fltIcn3, undefined, 'Filter icon does not exist for column 4');
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('Pop-up filter state after filtering', function(){
|
|
57
|
-
var fltIcn0 = popupFilter.fltIcons[0];
|
|
58
|
-
tf.setFilterValue(0, 'syd');
|
|
59
|
-
tf.filter();
|
|
60
|
-
|
|
61
|
-
deepEqual(fltIcn0.src.indexOf('icn_filterActive') !== -1,
|
|
62
|
-
true, 'Icon state');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('Pop-up filter state after clearing', function(){
|
|
66
|
-
var fltIcn0 = popupFilter.fltIcons[0];
|
|
67
|
-
var fltIcn1 = popupFilter.fltIcons[1];
|
|
68
|
-
var fltIcn2 = popupFilter.fltIcons[2];
|
|
69
|
-
var fltIcn3 = popupFilter.fltIcons[3];
|
|
70
|
-
tf.clearFilters();
|
|
71
|
-
|
|
72
|
-
deepEqual(fltIcn0.src.indexOf('icn_filterActive') === -1,
|
|
73
|
-
true, 'Icon state');
|
|
74
|
-
deepEqual(fltIcn1.src.indexOf('icn_filterActive') === -1,
|
|
75
|
-
true, 'Icon state');
|
|
76
|
-
deepEqual(fltIcn2.src.indexOf('icn_filterActive') === -1,
|
|
77
|
-
true, 'Icon state');
|
|
78
|
-
deepEqual(fltIcn3.src.indexOf('icn_filterActive') === -1,
|
|
79
|
-
true, 'Icon state');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test('Can open pop-up filter', function(){
|
|
83
|
-
// act
|
|
84
|
-
popupFilter.open(1);
|
|
85
|
-
|
|
86
|
-
// assert
|
|
87
|
-
deepEqual(popupFilter.fltElms[1].style.display, 'block',
|
|
88
|
-
'Popup filter is open');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('Can close pop-up filter', function(){
|
|
92
|
-
// act
|
|
93
|
-
popupFilter.close(1);
|
|
94
|
-
|
|
95
|
-
// assert
|
|
96
|
-
deepEqual(popupFilter.fltElms[1].style.display, 'none',
|
|
97
|
-
'Popup filter is open');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test('Can toggle pop-up filter (initially closed)', function(){
|
|
101
|
-
// setup
|
|
102
|
-
popupFilter.close(2);
|
|
103
|
-
|
|
104
|
-
// act
|
|
105
|
-
popupFilter.toggle(2);
|
|
106
|
-
|
|
107
|
-
// assert
|
|
108
|
-
deepEqual(popupFilter.fltElms[2].style.display, 'block',
|
|
109
|
-
'Popup filter is toggled');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('Can toggle pop-up filter (initially opened)', function(){
|
|
113
|
-
// setup
|
|
114
|
-
popupFilter.open(2);
|
|
115
|
-
|
|
116
|
-
// act
|
|
117
|
-
popupFilter.toggle(2);
|
|
118
|
-
|
|
119
|
-
// assert
|
|
120
|
-
deepEqual(popupFilter.fltElms[2].style.display, 'none',
|
|
121
|
-
'Popup filter is toggled');
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('Multiple selection pop-up filter remains open upon filtering', function(){
|
|
125
|
-
// setup
|
|
126
|
-
popupFilter.open(2);
|
|
127
|
-
|
|
128
|
-
// act
|
|
129
|
-
tf.setFilterValue(2, ['1412', '982']);
|
|
130
|
-
tf.filter();
|
|
131
|
-
|
|
132
|
-
// assert
|
|
133
|
-
deepEqual(
|
|
134
|
-
popupFilter.isOpen(2),
|
|
135
|
-
true,
|
|
136
|
-
'Multiple selection pop-up filter still open after filtering'
|
|
137
|
-
);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
test('Pop-up filter closes upon filtering', function(){
|
|
141
|
-
// setup
|
|
142
|
-
popupFilter.open(1);
|
|
143
|
-
|
|
144
|
-
// act
|
|
145
|
-
tf.setFilterValue(1, 'Adelaide');
|
|
146
|
-
tf.filter();
|
|
147
|
-
|
|
148
|
-
// assert
|
|
149
|
-
deepEqual(popupFilter.isOpen(1), false,
|
|
150
|
-
'Pop-up filter closed after filtering'
|
|
151
|
-
);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
test('Pop-up filter auto-closes when user clicks away', function() {
|
|
155
|
-
// setup
|
|
156
|
-
popupFilter.open(0);
|
|
157
|
-
|
|
158
|
-
// act
|
|
159
|
-
var evObj = document.createEvent('HTMLEvents');
|
|
160
|
-
evObj.initEvent('mouseup', true, true);
|
|
161
|
-
tf.dom().rows[4].cells[2].dispatchEvent(evObj);
|
|
162
|
-
|
|
163
|
-
// assert
|
|
164
|
-
deepEqual(popupFilter.isOpen(0), false,
|
|
165
|
-
'Pop-up filter closed after user clicks away'
|
|
166
|
-
);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
test('Can close all popup filters', function() {
|
|
170
|
-
// setup
|
|
171
|
-
popupFilter.open(0);
|
|
172
|
-
|
|
173
|
-
// act
|
|
174
|
-
popupFilter.closeAll();
|
|
175
|
-
|
|
176
|
-
// assert
|
|
177
|
-
deepEqual(popupFilter.isOpen(0), false,
|
|
178
|
-
'Pop-up filter closed after closeAll'
|
|
179
|
-
);
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
test('Can destroy and reset', function(){
|
|
183
|
-
// setup
|
|
184
|
-
popupFilter.destroy();
|
|
185
|
-
|
|
186
|
-
// act
|
|
187
|
-
popupFilter.reset();
|
|
188
|
-
|
|
189
|
-
// assert
|
|
190
|
-
deepEqual(popupFilter.fltElms.length, 5, 'Filters are generated');
|
|
191
|
-
deepEqual(popupFilter.fltIcons.length, 4, 'Icons are generated');
|
|
192
|
-
deepEqual(popupFilter.fltSpans.length, 4, 'Icon containers are generated');
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
test('TableFilter removed', function() {
|
|
196
|
-
tf.destroy();
|
|
197
|
-
var fltIcn1 = popupFilter.fltIcons[3];
|
|
198
|
-
deepEqual(fltIcn1, undefined, 'Filter icon is removed');
|
|
199
|
-
deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
test('TableFilter re-initialised', function() {
|
|
203
|
-
tf.init();
|
|
204
|
-
var fltIcn1 = popupFilter.fltIcons[3];
|
|
205
|
-
deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
|
|
206
|
-
deepEqual(id(tf.fltIds[3]).nodeName, 'SELECT', 'Filter exists');
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
module('Properties');
|
|
210
|
-
test('Can set icon HTML', function() {
|
|
211
|
-
// setup
|
|
212
|
-
tf.destroy();
|
|
213
|
-
tf = new TableFilter('demo', {
|
|
214
|
-
base_path: '../dist/tablefilter/',
|
|
215
|
-
col_2: 'multiple',
|
|
216
|
-
col_3: 'select',
|
|
217
|
-
col_4: 'none',
|
|
218
|
-
popup_filters: {
|
|
219
|
-
image_html: '<span>hello world</span>'
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
tf.init();
|
|
223
|
-
|
|
224
|
-
var feature = tf.feature('popupFilter');
|
|
225
|
-
feature.filtersCache = [];
|
|
226
|
-
feature.fltElms = [];
|
|
227
|
-
|
|
228
|
-
// act
|
|
229
|
-
tf.init();
|
|
230
|
-
var headersRow = tf.dom().rows[tf.getHeadersRowIndex()];
|
|
231
|
-
|
|
232
|
-
// assert
|
|
233
|
-
deepEqual(
|
|
234
|
-
headersRow.cells[1].innerHTML
|
|
235
|
-
.indexOf('<span>hello world</span>') !== -1,
|
|
236
|
-
true,
|
|
237
|
-
'Custom HTML element present'
|
|
238
|
-
);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
module('Grid-layout');
|
|
242
|
-
test('Re-instantiated with grid-layout', function() {
|
|
243
|
-
tf.destroy();
|
|
244
|
-
tf = null;
|
|
245
|
-
tf = new TableFilter('demo', {
|
|
246
|
-
base_path: '../dist/tablefilter/',
|
|
247
|
-
col_2: 'multiple',
|
|
248
|
-
col_3: 'select',
|
|
249
|
-
col_4: 'none',
|
|
250
|
-
popup_filters: true,
|
|
251
|
-
grid_layout: true
|
|
252
|
-
});
|
|
253
|
-
tf.init();
|
|
254
|
-
|
|
255
|
-
notEqual(popupFilter, null, 'PopupFilter instanciated');
|
|
256
|
-
deepEqual(popupFilter.fltElms instanceof Array,
|
|
257
|
-
true, 'Type of fltElms property');
|
|
258
|
-
deepEqual(tf.headersRow, 0, 'Headers row index');
|
|
259
|
-
// issue 99: getHeadersText for pick-list filter types
|
|
260
|
-
deepEqual(
|
|
261
|
-
tf.getHeadersText()[2],
|
|
262
|
-
'Road Distance (km)',
|
|
263
|
-
'Expected header text for multiple filter type'
|
|
264
|
-
);
|
|
265
|
-
deepEqual(
|
|
266
|
-
tf.getHeadersText()[3],
|
|
267
|
-
'By Air (hrs)',
|
|
268
|
-
'Expected header text for multiple filter type'
|
|
269
|
-
);
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
test('Pop-up filter UI elements with grid-layout', function() {
|
|
273
|
-
var popupFilter = tf.feature('popupFilter');
|
|
274
|
-
var flt1 = id(tf.fltIds[3]);
|
|
275
|
-
var flt2 = id(tf.fltIds[2]);
|
|
276
|
-
var fltIcn1 = popupFilter.fltIcons[3];
|
|
277
|
-
var fltIcn2 = popupFilter.fltIcons[2];
|
|
278
|
-
var fltIcn3 = popupFilter.fltIcons[4];
|
|
279
|
-
|
|
280
|
-
notEqual(flt1, null, 'Filter element exists');
|
|
281
|
-
notEqual(flt2, null, 'Filter element exists');
|
|
282
|
-
deepEqual(flt2.hasAttribute('multiple'), true, 'Multiple select exists');
|
|
283
|
-
deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
|
|
284
|
-
deepEqual(fltIcn2.nodeName, 'IMG', 'Filter icon exists');
|
|
285
|
-
deepEqual(fltIcn3, undefined, 'Filter icon does not exist for column 4');
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
test('Pop-up filter state after filtering', function(){
|
|
289
|
-
var popupFilter = tf.feature('popupFilter');
|
|
290
|
-
var fltIcn0 = popupFilter.fltIcons[0];
|
|
291
|
-
tf.setFilterValue(0, 'syd');
|
|
292
|
-
tf.filter();
|
|
293
|
-
|
|
294
|
-
deepEqual(fltIcn0.src.indexOf('icn_filterActive') !== -1,
|
|
295
|
-
true, 'Icon state');
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
test('Pop-up filter state after clearing', function(){
|
|
299
|
-
var popupFilter = tf.feature('popupFilter');
|
|
300
|
-
var fltIcn0 = popupFilter.fltIcons[0];
|
|
301
|
-
var fltIcn1 = popupFilter.fltIcons[1];
|
|
302
|
-
var fltIcn2 = popupFilter.fltIcons[2];
|
|
303
|
-
var fltIcn3 = popupFilter.fltIcons[3];
|
|
304
|
-
tf.clearFilters();
|
|
305
|
-
|
|
306
|
-
deepEqual(fltIcn0.src.indexOf('icn_filterActive') === -1,
|
|
307
|
-
true, 'Icon state');
|
|
308
|
-
deepEqual(fltIcn1.src.indexOf('icn_filterActive') === -1,
|
|
309
|
-
true, 'Icon state');
|
|
310
|
-
deepEqual(fltIcn2.src.indexOf('icn_filterActive') === -1,
|
|
311
|
-
true, 'Icon state');
|
|
312
|
-
deepEqual(fltIcn3.src.indexOf('icn_filterActive') === -1,
|
|
313
|
-
true, 'Icon state');
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
module('Feature interface');
|
|
317
|
-
test('Properties', function() {
|
|
318
|
-
var popupFilter = tf.feature('popupFilter');
|
|
319
|
-
|
|
320
|
-
deepEqual(popupFilter.tf instanceof TableFilter,
|
|
321
|
-
true, 'TableFilter instance');
|
|
322
|
-
deepEqual(popupFilter.feature, 'popupFilters', 'Feature name');
|
|
323
|
-
deepEqual(popupFilter.enabled, true, 'Feature enabled');
|
|
324
|
-
deepEqual(popupFilter.initialized, true, 'Feature enabled');
|
|
325
|
-
deepEqual(typeof popupFilter.emitter, 'object',
|
|
326
|
-
'Feature has emitter instance');
|
|
327
|
-
deepEqual(typeof popupFilter.config, 'object', 'TF configuration object');
|
|
328
|
-
deepEqual(typeof popupFilter.init, 'function', 'Feature init method');
|
|
329
|
-
deepEqual(typeof popupFilter.destroy, 'function', 'Feature destroy method');
|
|
330
|
-
deepEqual(typeof popupFilter.reset, 'function', 'Feature reset method');
|
|
331
|
-
deepEqual(typeof popupFilter.enable, 'function', 'Feature enable method');
|
|
332
|
-
deepEqual(typeof popupFilter.disable, 'function', 'Feature enable method');
|
|
333
|
-
deepEqual(typeof popupFilter.isEnabled,
|
|
334
|
-
'function', 'Feature enable method');
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
module('Overrides');
|
|
338
|
-
test('Configuration settings overrides', function() {
|
|
339
|
-
// setup
|
|
340
|
-
tf.destroy();
|
|
341
|
-
tf = new TableFilter('demo', {
|
|
342
|
-
base_path: '../dist/tablefilter/',
|
|
343
|
-
popup_filters: true,
|
|
344
|
-
filters_row_index: 1
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
// assert
|
|
348
|
-
deepEqual(tf.filtersRowIndex, 1, 'Filters row index config setting value');
|
|
349
|
-
deepEqual(
|
|
350
|
-
tf.externalFltIds,
|
|
351
|
-
[],
|
|
352
|
-
'External filters container ids config setting value'
|
|
353
|
-
);
|
|
354
|
-
deepEqual(tf.headersRow, 0, 'Headers row index config setting value');
|
|
355
|
-
|
|
356
|
-
test('Overrides after init', function() {
|
|
357
|
-
// act
|
|
358
|
-
tf.init();
|
|
359
|
-
|
|
360
|
-
// assert
|
|
361
|
-
deepEqual(tf.filtersRowIndex, 0, 'Filters row index override');
|
|
362
|
-
deepEqual(
|
|
363
|
-
tf.externalFltIds,
|
|
364
|
-
[
|
|
365
|
-
'popup_demo_0',
|
|
366
|
-
'popup_demo_1',
|
|
367
|
-
'popup_demo_2',
|
|
368
|
-
'popup_demo_3',
|
|
369
|
-
'popup_demo_4'
|
|
370
|
-
],
|
|
371
|
-
'External filters container ids config setting value'
|
|
372
|
-
);
|
|
373
|
-
deepEqual(tf.headersRow, 1, 'Headers row index override');
|
|
374
|
-
});
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
module('Tear-down');
|
|
378
|
-
test('TableFilter removed', function() {
|
|
379
|
-
tf.destroy();
|
|
380
|
-
var fltIcn1 = popupFilter.fltIcons[3];
|
|
381
|
-
deepEqual(fltIcn1, undefined, 'Filter icon is removed');
|
|
382
|
-
deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
|
|
383
|
-
deepEqual(tf.isInitialized(), false, 'Filters removed');
|
|
384
|
-
});
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>TableFilter pop-up filters with grouped headers</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
|
-
<p>
|
|
12
|
-
Tests for <a href="https://jsfiddle.net/wLexc6pt/6/">
|
|
13
|
-
https://jsfiddle.net/wLexc6pt/6/</a> fiddle
|
|
14
|
-
</p>
|
|
15
|
-
<table id="demo">
|
|
16
|
-
<thead>
|
|
17
|
-
<tr>
|
|
18
|
-
<th colspan="3">Colspan Header</th>
|
|
19
|
-
<th colspan="4">Colspan Header</th>
|
|
20
|
-
</tr>
|
|
21
|
-
<tr>
|
|
22
|
-
<th>SubHeader</th>
|
|
23
|
-
<th>SubHeader</th>
|
|
24
|
-
<th>SubHeader</th>
|
|
25
|
-
<th>SubHeader</th>
|
|
26
|
-
<th>SubHeader</th>
|
|
27
|
-
<th>SubHeader</th>
|
|
28
|
-
<th>SubHeader</th>
|
|
29
|
-
</tr>
|
|
30
|
-
</thead>
|
|
31
|
-
<tbody>
|
|
32
|
-
<tr>
|
|
33
|
-
<td>Value</td>
|
|
34
|
-
<td>Value</td>
|
|
35
|
-
<td>Value</td>
|
|
36
|
-
<td>Filter Value 1</td>
|
|
37
|
-
<td>Filter Value 1</td>
|
|
38
|
-
<td>Filter Value 1</td>
|
|
39
|
-
<td>Filter Value 1</td>
|
|
40
|
-
</tr>
|
|
41
|
-
<tr>
|
|
42
|
-
<td>Value</td>
|
|
43
|
-
<td>Value</td>
|
|
44
|
-
<td>Value</td>
|
|
45
|
-
<td>Filter Value 1</td>
|
|
46
|
-
<td>Filter Value 1</td>
|
|
47
|
-
<td>Filter Value 1</td>
|
|
48
|
-
<td>Filter Value 1</td>
|
|
49
|
-
</tr>
|
|
50
|
-
<tr>
|
|
51
|
-
<td>Value</td>
|
|
52
|
-
<td>Value</td>
|
|
53
|
-
<td>Value</td>
|
|
54
|
-
<td>Filter Value 2</td>
|
|
55
|
-
<td>Filter Value 2</td>
|
|
56
|
-
<td>Filter Value 2</td>
|
|
57
|
-
<td>Filter Value 2</td>
|
|
58
|
-
</tr>
|
|
59
|
-
<tr>
|
|
60
|
-
<td>Value</td>
|
|
61
|
-
<td>Value</td>
|
|
62
|
-
<td>Value</td>
|
|
63
|
-
<td>Filter Value 3</td>
|
|
64
|
-
<td>Filter Value 3</td>
|
|
65
|
-
<td>Filter Value 3</td>
|
|
66
|
-
<td>Filter Value 3</td>
|
|
67
|
-
</tr>
|
|
68
|
-
<tr>
|
|
69
|
-
<td>Value</td>
|
|
70
|
-
<td>Value</td>
|
|
71
|
-
<td>Value</td>
|
|
72
|
-
<td>Filter Value 3</td>
|
|
73
|
-
<td>Filter Value 3</td>
|
|
74
|
-
<td>Filter Value 3</td>
|
|
75
|
-
<td>Filter Value 3</td>
|
|
76
|
-
</tr>
|
|
77
|
-
<tr>
|
|
78
|
-
<td>Value</td>
|
|
79
|
-
<td>Value</td>
|
|
80
|
-
<td>Value</td>
|
|
81
|
-
<td>Filter Value 4</td>
|
|
82
|
-
<td>Filter Value 4</td>
|
|
83
|
-
<td>Filter Value 4</td>
|
|
84
|
-
<td>Filter Value 4</td>
|
|
85
|
-
</tr>
|
|
86
|
-
<tr>
|
|
87
|
-
<td>Value</td>
|
|
88
|
-
<td>Value</td>
|
|
89
|
-
<td>Value</td>
|
|
90
|
-
<td>Filter Value 5</td>
|
|
91
|
-
<td>Filter Value 5</td>
|
|
92
|
-
<td>Filter Value 5</td>
|
|
93
|
-
<td>Filter Value 5</td>
|
|
94
|
-
</tr>
|
|
95
|
-
</tbody>
|
|
96
|
-
</table>
|
|
97
|
-
|
|
98
|
-
<script src="../dist/tablefilter/tablefilter.js"></script>
|
|
99
|
-
<script src="test-popup-filters-grouped-headers.js"></script>
|
|
100
|
-
|
|
101
|
-
<div id="qunit"></div>
|
|
102
|
-
<div id="qunit-fixture"></div>
|
|
103
|
-
</body>
|
|
104
|
-
</html>
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var id = function (id){ return document.getElementById(id); };
|
|
3
|
-
|
|
4
|
-
var _tf = new TableFilter('demo', {
|
|
5
|
-
base_path: '../dist/tablefilter/',
|
|
6
|
-
col_0: 'none',
|
|
7
|
-
col_1: 'none',
|
|
8
|
-
col_2: 'none',
|
|
9
|
-
col_3: 'checklist',
|
|
10
|
-
col_4: 'checklist',
|
|
11
|
-
col_5: 'checklist',
|
|
12
|
-
col_6: 'checklist',
|
|
13
|
-
headers_row_index: 1,
|
|
14
|
-
popup_filters: true,
|
|
15
|
-
mark_active_columns: true
|
|
16
|
-
}, 2);
|
|
17
|
-
_tf.init();
|
|
18
|
-
|
|
19
|
-
var popupFilter = _tf.feature('popupFilter');
|
|
20
|
-
module('Sanity checks');
|
|
21
|
-
test('Pop-up filter component', function() {
|
|
22
|
-
notEqual(popupFilter, null, 'PopupFilter instanciated');
|
|
23
|
-
deepEqual(popupFilter.fltElms instanceof Array,
|
|
24
|
-
true, 'Type of fltElms property');
|
|
25
|
-
deepEqual(
|
|
26
|
-
popupFilter.adjustToContainer,
|
|
27
|
-
true,
|
|
28
|
-
'Popup filter width adjusts to container'
|
|
29
|
-
);
|
|
30
|
-
deepEqual(_tf.headersRow, 2, 'Headers row index');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
module('UI elements');
|
|
34
|
-
test('Pop-up filter UI elements', function() {
|
|
35
|
-
var flt3 = popupFilter.fltElms[3];
|
|
36
|
-
var flt4 = popupFilter.fltElms[4];
|
|
37
|
-
var fltIcn3 = popupFilter.fltIcons[3];
|
|
38
|
-
var fltIcn4 = popupFilter.fltIcons[4];
|
|
39
|
-
var fltIcn0 = popupFilter.fltIcons[0];
|
|
40
|
-
var fltIcn1 = popupFilter.fltIcons[0];
|
|
41
|
-
|
|
42
|
-
notEqual(flt3, null, 'Filter element exists');
|
|
43
|
-
notEqual(flt4, null, 'Filter element exists');
|
|
44
|
-
deepEqual(fltIcn3.nodeName, 'IMG', 'Filter icon exists');
|
|
45
|
-
deepEqual(fltIcn4.nodeName, 'IMG', 'Filter icon exists');
|
|
46
|
-
deepEqual(fltIcn0, undefined, 'Filter icon does not exist for column 0');
|
|
47
|
-
deepEqual(fltIcn1, undefined, 'Filter icon does not exist for column 1');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('Pop-up filter state after filtering', function(){
|
|
51
|
-
var fltIcn4 = popupFilter.fltIcons[4];
|
|
52
|
-
_tf.setFilterValue(4, 'Filter Value 4');
|
|
53
|
-
_tf.filter();
|
|
54
|
-
|
|
55
|
-
deepEqual(fltIcn4.src.indexOf('icn_filterActive') !== -1,
|
|
56
|
-
true, 'Icon state');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('Pop-up filter state after clearing', function(){
|
|
60
|
-
var fltIcn3 = popupFilter.fltIcons[3];
|
|
61
|
-
var fltIcn4 = popupFilter.fltIcons[4];
|
|
62
|
-
var fltIcn5 = popupFilter.fltIcons[5];
|
|
63
|
-
var fltIcn6 = popupFilter.fltIcons[6];
|
|
64
|
-
_tf.clearFilters();
|
|
65
|
-
|
|
66
|
-
deepEqual(fltIcn3.src.indexOf('icn_filterActive') === -1,
|
|
67
|
-
true, 'Icon state');
|
|
68
|
-
deepEqual(fltIcn4.src.indexOf('icn_filterActive') === -1,
|
|
69
|
-
true, 'Icon state');
|
|
70
|
-
deepEqual(fltIcn5.src.indexOf('icn_filterActive') === -1,
|
|
71
|
-
true, 'Icon state');
|
|
72
|
-
deepEqual(fltIcn6.src.indexOf('icn_filterActive') === -1,
|
|
73
|
-
true, 'Icon state');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('Can open pop-up filter', function(){
|
|
77
|
-
// act
|
|
78
|
-
popupFilter.open(5);
|
|
79
|
-
|
|
80
|
-
// assert
|
|
81
|
-
deepEqual(popupFilter.isOpen(5), true,
|
|
82
|
-
'Popup filter is open');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test('Can close pop-up filter', function(){
|
|
86
|
-
// act
|
|
87
|
-
popupFilter.close(5);
|
|
88
|
-
|
|
89
|
-
// assert
|
|
90
|
-
deepEqual(popupFilter.isOpen(5), false,
|
|
91
|
-
'Popup filter is open');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
test('Can toggle pop-up filter (initially closed)', function(){
|
|
95
|
-
// setup
|
|
96
|
-
popupFilter.close(6);
|
|
97
|
-
|
|
98
|
-
// act
|
|
99
|
-
popupFilter.toggle(6);
|
|
100
|
-
|
|
101
|
-
// assert
|
|
102
|
-
deepEqual(popupFilter.isOpen(6), true,
|
|
103
|
-
'Popup filter is toggled');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('Can toggle pop-up filter (initially opened)', function(){
|
|
107
|
-
// setup
|
|
108
|
-
popupFilter.open(6);
|
|
109
|
-
|
|
110
|
-
// act
|
|
111
|
-
popupFilter.toggle(6);
|
|
112
|
-
|
|
113
|
-
// assert
|
|
114
|
-
deepEqual(popupFilter.isOpen(6), false,
|
|
115
|
-
'Popup filter is toggled');
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('Checklist pop-up filter remains open upon filtering', function(){
|
|
119
|
-
// setup
|
|
120
|
-
popupFilter.open(4);
|
|
121
|
-
|
|
122
|
-
// act
|
|
123
|
-
_tf.setFilterValue(4, ['Filter Value 4']);
|
|
124
|
-
_tf.filter();
|
|
125
|
-
|
|
126
|
-
// assert
|
|
127
|
-
deepEqual(
|
|
128
|
-
popupFilter.isOpen(4),
|
|
129
|
-
true,
|
|
130
|
-
'Checklist pop-up filter still open after filtering'
|
|
131
|
-
);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
test('Pop-up filter auto-closes when user clicks away', function() {
|
|
135
|
-
// setup
|
|
136
|
-
popupFilter.open(5);
|
|
137
|
-
|
|
138
|
-
// act
|
|
139
|
-
var evObj = document.createEvent('HTMLEvents');
|
|
140
|
-
evObj.initEvent('mouseup', true, true);
|
|
141
|
-
_tf.dom().rows[4].cells[2].dispatchEvent(evObj);
|
|
142
|
-
|
|
143
|
-
// assert
|
|
144
|
-
deepEqual(popupFilter.isOpen(5), false,
|
|
145
|
-
'Pop-up filter closed after user clicks away'
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test('Can close all popup filters', function() {
|
|
150
|
-
// setup
|
|
151
|
-
popupFilter.open(3);
|
|
152
|
-
|
|
153
|
-
// act
|
|
154
|
-
popupFilter.closeAll(4);
|
|
155
|
-
|
|
156
|
-
// assert
|
|
157
|
-
deepEqual(popupFilter.isOpen(3), false,
|
|
158
|
-
'Pop-up filter closed after closeAll'
|
|
159
|
-
);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('Does not close popup filter if closeOnFiltering false', function() {
|
|
163
|
-
// setup
|
|
164
|
-
popupFilter.closeOnFiltering = false;
|
|
165
|
-
popupFilter.open(4);
|
|
166
|
-
|
|
167
|
-
// act
|
|
168
|
-
popupFilter.close(4);
|
|
169
|
-
|
|
170
|
-
// assert
|
|
171
|
-
deepEqual(popupFilter.isOpen(4), false,
|
|
172
|
-
'Pop-up filter closed after closeAll'
|
|
173
|
-
);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// TODO: fix reset popupFilter component with grouped headers
|
|
177
|
-
// test('Can destroy and reset', function(){
|
|
178
|
-
// // setup
|
|
179
|
-
// _tf.clearFilters();
|
|
180
|
-
// _tf.filter();
|
|
181
|
-
// popupFilter.destroy();
|
|
182
|
-
|
|
183
|
-
// // act
|
|
184
|
-
// popupFilter.reset();
|
|
185
|
-
|
|
186
|
-
// // assert
|
|
187
|
-
// deepEqual(popupFilter.fltElms.length, 7, 'Filters are generated');
|
|
188
|
-
// deepEqual(popupFilter.fltIcons.length, 4, 'Icons are generated');
|
|
189
|
-
// deepEqual(popupFilter.fltSpans.length, 4,
|
|
190
|
-
// 'Icon containers are generated');
|
|
191
|
-
// });
|
|
192
|
-
|
|
193
|
-
test('TableFilter removed', function() {
|
|
194
|
-
_tf.destroy();
|
|
195
|
-
var fltIcn1 = popupFilter.fltIcons[3];
|
|
196
|
-
deepEqual(fltIcn1, undefined, 'Filter icon is removed');
|
|
197
|
-
deepEqual(id(_tf.fltIds[3]), null, 'Filter is removed');
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
// test('TableFilter re-initialised', function() {
|
|
201
|
-
// _tf.init();
|
|
202
|
-
// var fltIcn1 = popupFilter.fltIcons[3];
|
|
203
|
-
// deepEqual(fltIcn1.nodeName, 'IMG', 'Filter icon exists');
|
|
204
|
-
// deepEqual(_tf.getFilterType(3), 'checklist', 'Filter type');
|
|
205
|
-
// });
|
|
206
|
-
|