Skip to content

Commit

Permalink
fix(atomic): fix grid result breadcrumbs (#3100)
Browse files Browse the repository at this point in the history
* Don't propagate event for ellipsis

https://coveord.atlassian.net/browse/KIT-2658

* Add UT for grid breadbox

https://coveord.atlassian.net/browse/KIT-2658
  • Loading branch information
dmbrooke authored Aug 10, 2023
1 parent 7b1eed3 commit 6fc30f4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
} from '../../../fixtures/test-fixture';
import * as CommonAssertions from '../../common-assertions';
import {
addGridResultList,
addResultList,
buildTemplateWithoutSections,
} from '../result-list-actions';
Expand Down Expand Up @@ -47,9 +48,7 @@ describe('Result Printable Uri Component', () => {
});

CommonAssertions.assertConsoleError();
CommonAssertions.assertRemovesComponent(() =>
cy.get(resultPrintableUriComponent)
);
CommonAssertions.assertRemovesComponent();
});

describe('when the "max-number-of-parts" prop is not a number', () => {
Expand All @@ -68,9 +67,7 @@ describe('Result Printable Uri Component', () => {
});

CommonAssertions.assertConsoleError();
CommonAssertions.assertRemovesComponent(
ResultPrintableUriSelectors.firstInResult
);
CommonAssertions.assertRemovesComponent();
});

describe('when the "max-number-of-parts" prop is less than 3', () => {
Expand All @@ -89,9 +86,7 @@ describe('Result Printable Uri Component', () => {
});

CommonAssertions.assertConsoleError();
CommonAssertions.assertRemovesComponent(() =>
cy.get(resultPrintableUriComponent)
);
CommonAssertions.assertRemovesComponent();
});

describe('when there is no "parents" property in the result object', () => {
Expand Down Expand Up @@ -128,7 +123,8 @@ describe('Result Printable Uri Component', () => {

describe('when there is a "parents" property in the result object and "max-number-of-parts" is 3', () => {
const addResultListWithPrintableUri =
(children?: HTMLElement[]) => (fixture: TestFixture) => {
(children?: HTMLElement[], grid = false) =>
(fixture: TestFixture) => {
const printableUriEl = generateComponentHTML(
resultPrintableUriComponent,
{
Expand All @@ -137,7 +133,9 @@ describe('Result Printable Uri Component', () => {
);
children?.forEach((slot) => printableUriEl.appendChild(slot));
fixture.with(
addResultList(buildTemplateWithoutSections([printableUriEl]))
grid
? addGridResultList(buildTemplateWithoutSections([printableUriEl]))
: addResultList(buildTemplateWithoutSections([printableUriEl]))
);
};

Expand Down Expand Up @@ -220,5 +218,24 @@ describe('Result Printable Uri Component', () => {
.should('have.attr', 'target', '_self');
});
});

describe('when rendered within a grid result', () => {
beforeEach(() => {
new TestFixture()
.with(addResultListWithPrintableUri(undefined, true))
.with(addUriParentsInResponse(4))
.init();
});

describe('after clicking on the ellipsis', () => {
beforeEach(() => {
ResultPrintableUriSelectors.ellipsisButton().click();
});

ResultPrintableUriAssertions.assertFocusLink(1);
ResultPrintableUriAssertions.assertDisplayEllipsis(false);
ResultPrintableUriAssertions.assertDisplayParentsCount(4);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class AtomicResultPrintableUri {
<button
aria-label={this.bindings.i18n.t('collapsed-uri-parts')}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
this.expandedPartFocus.focusOnNextTarget();
this.listExpanded = true;
}}
Expand Down

0 comments on commit 6fc30f4

Please sign in to comment.