test(feed): cover the filter-bar gaps deep-review flagged
- test_feed_views: extend _seed_tagged so a channel carries 2+ tags in a non-topic category, and add language-AND / other-AND equivalence cases — the per-category any/all generalization was only exercised for topic. - tagModes.test: coerceTagModes migration (legacy global tagMode -> topic), per-category preservation, invalid-value coercion, defaults. - urlState.dom.test: per-category tag-mode URL round-trip + legacy ?tagmode=and migration into the topic slot. - Combobox.dom.test: the any/all match footer (hidden below 2 selections, reports a mode change at 2+). - chipOverflow.test: the all/some/count fit boundaries and the +N reservation.
This commit is contained in:
@@ -121,4 +121,23 @@ describe("filterParamUpdates", () => {
|
||||
expect(back.scope).toBe("all");
|
||||
expect(back.includeShorts).toBe(true);
|
||||
});
|
||||
|
||||
it("round-trips per-category tag modes (only 'and' is emitted)", () => {
|
||||
const f: FeedFilters = {
|
||||
...DEFAULTS,
|
||||
tags: [1, 2],
|
||||
tagModes: { language: "and", topic: "and", other: "or" },
|
||||
};
|
||||
const params = filtersToParams(f);
|
||||
expect(params.get("tagmode_language")).toBe("and");
|
||||
expect(params.get("tagmode_topic")).toBe("and");
|
||||
expect(params.has("tagmode_other")).toBe(false); // 'or' is the default, not emitted
|
||||
const back = paramsToFilters(params, DEFAULTS);
|
||||
expect(back.tagModes).toEqual({ language: "and", topic: "and", other: "or" });
|
||||
});
|
||||
|
||||
it("migrates a legacy global ?tagmode=and into the topic slot only", () => {
|
||||
const back = paramsToFilters(new URLSearchParams("tagmode=and"), DEFAULTS);
|
||||
expect(back.tagModes).toEqual({ language: "or", topic: "and", other: "or" });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user