This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See License.txt for license information. | ||
|
||
import React from 'react'; | ||
|
||
import {shallow} from 'enzyme'; | ||
import {Modal} from 'react-bootstrap'; | ||
|
||
import GetLinkModal from 'components/get_link_modal.jsx'; | ||
|
||
describe('components/GetLinkModal', () => { | ||
test('should match snapshot when all props is set', () => { | ||
function emptyFunction() {} //eslint-disable-line no-empty-function | ||
|
||
const wrapper = shallow( | ||
<GetLinkModal | ||
show={true} | ||
onHide={emptyFunction} | ||
title={'title'} | ||
helpText={'help text'} | ||
link={'https://mattermost.com'} | ||
/> | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
test('should match snapshot when helpText is not set', () => { | ||
function emptyFunction() {} //eslint-disable-line no-empty-function | ||
|
||
const wrapper = shallow( | ||
<GetLinkModal | ||
show={true} | ||
onHide={emptyFunction} | ||
title={'title'} | ||
link={'https://mattermost.com'} | ||
/> | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
test('should have called onHide', () => { | ||
const onHide = jest.fn(); | ||
|
||
const wrapper = shallow( | ||
<GetLinkModal | ||
show={true} | ||
onHide={onHide} | ||
title={'title'} | ||
link={'https://mattermost.com'} | ||
/> | ||
); | ||
|
||
wrapper.find(Modal).first().props().onHide(); | ||
expect(onHide).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters