Skip to content

Commit ede5ff1

Browse files
committed
feat: hide options after adding to index
1 parent 66250c4 commit ede5ff1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

elements/src/components/pos-make-findable/pos-make-findable.spec.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,17 @@ describe('pos-make-findable', () => {
237237
expect(options.length).toEqual(2);
238238
const indexButton = within(options[0]).getByRole('button');
239239
fireEvent.click(indexButton);
240+
await page.waitForChanges();
240241

241-
// then nothing is added to an index yet
242-
expect(mockOs.addToLabelIndex).toHaveBeenCalled();
242+
// then the thing is added to the index
243+
expect(mockOs.addToLabelIndex).toHaveBeenCalledWith(
244+
{ fake: 'thing' },
245+
{ uri: 'https://pod.example/first-index' },
246+
);
247+
248+
// and the options disappear
249+
const list = screen.queryByRole('listbox');
250+
expect(list).toBeNull();
243251
});
244252

245253
it('closes the options, if clicked elsewhere', async () => {

elements/src/components/pos-make-findable/pos-make-findable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class PosMakeFindable implements PodOsAware {
7676

7777
private async addToLabelIndex(index: LabelIndex) {
7878
await this.os.addToLabelIndex(this.thing, index);
79+
this.showOptions = false;
7980
}
8081

8182
render() {

0 commit comments

Comments
 (0)