Skip to content

Commit

Permalink
fix(signal): custom class passthrough (#2122)
Browse files Browse the repository at this point in the history
* fix(signal): custom class passthrough

* chore: add changeset
  • Loading branch information
mkchang committed Mar 12, 2024
1 parent 1df064b commit 3937eff
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hungry-taxis-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/ebayui-core": patch
---

Fix signal custom class passthrough
4 changes: 3 additions & 1 deletion src/components/ebay-signal/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ static interface SignalInput extends Omit<Marko.Input<"span">, `on${string}`> {
export interface Input extends WithNormalizedProps<SignalInput> {}

$ const {
class: inputClass,
status = "neutral",
...htmlAttributes
} = input;

<span ...processHtmlAttributes(htmlAttributes) class=`signal signal--${status}`>
<span ...processHtmlAttributes(htmlAttributes)
class=[inputClass, "signal", `signal--${status}`]>
<${input.renderBody}/>
</span>
5 changes: 5 additions & 0 deletions src/components/ebay-signal/test/mock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ export const basicTimeSensitive = {
status: "time-sensitive",
renderBody: createRenderBody("time sensitive"),
};

export const basicWithClass = {
renderBody: createRenderBody("neutral"),
class: "custom-class",
};
8 changes: 8 additions & 0 deletions src/components/ebay-signal/test/test.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ describe("signal", () => {
expect(el).has.class("signal");
expect(el).has.class("signal--neutral");
});

it("renders with custom class", async () => {
const input = mock.basicWithClass;
const { getByText } = await render(template, input);
const el = getByText(/neutral/i);

expect(el).has.class("custom-class");
});
});

0 comments on commit 3937eff

Please sign in to comment.