18128: Fixes unit test due to behavior change.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 22 Nov 2021 14:17:12 +0000 (11:17 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 2 Dec 2021 23:01:57 +0000 (20:01 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/components/multi-panel-view/multi-panel-view.test.tsx

index 53a3bb6089f80324172f4f6d164cdc1833e4dc89..6cf13d78842fa0f1e385400fbb7ea70d90b357cc 100644 (file)
@@ -22,7 +22,7 @@ describe('<MPVContainer />', () => {
         };
     });
 
-    it('should show default toggle buttons for every child', () => {
+    it('should show default panel buttons for every child', () => {
         const childs = [
             <PanelMock key={1}>This is one panel</PanelMock>,
             <PanelMock key={2}>This is another panel</PanelMock>,
@@ -34,25 +34,27 @@ describe('<MPVContainer />', () => {
         expect(wrapper.html()).toContain('This is another panel');
     });
 
-    it('should toggle panel when clicking on its button', () => {
+    it('should show panel when clicking on its button', () => {
         const childs = [
             <PanelMock key={1}>This is one panel</PanelMock>,
         ];
-        const wrapper = mount(<MPVContainer {...props}>{[...childs]}</MPVContainer>);
+        props.panelStates = [
+            {name: 'Initially invisible Panel', visible: false},
+        ]
 
-        // Initial state: panel visible
-        expect(wrapper.html()).toContain('This is one panel');
+        const wrapper = mount(<MPVContainer {...props}>{[...childs]}</MPVContainer>);
 
-        // Panel toggling
-        wrapper.find(Button).simulate('click');
+        // Initial state: panel not visible
         expect(wrapper.html()).not.toContain('This is one panel');
         expect(wrapper.html()).toContain('All panels are hidden');
+
+        // Panel visible when clicking on its button
         wrapper.find(Button).simulate('click');
         expect(wrapper.html()).toContain('This is one panel');
         expect(wrapper.html()).not.toContain('All panels are hidden');
     });
 
-    it('should show custom toggle buttons when config provided', () => {
+    it('should show custom panel buttons when config provided', () => {
         const childs = [
             <PanelMock key={1}>This is one panel</PanelMock>,
             <PanelMock key={2}>This is another panel</PanelMock>,