Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
cd8b383
Refactor components to use Ant Design buttons and remove VSCode UI to…
arneschmid Mar 27, 2026
75fe5cd
Add class names to dropdown components for better styling and identif…
arneschmid Mar 27, 2026
9bddabe
Merge branch 'main' into fix/replace-deprecated-ui-toolkit
arneschmid Mar 27, 2026
ea94774
Remove deprecated VSCode UI toolkit mocks from test file
arneschmid Mar 27, 2026
44d3d0e
Merge branch 'main' into fix/replace-deprecated-ui-toolkit
arneschmid Apr 13, 2026
4b64b09
Add onClear handler to reset search filter in ConfWiz component
arneschmid Apr 13, 2026
2c94c84
Replace deprecated Messenger import with acquireVsCodeApi in webview …
arneschmid Apr 13, 2026
b159187
Refactor ConfWiz component to use acquireVsCodeApi for Messenger init…
arneschmid Apr 13, 2026
daeabd3
Refactor hardware-row tests to replace deprecated TextField with HTML…
arneschmid Apr 13, 2026
e76d2ae
Refactor components to replace deprecated imports, enhance accessibil…
arneschmid Apr 13, 2026
89764f9
Merge branch 'main' into fix/replace-deprecated-ui-toolkit
arneschmid Apr 13, 2026
9571a1e
Refactor tests to replace deprecated acquireVsCodeApi mock with a loc…
arneschmid Apr 13, 2026
3e99ada
align code formatting
arneschmid Apr 14, 2026
7138565
Add test for createSolution action in CreateSolution component
arneschmid Apr 14, 2026
9c734b6
Remove deprecated toolkit script reference from ConfWizWebview
arneschmid Apr 14, 2026
34efce3
Update Checkbox event handler to use onChange instead of onClick
arneschmid Apr 14, 2026
63ac6e8
Merge branch 'main' into fix/replace-deprecated-ui-toolkit
edriouk Apr 15, 2026
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
7 changes: 0 additions & 7 deletions docs/third-party-licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@
"url": "https://github.com/microsoft/vscode-codicons",
"license": "https://github.com/microsoft/vscode-codicons/blob/main/LICENSE"
},
{
"name": "@vscode/webview-ui-toolkit",
"version": "1.4.0",
"spdx": "MIT",
"url": "https://github.com/microsoft/vscode-webview-ui-toolkit",
"license": "https://github.com/microsoft/vscode-webview-ui-toolkit/blob/main/LICENSE"
},
{
"name": "async-mutex",
"version": "0.5.0",
Expand Down
67 changes: 0 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@lydell/node-pty": "^1.1.0",
"@microsoft/vscode-serial-monitor-api": "^0.1.7",
"@vscode/codicons": "^0.0.44",
Comment thread
arneschmid marked this conversation as resolved.
"@vscode/webview-ui-toolkit": "^1.4.0",
"antd": "^5.29.3",
"async-mutex": "^0.5.0",
"eta": "^4.5.1",
Expand Down Expand Up @@ -1553,7 +1552,7 @@
]
},
"transformIgnorePatterns": [
"/node_modules/(?!(@vscode/webview-ui-toolkit|@microsoft|exenv-es6|yaml)/)"
"/node_modules/(?!(@microsoft|yaml)/)"
],
"testPathIgnorePatterns": [
"/node_modules/",
Expand Down
2 changes: 1 addition & 1 deletion src/views/common/components/compact-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const CompactDropdown = (props: CompactDropdownProps) => {
<div className={expanded ? `${props.className} compact-dropdown expanded` : `${props.className} compact-dropdown`} style={props.style} ref={rootRef}>
<div className='compact-dropdown-inner'>
{props.addonBefore && <div className="compact-dropdown-addon-before">{props.addonBefore}</div>}
<div className={`compact-dropdown-trigger ${props.disabled ? ' disabled' : ''}`} onClick={toggleDropdown} ref={triggerRef} title={toolTip(props.selected)} tabIndex={0}>
<div className={`compact-dropdown-trigger ${props.disabled ? ' disabled' : ''}`} onClick={toggleDropdown} ref={triggerRef} title={toolTip(props.selected)} tabIndex={0} role='combobox' aria-haspopup='listbox' aria-expanded={expanded} aria-controls='compact-dropdown-popover'>
{props.displayText ? props.displayText(props.selected) : props.selected || props.unselectedLabel} {props.tag}
{props.warning && <span className="codicon codicon-warning compact-dropdown-warn" title={typeof props.warning === 'string' ? props.warning : ''} />}
{props.available.length > 1 && <span className="fa-solid fa-angle-down compact-dropdown-caret" />}
Comment thread
arneschmid marked this conversation as resolved.
Expand Down
9 changes: 6 additions & 3 deletions src/views/common/components/file-path-picker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ describe('FileLocationPicker', () => {
openFilePicker={mockOpenFilePicker}
/>);
});
const browseBtn = container.querySelector('.file-location-picker vscode-button') as HTMLButtonElement;
const browseBtn = container.querySelector('.file-location-picker button') as HTMLButtonElement;

expect(mockOpenFilePicker).toHaveBeenCalledTimes(0);

React.act(() => {
browseBtn!.click();
if (!browseBtn) {
throw new Error('Browse button not found. Check the selector or component rendering.');
}
browseBtn.click();
});

expect(mockOpenFilePicker).toHaveBeenCalledTimes(1);
Expand All @@ -76,6 +79,6 @@ describe('FileLocationPicker', () => {
simulateChangeEvent(inputBox, 'my-location');

expect(dispatch).toHaveBeenCalledTimes(1);
expect(dispatch).toHaveBeenCalledWith({ type: 'SET_SOLUTION_LOCATION' , solutionLocation: 'my-location' });
expect(dispatch).toHaveBeenCalledWith({ type: 'SET_SOLUTION_LOCATION', solutionLocation: 'my-location' });
});
});
7 changes: 4 additions & 3 deletions src/views/common/components/file-path-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import './file-path-picker.css';
import * as React from 'react';
import { VSCodeButton } from '@vscode/webview-ui-toolkit/react';
import { CreateSolutionAction } from '../../create-solutions/view/state/reducer';
import { Button } from 'antd';

