1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-12 09:04:14 +02:00

[GH-132] - Add snapshot test for propertyMenu component to cover the rest of the scenarios

This commit is contained in:
Renjith 2021-03-20 19:42:19 -05:00
parent 5609d9e9ce
commit 21924107dd
2 changed files with 243 additions and 0 deletions

View File

@ -0,0 +1,225 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`widgets/PropertyMenu should match snapshot 1`] = `
<div>
<div
class="Menu noselect bottom"
>
<div
class="menu-contents"
>
<div
class="menu-options"
>
<input
class="PropertyMenu menu-textbox"
type="text"
value="test-property"
/>
<div
class="MenuOption SubMenuOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Type: Text
</div>
<svg
class="SubmenuTriangleIcon Icon"
viewBox="0 0 100 100"
xmlns="http://www.w3.org/2000/svg"
>
<polygon
points="50,35 75,50 50,65"
/>
</svg>
<div
class="SubMenu Menu noselect bottom"
>
<div
class="menu-contents"
>
<div
class="menu-options"
>
<div
class="MenuOption LabelOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
<b>
Change property type
</b>
</div>
<div
class="noicon"
/>
</div>
<div
class="MenuOption MenuSeparator menu-separator"
/>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Text
</div>
<div
class="noicon"
/>
</div>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Number
</div>
<div
class="noicon"
/>
</div>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Email
</div>
<div
class="noicon"
/>
</div>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Select
</div>
<div
class="noicon"
/>
</div>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Created Time
</div>
<div
class="noicon"
/>
</div>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Updated Time
</div>
<div
class="noicon"
/>
</div>
</div>
<div
class="menu-spacer hideOnWidescreen"
/>
<div
class="menu-options hideOnWidescreen"
>
<div
class="MenuOption TextOption menu-option menu-cancel"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Cancel
</div>
<div
class="noicon"
/>
</div>
</div>
</div>
</div>
</div>
<div
class="MenuOption TextOption menu-option"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Delete
</div>
<div
class="noicon"
/>
</div>
</div>
<div
class="menu-spacer hideOnWidescreen"
/>
<div
class="menu-options hideOnWidescreen"
>
<div
class="MenuOption TextOption menu-option menu-cancel"
>
<div
class="noicon"
/>
<div
class="menu-name"
>
Cancel
</div>
<div
class="noicon"
/>
</div>
</div>
</div>
</div>
</div>
`;

View File

@ -87,4 +87,22 @@ describe('widgets/PropertyMenu', () => {
fireEvent.click(getByText('Select'))
expect(callback).toHaveBeenCalledWith('select')
})
test('should match snapshot', () => {
const callback = jest.fn()
const component = wrapIntl(
<PropertyMenu
propertyId={'id'}
propertyName={'test-property'}
propertyType={'text'}
onTypeChanged={callback}
onNameChanged={callback}
onDelete={callback}
/>,
)
const {container, getByText} = render(component)
const menuOpen = getByText(/Type: Text/i)
fireEvent.click(menuOpen)
expect(container).toMatchSnapshot()
})
})