diff --git a/packages/main/__karma_snapshots__/ObjectPage.md b/packages/main/__karma_snapshots__/ObjectPage.md index 6bb870130b4..f5e26c6bd61 100644 --- a/packages/main/__karma_snapshots__/ObjectPage.md +++ b/packages/main/__karma_snapshots__/ObjectPage.md @@ -677,7 +677,66 @@

Test
``` -#### `Not crashing with 1 section` +#### `Not crashing with 1 section - Default Mode` + +``` + + + + +
+ +
+
+ +

+ + + +

+
+
+
+
+
+
+ +
  • + + + + + + + +
  • +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + Test +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +``` + +#### `Not crashing with 1 section - IconTabBar Mode` ``` @@ -891,3 +950,56 @@ ``` +#### `Not crashing with 1 section` + +``` + + + + +
    + +
    +
    + +

    + + + +

    +
    +
    +
    +
    +
    +
    + +
  • + +
  • +
    +
    + +
    + +
    +
    +
    +
    +
    +
    + Test +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +``` + diff --git a/packages/main/src/components/ObjectPage/ObjectPage.karma.tsx b/packages/main/src/components/ObjectPage/ObjectPage.karma.tsx index 15b14563bae..bd4b79d8440 100644 --- a/packages/main/src/components/ObjectPage/ObjectPage.karma.tsx +++ b/packages/main/src/components/ObjectPage/ObjectPage.karma.tsx @@ -108,7 +108,17 @@ describe('ObjectPage', () => { expect(wrapper.html()).to.matchSnapshot(); }); - it('Not crashing with 1 section', () => { + it('Not crashing with 1 section - Default Mode', () => { + const wrapper = mountThemedComponent( + + Test + + ); + + expect(wrapper.debug()).to.matchSnapshot(); + }); + + it('Not crashing with 1 section - IconTabBar Mode', () => { const wrapper = mountThemedComponent( Test diff --git a/packages/main/src/components/ObjectPage/index.tsx b/packages/main/src/components/ObjectPage/index.tsx index 65db94075b0..5cf56fe6074 100644 --- a/packages/main/src/components/ObjectPage/index.tsx +++ b/packages/main/src/components/ObjectPage/index.tsx @@ -168,7 +168,8 @@ const ObjectPage: FC = forwardRef((props: ObjectPagePropTyp useEffect(() => { if (mode === ObjectPageMode.Default) { - scrollToSectionById(children[selectedSectionIndex].props.id, selectedSectionIndex); + // @ts-ignore + scrollToSectionById(Children.toArray(children)[selectedSectionIndex].props.id, selectedSectionIndex); } if (mode === ObjectPageMode.IconTabBar) { adjustDummyDivHeight();