Skip to content

Commit

Permalink
fix some of the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mabaasit committed Dec 11, 2024
1 parent 12c7d6e commit a5aea96
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ export const LookupForm = ({
/>
</div>
<div className={formGroup}>
<Body id="lookup-stage-as-input-label" className={titleStyles}>
<Body
aria-label="Name of the array"
id="lookup-stage-as-input-label"
className={titleStyles}
>
as
</Body>
<div className={inputFieldStyles}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ describe('project', function () {
'street',
'city',
]);
const selectedOptions = within(
const comboboxInput = within(
screen.getByTestId('project-form-field')
).getAllByRole('option');
).getByRole('combobox');
const selectedOptions = within(comboboxInput).getAllByRole('option');

expect(selectedOptions).to.have.lengthOf(2);
expect(within(selectedOptions[0]).getByText(/street/i)).to.exist;
Expand Down
3 changes: 3 additions & 0 deletions packages/compass-components/src/components/tab-nav-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ function TabNavBar({
key={`tab-${idx}`}
data-testid={`${name}-tab-button`}
name={title}
// LG uses this prop to check if multiple tabs have same text and
// if so, it console.errors.
data-text={name}
/>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ describe('CreateShardKeyForm', function () {
});

it('renders location form field as disabled', function () {
expect(screen.getByLabelText('First shard key field')).to.have.attribute(
'aria-disabled',
'true'
);
expect(
screen.getByRole('textbox', {
name: /first shard key field/i,
})
).to.have.attribute('aria-disabled', 'true');
});

it('does not allow user to submit when no second shard key is selected', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ describe('SchemaInput', function () {

it('should render all of the checkboxes disabled', function () {
const checkboxes: HTMLInputElement[] = screen.getAllByRole('checkbox');
expect(checkboxes.find((checkbox) => !checkbox.disabled)).to.equal(
expect(checkboxes.find((checkbox) => !checkbox.ariaDisabled)).to.equal(
undefined
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ describe('ConnectionStringInput Component', function () {

it('should show the connection string input disabled', function () {
const textArea = screen.getByRole('textbox');
expect(textArea).to.match('[disabled]');
expect(textArea).to.match('[aria-disabled="true"]');
expect(textArea).to.match('[readonly]');
});

describe('clicking confirm to edit', function () {
Expand Down

0 comments on commit a5aea96

Please sign in to comment.