Added the ability to bookmark the extension, along with some visual adjustments
This commit is contained in:
@@ -9,7 +9,7 @@ const plain = value => JSON.parse(JSON.stringify(value));
|
||||
const opportunity = (number, date) => ({ OptyNumber: number, Name: `<Opportunity ${number}>`, EffectiveDate: date,
|
||||
ForecastGroup_c: "FORECAST", StatusCode: "OPEN", CustomerAccount: { PartyUniqueName: "Customer" } });
|
||||
|
||||
function setup(items = [opportunity("A", "2026-11-15")]) {
|
||||
function setup(items = [opportunity("A", "2026-11-15")], extra = {}) {
|
||||
let document;
|
||||
class Element {
|
||||
constructor(tag) { this.tag = tag; this.children = []; this.attributes = {}; this.listeners = {}; this.text = ""; this.isConnected = true; }
|
||||
@@ -44,7 +44,7 @@ function setup(items = [opportunity("A", "2026-11-15")]) {
|
||||
createCopyButton: () => new Element("button"), createCloseIcon: () => new Element("svg"),
|
||||
createViewIcon: view => { const icon = new Element("svg"); icon.view = view; return icon; },
|
||||
createStageBadge: () => new Element("span"), createStatusBadge: () => new Element("span"),
|
||||
opportunityUrl: "https://example.invalid/?puid=", modalId: "modal", closeSrPopover() {} });
|
||||
opportunityUrl: "https://example.invalid/?puid=", modalId: "modal", closeSrPopover() {}, ...extra });
|
||||
h.body = new Element("body"); h.table = new Element("table-surface"); host.append(h.body);
|
||||
const walk = element => [element, ...element.children.flatMap(walk)];
|
||||
h.nodes = () => walk(host);
|
||||
@@ -54,6 +54,23 @@ function setup(items = [opportunity("A", "2026-11-15")]) {
|
||||
return h;
|
||||
}
|
||||
|
||||
test("Booking and Workload update both badges when isolating and adding selections", () => {
|
||||
const selected = new Set(["Booking", "Workload"]);
|
||||
let renders = 0;
|
||||
const h = setup([], { productTypeSelection: selected, onProductTypeChange: () => renders++ });
|
||||
h.mount();
|
||||
const booking = h.nodes().find(node => node.attributes["data-type"] === "Booking");
|
||||
const workload = h.nodes().find(node => node.attributes["data-type"] === "Workload");
|
||||
for (const [button, expected] of [[booking, [true,false]], [workload, [true,true]], [workload, [false,true]], [booking, [true,true]]]) {
|
||||
button.click();
|
||||
assert.equal(booking.attributes["aria-pressed"], String(expected[0]));
|
||||
assert.equal(workload.attributes["aria-pressed"], String(expected[1]));
|
||||
assert.equal(selected.has("Booking"), expected[0]);
|
||||
assert.equal(selected.has("Workload"), expected[1]);
|
||||
}
|
||||
assert.equal(renders, 4);
|
||||
});
|
||||
|
||||
test("calendar controls, accessibility labels and missing dates are English", () => {
|
||||
const h = setup([opportunity("A", "2026-11-15"), opportunity("B", null)]);
|
||||
const { options } = h.activate();
|
||||
|
||||
Reference in New Issue
Block a user