Skip to content

Commit a5aea96

Browse files
committed
fix some of the unit tests
1 parent 12c7d6e commit a5aea96

File tree

6 files changed

+19
-9
lines changed

6 files changed

+19
-9
lines changed

packages/compass-aggregations/src/components/aggregation-side-panel/stage-wizard-use-cases/lookup/lookup.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ export const LookupForm = ({
175175
/>
176176
</div>
177177
<div className={formGroup}>
178-
<Body id="lookup-stage-as-input-label" className={titleStyles}>
178+
<Body
179+
aria-label="Name of the array"
180+
id="lookup-stage-as-input-label"
181+
className={titleStyles}
182+
>
179183
as
180184
</Body>
181185
<div className={inputFieldStyles}>

packages/compass-aggregations/src/components/aggregation-side-panel/stage-wizard-use-cases/project/project.spec.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ describe('project', function () {
7272
'street',
7373
'city',
7474
]);
75-
const selectedOptions = within(
75+
const comboboxInput = within(
7676
screen.getByTestId('project-form-field')
77-
).getAllByRole('option');
77+
).getByRole('combobox');
78+
const selectedOptions = within(comboboxInput).getAllByRole('option');
7879

7980
expect(selectedOptions).to.have.lengthOf(2);
8081
expect(within(selectedOptions[0]).getByText(/street/i)).to.exist;

packages/compass-components/src/components/tab-nav-bar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function TabNavBar({
8181
key={`tab-${idx}`}
8282
data-testid={`${name}-tab-button`}
8383
name={title}
84+
// LG uses this prop to check if multiple tabs have same text and
85+
// if so, it console.errors.
86+
data-text={name}
8487
/>
8588
);
8689
})}

packages/compass-global-writes/src/components/create-shard-key-form.spec.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ describe('CreateShardKeyForm', function () {
4444
});
4545

4646
it('renders location form field as disabled', function () {
47-
expect(screen.getByLabelText('First shard key field')).to.have.attribute(
48-
'aria-disabled',
49-
'true'
50-
);
47+
expect(
48+
screen.getByRole('textbox', {
49+
name: /first shard key field/i,
50+
})
51+
).to.have.attribute('aria-disabled', 'true');
5152
});
5253

5354
it('does not allow user to submit when no second shard key is selected', function () {

packages/connection-form/src/components/advanced-options-tabs/tls-ssl-tab/tls-ssl-tab.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ describe('SchemaInput', function () {
326326

327327
it('should render all of the checkboxes disabled', function () {
328328
const checkboxes: HTMLInputElement[] = screen.getAllByRole('checkbox');
329-
expect(checkboxes.find((checkbox) => !checkbox.disabled)).to.equal(
329+
expect(checkboxes.find((checkbox) => !checkbox.ariaDisabled)).to.equal(
330330
undefined
331331
);
332332
});

packages/connection-form/src/components/connection-string-input.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ describe('ConnectionStringInput Component', function () {
215215

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

221222
describe('clicking confirm to edit', function () {

0 commit comments

Comments
 (0)