Skip to content

Commit 7c8aab8

Browse files
committed
chore(data-modeling): adjust tests
1 parent 8e307ab commit 7c8aab8

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

packages/compass-components/src/components/drawer-portal.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,19 @@ const drawerLayoutFixesStyles = css({
147147
marginTop: -1, // hiding the top border as we already have one in the place where the Anchor is currently rendered
148148
},
149149

150-
// Doing our best to target the section title here, leafygreen really doesn't
151-
// give us anything else to try. We're stretching the title container to all
152-
// available width so that we can layout the controls there better
153-
'& > div:nth-child(2) div:has(> strong)': {
154-
flex: 1,
155-
maxWidth: 'calc(100% - 28px)', // disallow going over the title size (100 - close button width)
156-
overflow: 'hidden',
157-
},
150+
// We're stretching the title container to all available width so that we can
151+
// layout the controls there better. Doing our best to target the section
152+
// title here, leafygreen really doesn't give us anything else to try.
153+
//
154+
// TODO(ticket): This is obviously a horrible selector and we should make sure
155+
// that LG team provides a better one for us to achieve this behavior when
156+
// we're removing the vendored version of the drawer
157+
'& > div:nth-child(2) > div:nth-child(2) > div:first-child > div:first-child > div:first-child > div:first-child':
158+
{
159+
flex: 'none',
160+
width: 'calc(100% - 28px)', // disallow going over the title size (100 - close button width)
161+
overflow: 'hidden',
162+
},
158163
});
159164

160165
const emptyDrawerLayoutFixesStyles = css({

packages/compass-data-modeling/src/components/drawer/diagram-editor-side-panel.spec.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ describe('DiagramEditorSidePanel', function () {
7373
result.plugin.store.dispatch(selectCollection('flights.airlines'));
7474

7575
await waitFor(() => {
76-
const nameInput = screen.getByLabelText('Name');
77-
expect(nameInput).to.be.visible;
78-
expect(nameInput).to.have.value('flights.airlines');
76+
expect(screen.getByTitle('flights.airlines')).to.exist;
7977
});
8078

79+
const nameInput = screen.getByLabelText('Name');
80+
expect(nameInput).to.be.visible;
81+
expect(nameInput).to.have.value('flights.airlines');
82+
8183
userEvent.click(screen.getByRole('textbox', { name: 'Notes' }));
8284
userEvent.type(
8385
screen.getByRole('textbox', { name: 'Notes' }),
@@ -104,8 +106,8 @@ describe('DiagramEditorSidePanel', function () {
104106
);
105107

106108
await waitFor(() => {
107-
const section = screen.getByText('Relationship properties');
108-
expect(section).to.be.visible;
109+
expect(screen.getByTitle('countries.name → airports.Country')).to.be
110+
.visible;
109111
});
110112

111113
const localCollectionInput = screen.getByLabelText('Local collection');

packages/compass-data-modeling/src/components/drawer/diagram-editor-side-panel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ function DiagramEditorSidePanel({
102102
// Because the close button here is out of our control, we have do
103103
// adjust the actions rendering in a bit of an unconventional way:
104104
// if there's more than one action available, collapse it to "...",
105-
// if it's just one, render the button
105+
// if it's just one, make sure button is not collapsed by setting
106+
// collapseAfter to >0
106107
collapseAfter={actions.length > 1 ? 0 : 1}
107108
></ItemActionControls>
108109
</div>

0 commit comments

Comments
 (0)