Clicking a link in HtmlReporterV2 does exact filtering

This commit is contained in:
Steve Gravrock
2025-10-08 22:13:00 -07:00
parent c042665d9c
commit 0ad54fc6f0
8 changed files with 195 additions and 83 deletions

View File

@@ -1,19 +1,49 @@
describe('HtmlSpecFilterV2', function() {
it('should match when no string is provided', function() {
const specFilter = new privateUnderTest.HtmlSpecFilterV2();
expect(specFilter.matches('foo')).toBe(true);
expect(specFilter.matches('*bar')).toBe(true);
});
it('should only match the provided string', function() {
it('matches everything when no string is provided', function() {
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
filterString: function() {
return 'foo';
filterString() {
return '';
}
});
expect(specFilter.matches('foo')).toBe(true);
expect(specFilter.matches('bar')).toBe(false);
expect(specFilter.matches({})).toBeTrue();
});
it('matches a spec with the exact same path', function() {
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
filterString() {
return '["a","b","c"]';
}
});
expect(specFilter.matches(stubSpec(['a', 'b', 'c']))).toBeTrue();
});
it('matches a spec whose path has the filter path as a prefix', function() {
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
filterString() {
return '["a","b"]';
}
});
expect(specFilter.matches(stubSpec(['a', 'b', 'c']))).toBeTrue();
});
it('does not match a spec with a different path', function() {
const specFilter = new privateUnderTest.HtmlSpecFilterV2({
filterString() {
return '["a","b","c"]';
}
});
expect(specFilter.matches(stubSpec(['a', 'd', 'c']))).toBeFalse();
});
function stubSpec(path) {
return {
getPath() {
return path;
}
};
}
});