Skip to content

Commit 7591f6e

Browse files
chore(gallery-web): fix comments
1 parent 6b3120a commit 7591f6e

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

packages/pluggableWidgets/gallery-web/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
### Added
1010

11-
- We added a refresh intervel property, to allow defining an interval (in seconds) for refreshing the content in Gallery
11+
- We added a refresh interval property, to allow defining an interval (in seconds) for refreshing the content in Gallery
1212

1313
## [3.7.0] - 2025-11-11
1414

packages/pluggableWidgets/gallery-web/src/components/__tests__/Gallery.spec.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import { listAction, listExp, setupIntersectionObserverStub } from "@mendix/widget-plugin-test-utils";
1+
import { listAction, listExpression, setupIntersectionObserverStub } from "@mendix/widget-plugin-test-utils";
22
import "@testing-library/jest-dom";
33
import { render, waitFor } from "@testing-library/react";
44
import { ObjectItem } from "mendix";
5+
import { createElement } from "react";
56
import { ItemHelperBuilder } from "../../utils/builders/ItemHelperBuilder";
67
import { mockItemHelperWithAction, mockProps, setup, withGalleryContext } from "../../utils/test-utils";
78
import { Gallery } from "../Gallery";
89

10+
jest.mock("@mendix/widget-plugin-component-kit/RefreshIndicator", () => ({
11+
RefreshIndicator: (_props: any) => createElement("div", { "data-testid": "refresh-indicator" })
12+
}));
13+
914
describe("Gallery", () => {
1015
beforeAll(() => {
1116
setupIntersectionObserverStub();
@@ -24,6 +29,20 @@ describe("Gallery", () => {
2429

2530
expect(asFragment()).toMatchSnapshot();
2631
});
32+
33+
it("renders RefreshIndicator when `showRefreshIndicator` is true", () => {
34+
const base = mockProps();
35+
const props = { ...base, showRefreshIndicator: true };
36+
const { getByTestId } = render(withGalleryContext(<Gallery {...props} />));
37+
expect(getByTestId("refresh-indicator")).toBeInTheDocument();
38+
});
39+
40+
it("does not render RefreshIndicator when `showRefreshIndicator` is false", () => {
41+
const base = mockProps();
42+
const props = { ...base, showRefreshIndicator: false };
43+
const { queryByTestId } = render(withGalleryContext(<Gallery {...props} />));
44+
expect(queryByTestId("refresh-indicator")).toBeNull();
45+
});
2746
});
2847

2948
describe("with on click action", () => {
@@ -84,7 +103,9 @@ describe("Gallery", () => {
84103
withGalleryContext(
85104
<Gallery
86105
{...mockProps()}
87-
itemHelper={ItemHelperBuilder.sample(b => b.withItemClass(listExp(() => "custom-class")))}
106+
itemHelper={ItemHelperBuilder.sample(b =>
107+
b.withItemClass(listExpression(() => "custom-class"))
108+
)}
88109
/>
89110
)
90111
);

packages/pluggableWidgets/gallery-web/src/stores/GalleryStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class GalleryStore extends SetupHost {
9696
host: this._sortHost
9797
};
9898

99-
this.loaderCtrl = new DerivedLoaderController(this._query, spec.refreshIndicator, spec.refreshInterval > 1);
99+
this.loaderCtrl = new DerivedLoaderController(this._query, spec.refreshIndicator, spec.refreshInterval >= 1);
100100

101101
const useStorage = spec.storeFilters || spec.storeSort;
102102
if (useStorage) {

0 commit comments

Comments
 (0)