blob: ba228e61b4c8390d3210cdc046d9a34e5ab5aa98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import { shallow } from 'enzyme';
import expect from 'expect';
import React from 'react';
import { Logout } from 'src/common/logout/logout';
describe('Logout', () => {
let logout;
beforeEach(() => {
const mockTranslations = key => key;
logout = shallow(<Logout t={mockTranslations} fontIconClass='fa fa-sign-out' />);
});
it('renders the logout container', () => {
expect(logout.find('div.logout-container')).toExist();
});
describe('logout form', () => {
let logoutForm;
beforeEach(() => {
logoutForm = logout.find('form#logout-form');
});
it('renders logout form', () => {
expect(logoutForm).toExist();
});
it('renders logout form with POST method', () => {
expect(logoutForm.props().method).toEqual('POST');
});
it('renders logout form with action as logout', () => {
expect(logoutForm.props().action).toEqual('logout');
});
it('renders csrf hidden input', () => {
expect(logoutForm.find('input[name="csrftoken"]')).toExist();
});
it('renders SubmitFlatButton for logout', () => {
expect(logoutForm.find('SubmitFlatButton').props().buttonText).toEqual('logout');
});
it('renders SubmitFlatButton for logout with fontIcon', () => {
expect(logoutForm.find('SubmitFlatButton').props().fontIconClass).toEqual('fa fa-sign-out');
});
});
});
|