diff --git a/src/components/LuxMenuBar.vue b/src/components/LuxMenuBar.vue index f3496ea..b8a787d 100644 --- a/src/components/LuxMenuBar.vue +++ b/src/components/LuxMenuBar.vue @@ -96,6 +96,7 @@ @@ -612,6 +625,29 @@ export default { padding-top: 0.75rem; } } + + + ul button { + font-family: var(--font-family-text); + font-size: var(--font-size-base); + line-height: 1; + border: none; + background: none; + color: var(--color-rich-black); + padding: 0.5rem 1rem; + @include princeton-focus(light); + width: 100%; + box-sizing: border-box; + text-align: start; + } + + + ul button:hover { + cursor: pointer; + color: var(--color-rich-black); + } + + + ul button:focus { + color: var(--color-rich-black); + } } } } diff --git a/tests/unit/specs/components/luxMenuBar.spec.js b/tests/unit/specs/components/luxMenuBar.spec.js index ee2f520..1983487 100644 --- a/tests/unit/specs/components/luxMenuBar.spec.js +++ b/tests/unit/specs/components/luxMenuBar.spec.js @@ -171,9 +171,11 @@ describe("LuxMenuBar.vue", () => { }) describe("when type is main-menu", () => { - it("emits menu-item-clicked with metadata about the clicked menu item", async () => { + beforeEach(async () => { wrapper.setProps({ type: "main-menu" }) await nextTick() + }) + it("emits menu-item-clicked with metadata about the clicked menu item", () => { wrapper.findAll(".lux-nav-item")[2].trigger("click") expect(wrapper.emitted()["menu-item-clicked"].length).toEqual(1) @@ -181,5 +183,22 @@ describe("LuxMenuBar.vue", () => { { name: "Bar", component: "Bar", href: "/example/" }, ]) }) + it("creates a button rather than link when the item does not have an href supplied", async () => { + wrapper.setProps({ + menuItems: [ + { + name: "Foo", + component: "Foo", + children: [{ name: "Baz", component: "Baz" }], + }, + ], + }) + await nextTick() + + wrapper.find("button.lux-submenu-toggle").trigger("click") + await nextTick() + + expect(wrapper.get("button.lux-nav-item").text()).toEqual("Baz") + }) }) })