Skip to content

Commit

Permalink
Lint and test fixing for react-components
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
  • Loading branch information
aaronchongth committed Dec 6, 2023
1 parent 4e8cb2d commit f85a686
Show file tree
Hide file tree
Showing 20 changed files with 736 additions and 198 deletions.
2 changes: 1 addition & 1 deletion packages/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"debug": "^4.3.4",
"eventemitter3": "^5.0.1",
"keycloak-js": "^23.0.1",
"node-vibrant": "3.2.1-alpha.1",
"node-vibrant": "3.1.6",
"react": "^18.2.0",
"react-components": "workspace:*",
"react-customizable-progressbar": "^1.2.0",
Expand Down
13 changes: 2 additions & 11 deletions packages/dashboard/src/components/trajectories-overlay.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
import { Trajectory } from 'react-components';
import { TrajectoryMarkerProps } from 'react-components';

export interface TrajectoryData {
trajectory: Trajectory;
color: string;
conflict?: boolean;
loopAnimation?: boolean;
/**
* default: 1
*/
animationScale?: number;
}
export type TrajectoryData = TrajectoryMarkerProps;
6 changes: 4 additions & 2 deletions packages/react-components/lib/form-inputs.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ describe('PositiveIntField', () => {
it('does not allow negative numbers to be typed', async () => {
const root = render(<PositiveIntField id="test" label="test" />);
const inputEl = root.getByLabelText('test') as HTMLInputElement;
userEvent.clear(inputEl);
userEvent.type(inputEl, '-1');
const user = userEvent.setup();
user.clear(inputEl);
expect(inputEl.value).toBe('');
await user.type(inputEl, '-1');
// '-' char should get "eaten", so should end up with "1".
expect(inputEl.value).toBe('1');
});
Expand Down
1 change: 0 additions & 1 deletion packages/react-components/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export * from './map';
export * from './navigation-bar';
export * from './place';
export * from './robots';
export * from './simple-filter';
export * from './simple-info';
export * from './spotlight-accordion';
export * from './stack-navigator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Lift request form', () => {
const mockOnClose = jasmine.createSpy();
const lift = makeLift();
const liftState = makeLiftState();
render(
const root = render(
<LiftRequestDialog
currentLevel={liftState.current_floor}
availableLevels={lift.levels}
Expand All @@ -20,8 +20,11 @@ describe('Lift request form', () => {
onClose={mockOnClose}
/>,
);
userEvent.type(screen.getByPlaceholderText('Pick a Destination'), '{selectall}{backspace}');
const inputEl = root.getByLabelText('Pick a Destination') as HTMLInputElement;
const user = userEvent.setup();
user.clear(inputEl);
expect(inputEl.value).toBe('');
fireEvent.click(screen.getByText('Request'));
expect(screen.getByText('Destination cannot be empty')).toBeTruthy();
expect(root.getByText('Destination cannot be empty')).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions packages/react-components/lib/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './lift-marker';
export * from './utils';
export * from './three-fiber';
export * from './trajectory';
export * from './trajectory-marker';
Loading

0 comments on commit f85a686

Please sign in to comment.