export interface FileLocationPickerProps {
disabled: boolean;
Expand All @@ -41,12 +41,13 @@ export const FileLocationPicker = ({ id, disabled, location, dispatch, openFileP
})}
value={location}
disabled={disabled} />
<VSCodeButton
<Button
title='Browse'
disabled={disabled}
style={{ height: 'var(--arm-input-height)' }}
onClick={() => openFilePicker()}
>
Browse
</VSCodeButton>
</Button>
</div>
);
8 changes: 0 additions & 8 deletions src/views/config-wizard/confwiz-webview-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,6 @@ export class ConfWizWebview implements vscode.CustomTextEditorProvider {
}

protected _getWebviewContent(webview: vscode.Webview, extensionUri: vscode.Uri): string {
const toolkitUri = webview.asWebviewUri(vscode.Uri.joinPath(
extensionUri,
'dist',
'views',
'toolkit.min.js'
));

const mainUri = webview.asWebviewUri(vscode.Uri.joinPath(
extensionUri,
'dist',
Expand Down Expand Up @@ -194,7 +187,6 @@ export class ConfWizWebview implements vscode.CustomTextEditorProvider {
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='Content-Security-Policy' content="default-src 'none'; script-src ${cspSource}; style-src ${cspSource} 'unsafe-inline'; font-src ${cspSource};">
<script type='module' src='${toolkitUri}'></script>
<script type='module' src='${mainUri}'></script>
<link rel='preload' as='style' href='${fontAwesomeUri}' >
<link rel='preload' as='style' href='${fontAwesomeStyleUri}' >
Expand Down
47 changes: 22 additions & 25 deletions src/views/config-wizard/confwiz-webview-view-component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ import {

const sendNotificationMock = jest.fn();
const notificationHandlers = new Map<string, (data: unknown) => void>();
const mockVsCodeApi = {
postMessage: jest.fn(),
setState: jest.fn(),
getState: jest.fn(),
};
const acquireVsCodeApiMock = jest.fn(() => mockVsCodeApi);

const getNotificationKey = (type: unknown): string => {
if (typeof type === 'string') {
Expand All @@ -42,13 +48,6 @@ const getNotificationKey = (type: unknown): string => {
return String(type);
};

// Mock acquireVsCodeApi
global.acquireVsCodeApi = jest.fn(() => ({
postMessage: jest.fn(),
setState: jest.fn(),
getState: jest.fn(),
}));

jest.mock('vscode-messenger-webview', () => ({
Messenger: jest.fn().mockImplementation(() => ({
start: jest.fn(),
Expand All @@ -59,22 +58,11 @@ jest.mock('vscode-messenger-webview', () => ({
}))
}));

jest.mock('@vscode/webview-ui-toolkit/react', () => ({
VSCodeTextField: ({ children: _children, ...props }: React.InputHTMLAttributes<HTMLInputElement>) => (
<input role="textbox" {...props} />
),
VSCodeCheckbox: ({ onChange, onClick, ...props }: React.InputHTMLAttributes<HTMLInputElement>) => (
<input type="checkbox" onChange={onChange ?? (() => undefined)} onClick={onClick} {...props} />
),
VSCodeDropdown: (props: React.SelectHTMLAttributes<HTMLSelectElement>) => <select {...props} />,
VSCodeOption: (props: React.OptionHTMLAttributes<HTMLOptionElement>) => <option {...props} />,
}));

jest.mock('primereact/treetable', () => ({
TreeTable: ({ value, header, children }: { value: unknown[]; header: React.ReactNode; children: React.ReactNode }) => {
const columns = React.Children.toArray(children) as React.ReactElement[];
return (
<div>
<>
{header}
{value?.map((node: unknown, index: number) => (
<div key={index} data-testid={`row-${index}`}>
Expand All @@ -83,7 +71,7 @@ jest.mock('primereact/treetable', () => ({
))}
</div>
))}
</div>
</>
);
},
}));
Expand Down Expand Up @@ -130,10 +118,19 @@ const makeRoot = (children: TreeNodeElement[]): TreeNodeElement => ({

describe('ConfWiz functional component', () => {
beforeEach(() => {
(globalThis as { acquireVsCodeApi?: () => unknown }).acquireVsCodeApi = acquireVsCodeApiMock;
acquireVsCodeApiMock.mockClear();
sendNotificationMock.mockClear();
mockVsCodeApi.postMessage.mockClear();
mockVsCodeApi.setState.mockClear();
mockVsCodeApi.getState.mockClear();
notificationHandlers.clear();
});

afterEach(() => {
delete (globalThis as { acquireVsCodeApi?: () => unknown }).acquireVsCodeApi;
});

it('marks dirty on first edit and saves on blur', () => {
const editElement: TreeNodeElement = {
guiId: 1,
Expand Down Expand Up @@ -175,8 +172,8 @@ describe('ConfWiz functional component', () => {
render(<ConfWiz />);
emitWizardData({ element: makeRoot([checkboxElement]), documentPath: 'test.c', noAnnotationsFound: false });

const checkbox = document.querySelector('input[type="checkbox"]') as HTMLInputElement;
expect(checkbox.className).toContain('checkbox-inconsistent');
const checkbox = document.querySelector('input[type="checkbox"]')?.parentElement as HTMLInputElement;
expect(checkbox.parentElement?.className).toContain('checkbox-inconsistent');
expect(checkbox.getAttribute('title')).toContain('Inconsistent comment state detected');
expect(checkbox.getAttribute('title')).toContain('Original tooltip info');
});
Expand Down Expand Up @@ -270,8 +267,8 @@ describe('ConfWiz dropdown overflow tooltips', () => {
const { getByRole } = render(confWiz.getCreateCombobox(element));
const dropdown = getByRole('combobox') as HTMLSelectElement;

expect(dropdown.title).toBe("Value '256' overflows 8 bits");
expect(dropdown.className).toContain('dropdown-invalid');
expect(dropdown.title).toBe('Value \'256\' overflows 8 bits');
expect(dropdown.className).toContain('compact-dropdown-trigger');
});

it('should show not-in-list tooltip when value is missing and no overflow', () => {
Expand All @@ -295,6 +292,6 @@ describe('ConfWiz dropdown overflow tooltips', () => {
const dropdown = getByRole('combobox') as HTMLSelectElement;

expect(dropdown.title).toBe("Value '0' is not in the list");
expect(dropdown.className).toContain('dropdown-invalid');
expect(dropdown.className).toContain('compact-dropdown-trigger');
});
});
Loading
Loading