Skip to content

Commit

Permalink
Added some tests for new button
Browse files Browse the repository at this point in the history
  • Loading branch information
nsharma123 committed Dec 24, 2024
1 parent 46e98dc commit 48ae3a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ export class AppRoot extends LitElement {
}

/**
* Handler for when the dev panel's "Enable manage mode" checkbox is search enabled.
* Handler when the dev panel's "Enable manage mode -> Search" checkbox is changed.
*/
private SearchManageModeCheckboxChanged(e: Event) {
const target = e.target as HTMLInputElement;
Expand Down
4 changes: 2 additions & 2 deletions src/manage/manage-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class ManageBar extends LitElement {
@property({ type: String }) label = msg('Select items to remove');

/**
* The label displayed in front of the management buttons
* Specifies the context in which the collection browser is being used
*/
@property({ type: String }) pageContext = '';
@property({ type: String }) pageContext?: string;

/**
* Whether to show the "Select All" button (default false)
Expand Down
12 changes: 12 additions & 0 deletions test/manage/manage-bar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ describe('Manage bar', () => {
expect(el.shadowRoot?.querySelector('.unselect-all-btn')).not.to.exist;
});

it('does not render item manager button except /search/ page', async () => {
const el = await fixture<ManageBar>(html`<manage-bar></manage-bar>`);
expect(el.shadowRoot?.querySelector('.ia-button.warning')).not.to.exist;
});

it('render item manager button for /search/ page', async () => {
const el = await fixture<ManageBar>(
html`<manage-bar .pageContext=${'search'}></manage-bar>`
);
expect(el.shadowRoot?.querySelector('.ia-button.warning')).to.exist;
});

it('includes Select All button when requested', async () => {
const el = await fixture<ManageBar>(
html`<manage-bar showSelectAll></manage-bar>`
Expand Down

0 comments on commit 48ae3a9

Please sign in to comment.