Skip to content

Waterfall changes#73

Merged
JorchCortez merged 76 commits intoDevelopfrom
main
Mar 20, 2026
Merged

Waterfall changes#73
JorchCortez merged 76 commits intoDevelopfrom
main

Conversation

@JorchCortez
Copy link
Copy Markdown
Contributor

New Feature: [Feature Title]

Description

Provide a brief summary of the new feature added to an existing script. Highlight what enhancement it brings or the new functionality introduced.

Related Issues

  • Link any issues related to this feature (e.g., Fixes #123).

Script Details

  • Script Name: [Name of the existing script]
  • Purpose of Update: Describe why this update was necessary.
  • New Behavior: Explain the new functionality added.

Changes Made

  • List the key modifications or additions to the script.

Features

This PR closes NONE

Checklist

  • Feature has been tested locally with all relevant use cases.
  • Documentation has been updated (if necessary).
  • PR does not match another non-stale PR currently opened
  • PR name matches the format [ feature ]: Feature Name (versions separated by comma). More details here
  • PR's base is the develop branch.
  • Your Feature matches the standards laid out here

Additional Notes

Add any extra details or comments for reviewers.

JorchCortez and others added 30 commits January 1, 2025 15:08
Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Fix error handling for undefined platform in ShareLink
Added a link to follow development and news about WebTricks.

Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Update README with development follow link
Created a .gitignore file to prevent node_modules directory from being tracked by git.
Improves copy-to-clipboard feedback by supporting external HTML templates, custom success/error classes, and configurable timeouts. Refactors UI update logic for copy actions, adds screen reader support, and enables module export for testing environments. Also updates LinkedIn share URL to include title.
Introduces a workflow to run tests on pull requests targeting the Develop branch. The workflow sets up Node.js, installs dependencies, and executes tests using npm.
Introduces comprehensive Jest tests for the ShareLink module, covering initialization, clipboard copy success/failure, and fallback behavior. Adds Jest and jsdom environment dependencies for testing.
ShareLink now supports a 'wt-share-copytemplate' attribute to select a specific template for the copy message. Templates are cached and removed from the DOM after use to improve performance. Added a test to verify per-element template selection.
fix #57 ShareLink- Copy Feedback + Clipboard Fallback Enhancement
Added CommonJS export support to CopyToClipboard, Marquee, and ReadTime modules for testability. Introduced comprehensive Jest test suites for each module to verify initialization, behavior, and edge cases in a jsdom environment.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Added safety guards to Marquee's fillContainer to prevent infinite loops when element sizes cannot be measured. Updated tests to proactively stop marquee intervals and drain timers, and added a global Jest setup file to increase timeouts and polyfill animation frame methods for jsdom. Configured Jest to use the setup file and increased default test timeout.
Add CommonJS exports and tests for functional modules
Added a Jest test suite for CookieConsent covering banner display, event wiring, cookie setting, script injection, and consent management. Updated CookieConsent.js to support module exports for test environments.
Added Jest tests for CountUp functionality, including initialization, counting logic, custom step, prefix/suffix, and edge cases. Updated CountUp.js to export CountUp and InitializeCountUp for test environments without affecting browser usage.
JorchCortez and others added 26 commits November 12, 2025 15:15
Removed GitHub License badge from README.

Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Removed the ShareLink Tests job and added coverage summary reporting.

Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
Updated version and description fields, modified test script to include coverage options, and added collectCoverageFrom configuration.

Signed-off-by: Jorge C. <jacortez_94@hotmail.com>
…l-max-elements

Configurable Empty State Threshold for CMSFilter
…al-max-elements

Adds optional parameter for maximum elements displayed when wt-cms-element="empty"
…n-XvPAS_0b61

docs(contributor): contributors readme action update
Copilot AI review requested due to automatic review settings March 20, 2026 20:21
@JorchCortez JorchCortez merged commit eac1e64 into Develop Mar 20, 2026
5 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Jest-based test/CI setup for the WebTricks distribution scripts, adds a new “RangeSliderSimple” module + documentation, and updates several existing Dist modules and docs (including CMSFilter enhancements and README contributor automation).

Changes:

  • Add Node/Jest test infrastructure, CI workflow, and a suite of jsdom-based unit tests for multiple Dist modules.
  • Add RangeSliderSimple (native-thumb dual range slider) with documentation, and update RangeSlider docs/implementation to share core helpers and improve numeric handling.
  • Enhance/adjust multiple existing Dist modules (e.g., CMSFilter empty-state threshold, CMSSelect text extraction, ShareLink copy UX, Marquee infinite-loop guard) and refresh documentation/README content.

Reviewed changes

Copilot reviewed 35 out of 49 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
package.json Adds Jest configuration and dev dependencies for running unit tests/coverage.
jest.setup.js Global Jest setup utilities/polyfills (currently not wired into Jest config).
docs/WebflowOnly/TabsSlider.md Doc formatting cleanup (spacing / code fence alignment).
docs/WebflowOnly/RenderStatic.md Doc formatting cleanup (spacing / code fence alignment).
docs/WebflowOnly/MirrorClick.md Doc formatting cleanup (spacing / list/code formatting).
docs/WebflowOnly/HideContainer.md Doc formatting cleanup (spacing / list formatting).
docs/WebflowOnly/CMSSelect.md Doc updates + adds programmatic initialization example for tests/bundlers.
docs/WebflowOnly/CMSFilter.md Doc updates, including new wt-cmsfilter-empty-max behavior and examples.
docs/Functional/ShareLink.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/ReadTime.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/RangeSliderSimple.md New documentation for the new RangeSliderSimple module.
docs/Functional/RangeSlider.md Doc updates and cross-link to RangeSliderSimple, updated CDN guidance.
docs/Functional/Marquee.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/FormatNumbers.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/FormCheck.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/DateCountDown.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/CountUp.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/CopyToClipboard.md Doc formatting cleanup (spacing / list formatting).
docs/Functional/CookieConsent.md Doc formatting cleanup (spacing / list formatting).
tests/ShareLink.test.js Adds unit tests for ShareLink initialization + copy behavior.
tests/ReadTime.test.js Adds unit tests for ReadTime output and edge cases.
tests/RangeSliderSimple.test.js Adds unit tests validating RangeSliderSimple constraints and API.
tests/RangeSlider.test.js Adds unit tests validating RangeSlider constraints with decimals/integers.
tests/Marquee.test.js Adds unit tests for Marquee cloning/scrolling/resize behavior.
tests/FormatNumbers.test.js Adds unit tests for Intl-based number formatting and error paths.
tests/FormCheck.test.js Adds unit tests covering validation + submission/reset behaviors.
tests/CountUp.test.js Adds unit tests for counter behavior and step handling.
tests/CopyToClipboard.test.js Adds unit tests for clipboard + UI behavior and missing-target behavior.
tests/CookieConsent.test.js Adds unit tests for consent flows and script injection behavior.
tests/CMSSelect.test.js Adds unit tests for CMSSelect option generation and error handling.
tests/CMSFilter.test.js Adds unit tests for CMSFilter filtering, tags, sorting, and empty-max logic.
README.md Updates badges/content, adds range-slider guidance, and adds contributors section scaffold.
Dist/WebflowOnly/CMSSelect.js Improves option text extraction and exports CommonJS entry points for tests.
Dist/WebflowOnly/CMSFilter.js Adds empty-max handling, search caching, range defaults, and CommonJS exports.
Dist/Functional/ShareLink.js Improves URL encoding, adds copy UX/features, template caching, and CommonJS exports.
Dist/Functional/ReadTime.js Adds CommonJS exports for tests/bundlers.
Dist/Functional/RangeSliderSimple.js New distribution script implementing native-thumb dual-handle slider.
Dist/Functional/RangeSlider.js Refactors to shared helpers, improves numeric handling, adds CommonJS exports.
Dist/Functional/Marquee.js Adds cloning loop safety guards and CommonJS exports.
Dist/Functional/FormatNumbers.js Adds CommonJS exports.
Dist/Functional/FormCheck.js Adds CommonJS exports.
Dist/Functional/CountUp.js Adds CommonJS exports.
Dist/Functional/CopyToClipboard.js Hardens missing-target handling and adds CommonJS exports.
Dist/Functional/CookieConsent.js Adds CommonJS exports.
CONTRIBUTING.md Documents that README contributors list is auto-updated via GitHub Actions.
.gitignore Ignores node_modules, coverage, and editor settings.
.github/workflows/update-contributors.yml Adds workflow to auto-update README contributors section.
.github/workflows/tests.yml Adds CI workflow to run Jest tests with coverage reporting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
</p>
<sub>
WebTricks might have been started as a personal project, but I'm a believer that a project for the comunity by the comunity can offer way more value than any single dev could provide so feel free to contribute to this project and use any solution here.
WebTricks might have been started as a personal project, but I'm a believer that a project for the comunity by the comunity can offer way more value than any single dev could provide so feel free to contribute to this project and use any solution here. <br>
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "comunity" should be "community".

Suggested change
WebTricks might have been started as a personal project, but I'm a believer that a project for the comunity by the comunity can offer way more value than any single dev could provide so feel free to contribute to this project and use any solution here. <br>
WebTricks might have been started as a personal project, but I'm a believer that a project for the community by the community can offer way more value than any single dev could provide so feel free to contribute to this project and use any solution here. <br>

Copilot uses AI. Check for mistakes.
Comment thread README.md
</a>
</td>
</tr>
<tbody>
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contributors table has an invalid HTML structure: <tbody> is opened twice and never closed (line 179 should be </tbody>). This can break rendering in some Markdown/HTML parsers.

Suggested change
<tbody>
</tbody>

Copilot uses AI. Check for mistakes.
Comment thread package.json
Comment on lines +5 to +8
"type": "module",
"scripts": {
"test": "jest --runInBand --coverage --coverageReporters=text-summary --coverageReporters=lcov --coverageReporters=json-summary"
},
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"type": "module" will cause Node/Jest to treat .js files (including tests) as ESM. The added tests use CommonJS require(...), and the Dist scripts expose CommonJS module.exports, so this setting is likely to break the test run with require is not defined / ERR_REQUIRE_ESM. Either remove the type field (defaulting to CommonJS) or migrate tests + Jest config to ESM and export the modules accordingly.

Copilot uses AI. Check for mistakes.
Comment thread package.json
Comment on lines +13 to +16
"jest": {
"testEnvironment": "jsdom",
"collectCoverageFrom": [
"**/*.js",
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest.setup.js is added but not referenced by Jest config, so the global setup (timeout, timers reset, polyfills) never runs. Consider wiring it via jest.setupFilesAfterEnv (or setupFiles) or removing the unused setup file to avoid drift/duplicate per-test polyfills.

Copilot uses AI. Check for mistakes.
Comment thread package.json
Comment on lines +15 to +20
"collectCoverageFrom": [
"**/*.js",
"!**/node_modules/**",
"!**/coverage/**",
"!jest.config.js"
]
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collectCoverageFrom: ["**/*.js", ...] will include __tests__/** and docs/** in coverage collection, which can significantly slow coverage runs and skew results. Consider excluding those paths (e.g. !**/__tests__/**, !**/docs/**) so coverage reflects executable library code.

Copilot uses AI. Check for mistakes.
this.filterForm = document.querySelector(
'[wt-cmsfilter-element="filter-form"]',
);
this.listElement = document.querySelector('[wt-cmsfilter-element="list"]');
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor dereferences this.filterForm/this.listElement without checking they exist (e.g. this.filterForm.querySelectorAll(...), this.listElement.getAttribute(...)). If the CMSFilter script is included on a page without the required markup, it will throw during initialization and can break other scripts. Consider adding an early guard in InitializeCMSFilter (or the constructor) that logs an error and returns when required elements are missing.

Suggested change
this.listElement = document.querySelector('[wt-cmsfilter-element="list"]');
this.listElement = document.querySelector('[wt-cmsfilter-element="list"]');
// Guard against missing required elements to avoid runtime errors
if (!this.filterForm || !this.listElement) {
if (typeof console !== "undefined" && console.error) {
console.error(
'CMSFilter: Required elements not found. Expected [wt-cmsfilter-element="filter-form"] and [wt-cmsfilter-element="list"].',
);
}
return;
}

Copilot uses AI. Check for mistakes.
Comment on lines +224 to +226
console.log(
`Configured range slider for ${category}: min=${this.dataRanges[datasetCategory].min}, max=${this.dataRanges[datasetCategory].max}`,
);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This console.log(...) runs for every configured range slider and will spam the console on production sites. Consider removing it or gating it behind an explicit debug flag (e.g. an attribute) so normal usage stays quiet.

Suggested change
console.log(
`Configured range slider for ${category}: min=${this.dataRanges[datasetCategory].min}, max=${this.dataRanges[datasetCategory].max}`,
);
// Only log configuration details when explicit debug flag is present
if (slider.hasAttribute("wt-rangeslider-debug")) {
console.log(
`Configured range slider for ${category}: min=${this.dataRanges[datasetCategory].min}, max=${this.dataRanges[datasetCategory].max}`,
);
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants