Files
jasmine/src/html/HtmlSpecFilterv2.js
Steve Gravrock 85322d1877 Re-add support for partial spec name filtering
No UI for this but users can construct URLs manually.
Fixes #2085.
2025-10-24 17:26:49 -07:00

42 lines
914 B
JavaScript

jasmineRequire.HtmlSpecFilterV2 = function() {
class HtmlSpecFilterV2 {
#getFilterParams;
constructor(options) {
this.#getFilterParams = options.filterParams;
}
matches(spec) {
const params = this.#getFilterParams();
if (params.path) {
return this.#matchesPath(spec, JSON.parse(params.path));
} else if (params.spec) {
// Like legacy HtmlSpecFilter, retained because it's convenient for
// hand-constructing filter URLs
return spec.getFullName().includes(params.spec);
}
return true;
}
#matchesPath(spec, path) {
const specPath = spec.getPath();
if (path.length > specPath.length) {
return false;
}
for (let i = 0; i < path.length; i++) {
if (specPath[i] !== path[i]) {
return false;
}
}
return true;
}
}
return HtmlSpecFilterV2;
};