Replaced labels with icons in the SR and Action badges
This commit is contained in:
@@ -59,6 +59,7 @@ test("ten columns retain their links and put product/customer controls below the
|
||||
assert.ok(name.children[0].href.endsWith("TEST-1"));
|
||||
assert.equal(name.children[1].children[0].className, "opportunities-extension-products-count");
|
||||
assert.equal(name.children[1].children[0].textContent, "1");
|
||||
assert.equal(name.children[1].children[0].title, "1 product");
|
||||
assert.equal(customer.children[0].textContent, "Synthetic customer");
|
||||
assert.ok(customer.children[0].href.endsWith("party%2Fid"));
|
||||
assert.equal(customer.children[1].children[0].title, "View customer consumption");
|
||||
@@ -82,8 +83,8 @@ test("ramp months preserve zero and flag missing values beside the product count
|
||||
const badge = () => findClass(h.cell("name"), "opportunities-extension-products-ramp");
|
||||
assert.equal(badge(), undefined);
|
||||
for (const [values, expected] of [
|
||||
[[], null], [[null], "RM N/D"], [[null, undefined, "", " "], "RM N/D"], [[6], "RM 6"],
|
||||
[[0], "RM 0"], [[0, "3", null, " 6 ", 3], "RM 0,3,N/D,6,3"]
|
||||
[[], null], [[null], "N/D"], [[null, undefined, "", " "], "N/D"], [[6], "6"],
|
||||
[[0], "0"], [[0, "3", null, " 6 ", 3], "0,3,N/D,6,3"]
|
||||
]) {
|
||||
h.app.productsContentState.opptyProductsByNumber.set("TEST-1", {
|
||||
fromCache: true, items: values.map(RampMonths_c => ({ RampMonths_c }))
|
||||
@@ -93,10 +94,13 @@ test("ramp months preserve zero and flag missing values beside the product count
|
||||
else {
|
||||
assert.equal(badge().textContent, expected);
|
||||
assert.equal(badge().attributes["data-missing"], String(expected.includes("N/D")));
|
||||
assert.match(badge().title, /^Ramp Months:/);
|
||||
assert.equal(badge().title, `Ramp Months: ${expected.split(",").join(", ")}`);
|
||||
assert.equal(badge().attributes["aria-label"], badge().title);
|
||||
assert.equal(h.cell("name").children[0].children[1].children[1], badge());
|
||||
}
|
||||
assert.equal(findClass(h.cell("name"), "opportunities-extension-products-count").textContent, String(values.length));
|
||||
const count = findClass(h.cell("name"), "opportunities-extension-products-count");
|
||||
assert.equal(count.textContent, String(values.length));
|
||||
assert.equal(count.title, `${values.length} product${values.length === 1 ? "" : "s"}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,6 +122,33 @@ test("products remain expandable with AI summary and a ten-column detail row aft
|
||||
assert.deepEqual(h.summaries, ["B"], "collapsing does not generate another summary");
|
||||
});
|
||||
|
||||
test("product labels support multiple digits without changing their tooltip", () => {
|
||||
const h = setup();
|
||||
h.app.productsContentState.opptyProductsByNumber.set("TEST-1", { items: Array.from({ length: 12 }, () => ({})) });
|
||||
h.app.opportunitiesTable.renderOpportunitiesTable();
|
||||
const count = findClass(h.cell("name"), "opportunities-extension-products-count");
|
||||
assert.equal(count.textContent, "12");
|
||||
assert.equal(count.title, "12 products");
|
||||
assert.equal(count.attributes["aria-label"], "12 products for opportunity TEST-1");
|
||||
});
|
||||
|
||||
test("opportunity badges share height, typography and alignment including the Action plus button", () => {
|
||||
const css = fs.readFileSync(path.join(__dirname, "../src/features/opportunities/styles.css"), "utf8");
|
||||
const shared = css.match(/\.opportunities-extension-cell-actions > \.opportunities-extension-products-count,\s*\.opportunities-extension-cell-actions > \.opportunities-extension-products-ramp,\s*\.opportunities-extension-cell-actions > \.opportunities-extension-crm-sr-badge\s*\{([^}]+)\}/);
|
||||
assert.ok(shared, "P, R, SR and Act share one scoped badge rule");
|
||||
for (const declaration of ["display: inline-flex;", "align-items: center;", "justify-content: flex-start;",
|
||||
"box-sizing: border-box;", "height: 20px;", "min-height: 20px;", "padding: 0 6px;", "margin: 0;",
|
||||
"border-radius: 8px;", "font-family: inherit;", "font-size: 10px;", "font-weight: 600;", "line-height: 16px;"]) {
|
||||
assert.ok(shared[1].includes(declaration), declaration);
|
||||
}
|
||||
const plus = css.match(/\.opportunities-extension-add-action\s*\{([^}]+)\}/)[1];
|
||||
assert.match(plus, /height: 16px;/);
|
||||
assert.match(plus, /align-items: center;/);
|
||||
assert.match(plus, /font: inherit;/);
|
||||
const actions = fs.readFileSync(path.join(__dirname, "../src/features/opportunities/workload-actions.js"), "utf8");
|
||||
assert.match(actions, /badge.className = "opportunities-extension-crm-sr-badge opportunities-extension-wl-actions-badge"/);
|
||||
});
|
||||
|
||||
test("CRM SR badge follows Ramp Months and remains visible while product data is pending", async () => {
|
||||
const h = setup();
|
||||
h.app.fusionCrmServiceRequests.requestCrmServiceRequest = async () => [{
|
||||
@@ -125,11 +156,11 @@ test("CRM SR badge follows Ramp Months and remains visible while product data is
|
||||
}];
|
||||
await h.app.opportunityCrmServiceRequests.load("synthetic", h.app.opportunitiesQueryState.periodRequestVersion);
|
||||
h.app.opportunitiesTable.renderOpportunitiesTable();
|
||||
assert.equal(findClass(h.cell("name"), "opportunities-extension-crm-sr-badge").textContent, "\u2705 SR (0h)");
|
||||
assert.equal(findClass(h.cell("name"), "opportunities-extension-crm-sr-badge").textContent, "0h");
|
||||
h.app.productsContentState.opptyProductsByNumber.set("TEST-1", { items: [{ RampMonths_c: 3 }] });
|
||||
h.app.opportunitiesTable.renderOpportunitiesTable();
|
||||
const actions = h.cell("name").children[0].children[1];
|
||||
assert.deepEqual(actions.children.map(child => child.textContent), ["1", "RM 3", "\u2705 SR (0h)", "Act ?"]);
|
||||
assert.deepEqual(actions.children.map(child => child.textContent), ["1", "3", "0h", "?"]);
|
||||
findClass(h.cell("name"), "opportunities-extension-products-count").click();
|
||||
assert.ok(findClass(h.rows()[1], "opportunities-extension-products-table"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user