summaryrefslogtreecommitdiff
path: root/web-ui/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/test/unit')
-rw-r--r--web-ui/test/unit/account_recovery/page.spec.js31
-rw-r--r--web-ui/test/unit/common/input_field/input_field.spec.js20
-rw-r--r--web-ui/test/unit/common/submit_button/submit_button.spec.js16
3 files changed, 52 insertions, 15 deletions
diff --git a/web-ui/test/unit/account_recovery/page.spec.js b/web-ui/test/unit/account_recovery/page.spec.js
index 590d1de8..6a139167 100644
--- a/web-ui/test/unit/account_recovery/page.spec.js
+++ b/web-ui/test/unit/account_recovery/page.spec.js
@@ -1,25 +1,26 @@
-import { shallow } from 'enzyme'
-import expect from 'expect'
-import React from 'react'
-import { Page } from 'src/account_recovery/page'
+import { shallow } from 'enzyme';
+import expect from 'expect';
+import React from 'react';
+import { Page } from 'src/account_recovery/page';
describe('Page', () => {
- let mockT, page
+ let mockT;
+ let page;
beforeEach(() => {
- mockT = (key) => (key)
- page = shallow(<Page t={mockT}/>)
- })
+ mockT = key => key;
+ page = shallow(<Page t={mockT} />);
+ });
it('renders backup email page title', () => {
- expect(page.find('h1').text()).toEqual('backup-account.title')
- })
+ expect(page.find('h1').text()).toEqual('backup-account.title');
+ });
it('renders backup account email input field', () => {
- expect(page.find('InputField').props().name).toEqual('email')
- })
+ expect(page.find('InputField').props().name).toEqual('email');
+ });
it('renders backup account submit button', () => {
- expect(page.find('SubmitButton').props().buttonText).toEqual('backup-account.button')
- })
-})
+ expect(page.find('SubmitButton').props().buttonText).toEqual('backup-account.button');
+ });
+});
diff --git a/web-ui/test/unit/common/input_field/input_field.spec.js b/web-ui/test/unit/common/input_field/input_field.spec.js
new file mode 100644
index 00000000..0c044ce1
--- /dev/null
+++ b/web-ui/test/unit/common/input_field/input_field.spec.js
@@ -0,0 +1,20 @@
+import { shallow } from 'enzyme';
+import expect from 'expect';
+import React from 'react';
+import InputField from 'src/common/input_field/input_field';
+
+describe('InputField', () => {
+ let inputField;
+
+ beforeEach(() => {
+ inputField = shallow(<InputField label='Email' name='email' />);
+ });
+
+ it('renders an input of type text for email', () => {
+ expect(inputField.find('input[type="text"]').props().name).toEqual('email');
+ });
+
+ it('renders a label for the email', () => {
+ expect(inputField.find('label').text()).toEqual('Email');
+ });
+});
diff --git a/web-ui/test/unit/common/submit_button/submit_button.spec.js b/web-ui/test/unit/common/submit_button/submit_button.spec.js
new file mode 100644
index 00000000..8279547c
--- /dev/null
+++ b/web-ui/test/unit/common/submit_button/submit_button.spec.js
@@ -0,0 +1,16 @@
+import { shallow } from 'enzyme';
+import expect from 'expect';
+import React from 'react';
+import SubmitButton from 'src/common/submit_button/submit_button';
+
+describe('SubmitButton', () => {
+ let submitButton;
+
+ beforeEach(() => {
+ submitButton = shallow(<SubmitButton buttonText='Add Email' />);
+ });
+
+ it('renders an input of type submit for add email', () => {
+ expect(submitButton.find('input[type="submit"]').props().value).toEqual('Add Email');
+ });
+});