From 50d64627a924234ef5858b82bee8c9c33fb08f09 Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Tue, 4 Apr 2017 17:57:48 -0300 Subject: [#938] Adds backup account step to forgot password flow with @anikarni --- web-ui/app/locales/en_US/translation.json | 4 +++ web-ui/app/locales/pt_BR/translation.json | 4 +++ .../backup_account_step/backup_account_step.js | 35 ++++++++++++++++++++++ .../backup_account_step.spec.js | 17 +++++++++++ .../new_password_form/new_password_form.js | 4 ++- .../new_password_form/new_password_form.spec.js | 14 +++++++-- web-ui/src/account_recovery/page.js | 8 +++-- web-ui/src/account_recovery/page.spec.js | 28 +++++++++++++---- 8 files changed, 103 insertions(+), 11 deletions(-) create mode 100644 web-ui/src/account_recovery/backup_account_step/backup_account_step.js create mode 100644 web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js diff --git a/web-ui/app/locales/en_US/translation.json b/web-ui/app/locales/en_US/translation.json index 8607f590..4b27c9ef 100644 --- a/web-ui/app/locales/en_US/translation.json +++ b/web-ui/app/locales/en_US/translation.json @@ -103,6 +103,10 @@ "input-label1": "create new password", "input-label2": "confirm your new password" }, + "backup-account-step": { + "image-description": "Backup Account - Step 4 of 4", + "title": "Wait! What if you forget your password again?" + }, "button-next": "Next", "back": "Back to previous step" }, diff --git a/web-ui/app/locales/pt_BR/translation.json b/web-ui/app/locales/pt_BR/translation.json index c4b3d9e7..fe0711cb 100644 --- a/web-ui/app/locales/pt_BR/translation.json +++ b/web-ui/app/locales/pt_BR/translation.json @@ -103,6 +103,10 @@ "input-label1": "digite a nova senha", "input-label2": "confirme a nova senha" }, + "backup-account-step": { + "image-description": "E-mail de Recuperação - Passo 4 de 4", + "title": "Opa! E se você esquecer sua senha de novo?" + }, "button-next": "Próximo", "back": "Voltar ao passo anterior" }, diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js new file mode 100644 index 00000000..b4dcbaaf --- /dev/null +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2017 ThoughtWorks, Inc. + * + * Pixelated is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Pixelated is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Pixelated. If not, see . + */ +import React from "react"; +import {translate} from "react-i18next"; + +export const BackupAccountStep = ({ t }) => ( +
+ {t('account-recovery.backup-account-step.image-description')} +

{t('account-recovery.backup-account-step.title')}

+
+); + +BackupAccountStep.propTypes = { + t: React.PropTypes.func.isRequired +}; + +export default translate('', { wait: true })(BackupAccountStep); diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js new file mode 100644 index 00000000..3b27b369 --- /dev/null +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js @@ -0,0 +1,17 @@ +import { shallow } from 'enzyme'; +import expect from 'expect'; +import React from 'react'; +import { BackupAccountStep } from './backup_account_step'; + +describe('BackupAccountStep', () => { + let backupAccountStep; + + beforeEach(() => { + const mockTranslations = key => key; + backupAccountStep = shallow(); + }); + + it('renders title for backup account step', () => { + expect(backupAccountStep.find('h1').text()).toEqual('account-recovery.backup-account-step.title'); + }); +}); diff --git a/web-ui/src/account_recovery/new_password_form/new_password_form.js b/web-ui/src/account_recovery/new_password_form/new_password_form.js index 4c418900..e7f689e8 100644 --- a/web-ui/src/account_recovery/new_password_form/new_password_form.js +++ b/web-ui/src/account_recovery/new_password_form/new_password_form.js @@ -28,11 +28,12 @@ import './new_password_form.scss'; export class NewPasswordForm extends React.Component { submitHandler = (event) => { + event.preventDefault(); submitForm(event, '/account-recovery', { userCode: this.props.userCode, password: this.state.password, confirmation: this.state.confirmation - }); + }).then(() => this.props.next()); } handlePasswordChange = (event) => { @@ -72,6 +73,7 @@ export class NewPasswordForm extends React.Component { NewPasswordForm.propTypes = { t: React.PropTypes.func.isRequired, + next: React.PropTypes.func.isRequired, previous: React.PropTypes.func.isRequired, userCode: React.PropTypes.string.isRequired }; diff --git a/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js b/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js index 26b8651c..b57dd42e 100644 --- a/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js +++ b/web-ui/src/account_recovery/new_password_form/new_password_form.spec.js @@ -7,9 +7,11 @@ import { NewPasswordForm } from './new_password_form'; describe('NewPasswordForm', () => { let newPasswordForm; let mockPrevious; + let mockNext; + let mockTranslations; beforeEach(() => { - const mockTranslations = key => key; + mockTranslations = key => key; mockPrevious = expect.createSpy(); newPasswordForm = shallow( @@ -40,7 +42,11 @@ describe('NewPasswordForm', () => { }); describe('Submit', () => { - beforeEach(() => { + beforeEach((done) => { + mockNext = expect.createSpy().andCall(() => done()); + newPasswordForm = shallow( + + ); fetchMock.post('/account-recovery', 200); newPasswordForm.find('InputField[name="new-password"]').simulate('change', { target: { value: '123' } }); newPasswordForm.find('InputField[name="confirm-password"]').simulate('change', { target: { value: '456' } }); @@ -62,5 +68,9 @@ describe('NewPasswordForm', () => { it('sends password confirmation as content', () => { expect(fetchMock.lastOptions('/account-recovery').body).toContain('"confirmation":"456"'); }); + + it('calls next handler on success', () => { + expect(mockNext).toHaveBeenCalled(); + }); }); }); diff --git a/web-ui/src/account_recovery/page.js b/web-ui/src/account_recovery/page.js index 2d33e2fb..89441d26 100644 --- a/web-ui/src/account_recovery/page.js +++ b/web-ui/src/account_recovery/page.js @@ -22,6 +22,7 @@ import Header from 'src/common/header/header'; import AdminRecoveryCodeForm from 'src/account_recovery/admin_recovery_code_form/admin_recovery_code_form'; import UserRecoveryCodeForm from 'src/account_recovery/user_recovery_code_form/user_recovery_code_form'; import NewPasswordForm from 'src/account_recovery/new_password_form/new_password_form'; +import BackupAccountStep from 'src/account_recovery/backup_account_step/backup_account_step'; import Footer from 'src/common/footer/footer'; import 'font-awesome/scss/font-awesome.scss'; @@ -36,7 +37,9 @@ export class Page extends React.Component { } nextStep = (event) => { - event.preventDefault(); + if (event) { + event.preventDefault(); + } this.setState({ step: this.state.step + 1 }); } @@ -53,7 +56,8 @@ export class Page extends React.Component { 1: (), - 2: + 2: , + 3: }) mainContent = () => this.steps()[this.state.step]; diff --git a/web-ui/src/account_recovery/page.spec.js b/web-ui/src/account_recovery/page.spec.js index 31a748be..8e4ccc33 100644 --- a/web-ui/src/account_recovery/page.spec.js +++ b/web-ui/src/account_recovery/page.spec.js @@ -9,6 +9,7 @@ import Footer from 'src/common/footer/footer'; import AdminRecoveryCodeFormWrapper from './admin_recovery_code_form/admin_recovery_code_form'; import UserRecoveryCodeFormWrapper from './user_recovery_code_form/user_recovery_code_form'; import NewPasswordFormWrapper from './new_password_form/new_password_form'; +import BackupAccountStepWrapper from './backup_account_step/backup_account_step'; describe('Account Recovery Page', () => { let page; @@ -37,6 +38,13 @@ describe('Account Recovery Page', () => { expect(pageInstance.state.userCode).toEqual('123'); }); + it('prevents default event before next', () => { + const eventSpy = expect.createSpy(); + pageInstance.nextStep({ preventDefault: eventSpy }); + + expect(eventSpy).toHaveBeenCalled(); + }); + context('main content', () => { it('renders admin recovery code form as default form', () => { expect(page.find(AdminRecoveryCodeFormWrapper).length).toEqual(1); @@ -45,31 +53,39 @@ describe('Account Recovery Page', () => { }); it('renders user recovery code form when admin code submitted', () => { - pageInstance.nextStep({ preventDefault: () => {} }); + pageInstance.nextStep(); expect(page.find(UserRecoveryCodeFormWrapper).length).toEqual(1); }); it('returns to admin code form on user code form back link', () => { - pageInstance.nextStep({ preventDefault: () => {} }); + pageInstance.nextStep(); pageInstance.previousStep(); expect(page.find(AdminRecoveryCodeFormWrapper).length).toEqual(1); }); it('renders new password form when user code submitted', () => { - pageInstance.nextStep({ preventDefault: () => {} }); - pageInstance.nextStep({ preventDefault: () => {} }); + pageInstance.nextStep(); + pageInstance.nextStep(); expect(page.find(NewPasswordFormWrapper).length).toEqual(1); }); it('returns to user code form on new password form back link', () => { - pageInstance.nextStep({ preventDefault: () => {} }); - pageInstance.nextStep({ preventDefault: () => {} }); + pageInstance.nextStep(); + pageInstance.nextStep(); pageInstance.previousStep(); expect(page.find(UserRecoveryCodeFormWrapper).length).toEqual(1); }); + + it('renders backup account form after submitting new password', () => { + pageInstance.nextStep(); + pageInstance.nextStep(); + pageInstance.nextStep(); + + expect(page.find(BackupAccountStepWrapper).length).toEqual(1); + }); }); }); -- cgit v1.2.3 From 8c4b36a93e8e089186e0ffce5aecc97d3ce9e8bc Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Tue, 4 Apr 2017 18:27:19 -0300 Subject: [#938] Adds link to backup-account on the backup account step with @anikarni --- web-ui/app/locales/en_US/translation.json | 3 ++- web-ui/app/locales/pt_BR/translation.json | 3 ++- .../backup_account_step/backup_account_step.js | 6 ++++++ .../backup_account_step/backup_account_step.spec.js | 14 ++++++++++++++ web-ui/src/common/submit_button/submit_button.js | 3 ++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/web-ui/app/locales/en_US/translation.json b/web-ui/app/locales/en_US/translation.json index 4b27c9ef..160e71ff 100644 --- a/web-ui/app/locales/en_US/translation.json +++ b/web-ui/app/locales/en_US/translation.json @@ -105,7 +105,8 @@ }, "backup-account-step": { "image-description": "Backup Account - Step 4 of 4", - "title": "Wait! What if you forget your password again?" + "title": "Wait! What if you forget your password again?", + "buttonText": "Set-up Backup Account" }, "button-next": "Next", "back": "Back to previous step" diff --git a/web-ui/app/locales/pt_BR/translation.json b/web-ui/app/locales/pt_BR/translation.json index fe0711cb..b7cac507 100644 --- a/web-ui/app/locales/pt_BR/translation.json +++ b/web-ui/app/locales/pt_BR/translation.json @@ -105,7 +105,8 @@ }, "backup-account-step": { "image-description": "E-mail de Recuperação - Passo 4 de 4", - "title": "Opa! E se você esquecer sua senha de novo?" + "title": "Opa! E se você esquecer sua senha de novo?", + "buttonText": "Configurar E-mail de Recuperação" }, "button-next": "Próximo", "back": "Voltar ao passo anterior" diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js index b4dcbaaf..f2498a8a 100644 --- a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js @@ -16,6 +16,7 @@ */ import React from "react"; import {translate} from "react-i18next"; +import SubmitButton from 'src/common/submit_button/submit_button'; export const BackupAccountStep = ({ t }) => (
@@ -25,6 +26,11 @@ export const BackupAccountStep = ({ t }) => ( alt={t('account-recovery.backup-account-step.image-description')} />

{t('account-recovery.backup-account-step.title')}

+
); diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js index 3b27b369..561079c9 100644 --- a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js @@ -2,6 +2,7 @@ import { shallow } from 'enzyme'; import expect from 'expect'; import React from 'react'; import { BackupAccountStep } from './backup_account_step'; +import SubmitButton from 'src/common/submit_button/submit_button'; describe('BackupAccountStep', () => { let backupAccountStep; @@ -14,4 +15,17 @@ describe('BackupAccountStep', () => { it('renders title for backup account step', () => { expect(backupAccountStep.find('h1').text()).toEqual('account-recovery.backup-account-step.title'); }); + + it('renders submit button with given href', () => { + expect(backupAccountStep.find(SubmitButton).props().href).toEqual('/backup-account'); + }); + + it('renders submit button with given container element', () => { + expect(backupAccountStep.find(SubmitButton).props().containerElement).toEqual('a'); + }); + + it('renders submit button with given button text', () => { + expect(backupAccountStep.find(SubmitButton).props().buttonText) + .toEqual('account-recovery.backup-account-step.buttonText'); + }); }); diff --git a/web-ui/src/common/submit_button/submit_button.js b/web-ui/src/common/submit_button/submit_button.js index 1224c7bd..f77a5596 100644 --- a/web-ui/src/common/submit_button/submit_button.js +++ b/web-ui/src/common/submit_button/submit_button.js @@ -30,7 +30,7 @@ const buttonStyle = { height: '48px' }; -const SubmitButton = ({ buttonText, disabled = false }) => ( +const SubmitButton = ({ buttonText, disabled = false, ...other }) => (
( overlayStyle={buttonStyle} fullWidth primary + {...other} />
); -- cgit v1.2.3 From 3b3f28217a880afd8ec6d45ff57ccd41784847b3 Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Tue, 4 Apr 2017 18:35:50 -0300 Subject: [#938] Adds backup account step to test for missing translations with @anikarni --- web-ui/test/integration/translations.spec.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/web-ui/test/integration/translations.spec.js b/web-ui/test/integration/translations.spec.js index 6faa7483..9b5256ee 100644 --- a/web-ui/test/integration/translations.spec.js +++ b/web-ui/test/integration/translations.spec.js @@ -9,25 +9,36 @@ import testI18n from './i18n'; describe('Translations', () => { context('Account Recovery Page', () => { - it('translates all keys on first step', () => { + it('translates all keys on admin recovery code step', () => { const app = mount(} />); expect(app.text()).toNotContain('untranslated', 'Unstranslated message found in the text: ' + app.text()); }); - it('translates all keys on second step', () => { + it('translates all keys on user recovery code step', () => { const app = mount(} />); app.find('form.admin-code').simulate('submit'); expect(app.text()).toNotContain('untranslated', 'Unstranslated message found in the text: ' + app.text()); }); - it('translates all keys on third step', () => { + it('translates all keys on new password step', () => { const app = mount(} />); app.find('form.admin-code').simulate('submit'); app.find('form.user-code').simulate('submit'); expect(app.text()).toNotContain('untranslated', 'Unstranslated message found in the text: ' + app.text()); }); + + it('translates all keys on backup account step', () => { + const app = mount(} />); + app.find('form.admin-code').simulate('submit'); + app.find('form.user-code').simulate('submit'); + app.find('input[name="new-password"]').simulate('change', {target: {value: '11'}}); + app.find('input[name="confirm-password"]').simulate('change', {target: {value: '11'}}); + app.find('form.new-password').simulate('submit'); + + expect(app.text()).toNotContain('untranslated', 'Unstranslated message found in the text: ' + app.text()); + }); }); context('Backup Account Page', () => { -- cgit v1.2.3 From d8ade045a17be8de98ea2a501dbdb7ba166de094 Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Tue, 4 Apr 2017 18:36:14 -0300 Subject: [#938] Fixes lint errors with @anikarni --- .../backup_account_step/backup_account_step.js | 4 ++-- .../backup_account_step/backup_account_step.spec.js | 2 +- web-ui/src/account_recovery/page.js | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js index f2498a8a..e0c31d88 100644 --- a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js @@ -14,8 +14,8 @@ * You should have received a copy of the GNU Affero General Public License * along with Pixelated. If not, see . */ -import React from "react"; -import {translate} from "react-i18next"; +import React from 'react'; +import { translate } from 'react-i18next'; import SubmitButton from 'src/common/submit_button/submit_button'; export const BackupAccountStep = ({ t }) => ( diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js index 561079c9..1d08670d 100644 --- a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js @@ -1,8 +1,8 @@ import { shallow } from 'enzyme'; import expect from 'expect'; import React from 'react'; -import { BackupAccountStep } from './backup_account_step'; import SubmitButton from 'src/common/submit_button/submit_button'; +import { BackupAccountStep } from './backup_account_step'; describe('BackupAccountStep', () => { let backupAccountStep; diff --git a/web-ui/src/account_recovery/page.js b/web-ui/src/account_recovery/page.js index 89441d26..94927a16 100644 --- a/web-ui/src/account_recovery/page.js +++ b/web-ui/src/account_recovery/page.js @@ -53,10 +53,18 @@ export class Page extends React.Component { steps = () => ({ 0: , - 1: (), - 2: , + 1: + (), + 2: + (), 3: }) -- cgit v1.2.3 From 8198fa48d2e42d89457940590ec4b308ee541090 Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Wed, 5 Apr 2017 11:17:29 -0300 Subject: [#938] Replaces submit button with a link button for redirection with @anikarni --- .../backup_account_step/backup_account_step.js | 5 +- .../backup_account_step.spec.js | 10 ++-- web-ui/src/common/link_button/link_button.js | 55 ++++++++++++++++++++++ web-ui/src/common/link_button/link_button.scss | 21 +++++++++ web-ui/src/common/link_button/link_button.spec.js | 20 ++++++++ 5 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 web-ui/src/common/link_button/link_button.js create mode 100644 web-ui/src/common/link_button/link_button.scss create mode 100644 web-ui/src/common/link_button/link_button.spec.js diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js index e0c31d88..891b45ec 100644 --- a/web-ui/src/account_recovery/backup_account_step/backup_account_step.js +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.js @@ -16,7 +16,7 @@ */ import React from 'react'; import { translate } from 'react-i18next'; -import SubmitButton from 'src/common/submit_button/submit_button'; +import LinkButton from 'src/common/link_button/link_button'; export const BackupAccountStep = ({ t }) => (
@@ -26,9 +26,8 @@ export const BackupAccountStep = ({ t }) => ( alt={t('account-recovery.backup-account-step.image-description')} />

{t('account-recovery.backup-account-step.title')}

-
diff --git a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js index 1d08670d..38a5e560 100644 --- a/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js +++ b/web-ui/src/account_recovery/backup_account_step/backup_account_step.spec.js @@ -1,7 +1,7 @@ import { shallow } from 'enzyme'; import expect from 'expect'; import React from 'react'; -import SubmitButton from 'src/common/submit_button/submit_button'; +import LinkButton from 'src/common/link_button/link_button'; import { BackupAccountStep } from './backup_account_step'; describe('BackupAccountStep', () => { @@ -17,15 +17,11 @@ describe('BackupAccountStep', () => { }); it('renders submit button with given href', () => { - expect(backupAccountStep.find(SubmitButton).props().href).toEqual('/backup-account'); - }); - - it('renders submit button with given container element', () => { - expect(backupAccountStep.find(SubmitButton).props().containerElement).toEqual('a'); + expect(backupAccountStep.find(LinkButton).props().href).toEqual('/backup-account'); }); it('renders submit button with given button text', () => { - expect(backupAccountStep.find(SubmitButton).props().buttonText) + expect(backupAccountStep.find(LinkButton).props().buttonText) .toEqual('account-recovery.backup-account-step.buttonText'); }); }); diff --git a/web-ui/src/common/link_button/link_button.js b/web-ui/src/common/link_button/link_button.js new file mode 100644 index 00000000..e18903f2 --- /dev/null +++ b/web-ui/src/common/link_button/link_button.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2017 ThoughtWorks, Inc. + * + * Pixelated is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Pixelated is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Pixelated. If not, see . + */ + +import React from 'react'; +import RaisedButton from 'material-ui/RaisedButton'; + +import '../submit_button/submit_button.scss'; +import './link_button.scss'; + +const labelStyle = { + textTransform: 'none', + fontSize: '1em', + lineHeight: '48px', + color: '#ff9c00' +}; + +const buttonStyle = { + height: '48px', + backgroundColor: '#fff' +}; + +const LinkButton = ({ buttonText, href }) => ( +
+ +
+); + +LinkButton.propTypes = { + buttonText: React.PropTypes.string.isRequired, + href: React.PropTypes.string.isRequired +}; + +export default LinkButton; diff --git a/web-ui/src/common/link_button/link_button.scss b/web-ui/src/common/link_button/link_button.scss new file mode 100644 index 00000000..9318e08e --- /dev/null +++ b/web-ui/src/common/link_button/link_button.scss @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2017 ThoughtWorks, Inc. + * + * Pixelated is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Pixelated is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Pixelated. If not, see . + */ + +.link-button > div { + margin-top: 2em; + border: 1px solid #ff9c00; +} diff --git a/web-ui/src/common/link_button/link_button.spec.js b/web-ui/src/common/link_button/link_button.spec.js new file mode 100644 index 00000000..dd040d28 --- /dev/null +++ b/web-ui/src/common/link_button/link_button.spec.js @@ -0,0 +1,20 @@ +import { shallow } from 'enzyme'; +import expect from 'expect'; +import React from 'react'; +import LinkButton from 'src/common/link_button/link_button'; + +describe('LinkButton', () => { + let linkButton; + + beforeEach(() => { + linkButton = shallow(); + }); + + it('renders link button with given button text', () => { + expect(linkButton.find('RaisedButton').props().label).toEqual('Go To Link'); + }); + + it('renders link button with given href', () => { + expect(linkButton.find('RaisedButton').props().href).toEqual('/some-link'); + }); +}); -- cgit v1.2.3