From 3b4f64cd1600b8c1b0f8c45ebd22a44b5101f6af Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Wed, 21 Dec 2022 16:11:20 +0100 Subject: [PATCH] Revert "Snap in PiP widget when content changed (#9797)" This reverts commit be1e5753677bdf84b3657994dc5ad20d250038bd. --- .../views/voip/PictureInPictureDragger.tsx | 4 -- .../voip/PictureInPictureDragger-test.tsx | 69 ------------------- .../PictureInPictureDragger-test.tsx.snap | 39 ----------- 3 files changed, 112 deletions(-) delete mode 100644 test/components/views/voip/PictureInPictureDragger-test.tsx delete mode 100644 test/components/views/voip/__snapshots__/PictureInPictureDragger-test.tsx.snap diff --git a/src/components/views/voip/PictureInPictureDragger.tsx b/src/components/views/voip/PictureInPictureDragger.tsx index 58a7a564937..aa47a4c7f9c 100644 --- a/src/components/views/voip/PictureInPictureDragger.tsx +++ b/src/components/views/voip/PictureInPictureDragger.tsx @@ -85,10 +85,6 @@ export default class PictureInPictureDragger extends React.Component { UIStore.instance.off(UI_EVENTS.Resize, this.onResize); } - public componentDidUpdate(prevProps: Readonly): void { - if (prevProps.children !== this.props.children) this.snap(true); - } - private animationCallback = () => { if ( !this.moving && diff --git a/test/components/views/voip/PictureInPictureDragger-test.tsx b/test/components/views/voip/PictureInPictureDragger-test.tsx deleted file mode 100644 index 138f0257eb4..00000000000 --- a/test/components/views/voip/PictureInPictureDragger-test.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2022 The Matrix.org Foundation C.I.C. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from "react"; -import { render, RenderResult } from "@testing-library/react"; - -import PictureInPictureDragger, { - CreatePipChildren, -} from "../../../../src/components/views/voip/PictureInPictureDragger"; - -describe("PictureInPictureDragger", () => { - let renderResult: RenderResult; - - const mkContent1: CreatePipChildren = () => { - return
content 1
; - }; - - const mkContent2: CreatePipChildren = () => { - return ( -
- content 2
- content 2.2 -
- ); - }; - - describe("when rendering the dragger with PiP content 1", () => { - beforeEach(() => { - renderResult = render({mkContent1}); - }); - - it("should render the PiP content", () => { - expect(renderResult.container).toMatchSnapshot("pip-content-1"); - }); - - describe("and rerendering PiP content 1", () => { - beforeEach(() => { - renderResult.rerender({mkContent1}); - }); - - it("should not change the PiP content", () => { - expect(renderResult.container).toMatchSnapshot("pip-content-1"); - }); - }); - - describe("and rendering PiP content 2", () => { - beforeEach(() => { - renderResult.rerender({mkContent2}); - }); - - it("should update the PiP content", () => { - expect(renderResult.container).toMatchSnapshot(); - }); - }); - }); -}); diff --git a/test/components/views/voip/__snapshots__/PictureInPictureDragger-test.tsx.snap b/test/components/views/voip/__snapshots__/PictureInPictureDragger-test.tsx.snap deleted file mode 100644 index 7996519485c..00000000000 --- a/test/components/views/voip/__snapshots__/PictureInPictureDragger-test.tsx.snap +++ /dev/null @@ -1,39 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PictureInPictureDragger when rendering the dragger with PiP content 1 and rendering PiP content 2 should update the PiP content 1`] = ` -
- -
-`; - -exports[`PictureInPictureDragger when rendering the dragger with PiP content 1 and rerendering PiP content 1 should not change the PiP content: pip-content-1 1`] = ` -
- -
-`; - -exports[`PictureInPictureDragger when rendering the dragger with PiP content 1 should render the PiP content: pip-content-1 1`] = ` -
- -
-`;