Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1202,10 +1202,6 @@ const WorkspaceItem: React.FC<WorkspaceItemProps> = ({
data-testid="nav-workspace-remote-meta"
data-remote-status={remoteMeta.status}
>
<span
className={`bitfun-nav-panel__workspace-item-status-dot is-${remoteMeta.status}`}
aria-hidden="true"
/>
<span className="bitfun-nav-panel__workspace-item-remote-name">
{remoteMeta.connectionLabel}
</span>
Expand All @@ -1214,6 +1210,10 @@ const WorkspaceItem: React.FC<WorkspaceItemProps> = ({
{remoteMeta.statusLabel}
</span>
) : null}
<span
className={`bitfun-nav-panel__workspace-item-status-dot is-${remoteMeta.status}`}
aria-hidden="true"
/>
</span>
</Tooltip>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@
gap: 5px;
min-width: 0;
max-width: 100%;
padding: 0 6px 0 5px;
padding: 0 5px 0 6px;
border-radius: 999px;
background: color-mix(in srgb, var(--element-bg-medium) 62%, transparent);
color: var(--color-text-secondary);
Expand All @@ -505,7 +505,9 @@
}

&__workspace-item-remote-name {
flex: 0 1 auto;
min-width: 0;
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ function readWorkspaceListStylesheet(): string {
return stylesheet.replace(/\r\n/g, '\n');
}

function readWorkspaceItemSource(): string {
return readFileSync(
fileURLToPath(new URL('./WorkspaceItem.tsx', import.meta.url)),
'utf8',
).replace(/\r\n/g, '\n');
}

function extractBlock(stylesheet: string, selector: string): string {
const escapedSelector = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const match = stylesheet.match(new RegExp(`${escapedSelector}\\s*\\{(?<body>[\\s\\S]*?)\\n\\s*\\}`));
Expand Down Expand Up @@ -90,4 +97,24 @@ describe('WorkspaceListSection layout styles', () => {
expect(block).toContain('height: 20px;');
}
});

it('keeps remote connection metadata inside the sidebar with the status dot on the right', () => {
const stylesheet = readWorkspaceListStylesheet();
const remoteName = extractBlock(stylesheet, '&__workspace-item-remote-name');

expect(remoteName).toContain('flex: 0 1 auto;');
expect(remoteName).toContain('max-width: 160px;');
expect(remoteName).toContain('overflow: hidden;');
expect(remoteName).toContain('text-overflow: ellipsis;');

const source = readWorkspaceItemSource();
const remoteMetaStart = source.indexOf('data-testid="nav-workspace-remote-meta"');
const remoteMetaEnd = source.indexOf('</Tooltip>', remoteMetaStart);
const remoteMetaMarkup = source.slice(remoteMetaStart, remoteMetaEnd);

expect(remoteMetaStart).toBeGreaterThanOrEqual(0);
expect(remoteMetaEnd).toBeGreaterThan(remoteMetaStart);
expect(remoteMetaMarkup.indexOf('workspace-item-remote-name'))
.toBeLessThan(remoteMetaMarkup.indexOf('workspace-item-status-dot'));
});
});