fix(ui): render navbar brand prop outside slot
This commit is contained in:
@@ -688,7 +688,7 @@
|
||||
},
|
||||
"packages/ui": {
|
||||
"name": "@wrnexus/ui",
|
||||
"version": "0.8.43",
|
||||
"version": "0.8.44",
|
||||
"dependencies": {
|
||||
"@wrnexus/core": "workspace:*",
|
||||
},
|
||||
|
||||
@@ -171,7 +171,6 @@ size: string = "default"
|
||||
</div>
|
||||
|
||||
<div class="wrn-navbar__main">
|
||||
<slot name="brand">
|
||||
{#if brand.logo || brand.icon || brand.label || brand.description}
|
||||
<a class="wrn-navbar__brand" href="{brand.href || '/'}" aria-label="{brand.ariaLabel || brand.label || label}">
|
||||
{#if brand.logo}
|
||||
@@ -188,7 +187,7 @@ size: string = "default"
|
||||
{/if}
|
||||
</a>
|
||||
{/if}
|
||||
</slot>
|
||||
<slot name="brand" />
|
||||
|
||||
<div class="wrn-navbar__collapse {mobileOpen ? 'is-open' : ''}">
|
||||
<nav class="wrn-navbar__menus" aria-label="{label}" data-wrn-roving="horizontal">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/ui",
|
||||
"version": "0.8.43",
|
||||
"version": "0.8.44",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
|
||||
@@ -126,11 +126,14 @@ describe("@wrnexus/ui redesign component pack", () => {
|
||||
expect(source).not.toContain(".wrn-navbar__topbar:not(:empty)");
|
||||
});
|
||||
|
||||
test("Navbar exposes a brand slot while retaining the brand prop fallback", async () => {
|
||||
test("Navbar renders its brand prop independently from the optional brand slot", async () => {
|
||||
const source = await readFile(join(componentsDir, "Navbar.wrn"), "utf8");
|
||||
|
||||
expect(source).toContain('<slot name="brand">');
|
||||
expect(source).toContain('<slot name="brand" />');
|
||||
expect(source).toContain("brand.logo || brand.icon || brand.label || brand.description");
|
||||
expect(source.indexOf("brand.logo || brand.icon || brand.label || brand.description")).toBeLessThan(
|
||||
source.indexOf('<slot name="brand" />'),
|
||||
);
|
||||
});
|
||||
|
||||
test("Navbar renders slotted utilities before its built-in actions", async () => {
|
||||
|
||||
Reference in New Issue
Block a user