Skip to content

Commit

Permalink
Hide unfinished UI elements - Closes #206
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Jan 17, 2018
1 parent 1fc8ec4 commit c9eb37a
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 42 deletions.
7 changes: 0 additions & 7 deletions src/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ const Header = props => (
menuRipple
theme={styles}
>
{
!props.account.isDelegate &&
<MenuItem theme={styles}>
<RelativeLink className={`register-as-delegate ${styles.link}`}
to='register-delegate'>{props.t('Register as delegate')}</RelativeLink>
</MenuItem>
}
<MenuItem theme={styles}>
<RelativeLink className={`sign-message ${styles.link}`} to='sign-message'>{props.t('Sign message')}</RelativeLink>
</MenuItem>
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/header.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Header', () => {
propsMock.restore();
});

it('renders 9 RelativeLink components', () => {
expect(wrapper.find(RelativeLink)).to.have.length(7);
it('renders 6 RelativeLink components', () => {
expect(wrapper.find(RelativeLink)).to.have.length(6);
});
});
4 changes: 2 additions & 2 deletions src/components/mainMenu/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('MainMenuHOC', () => {
expect(wrapper.find('MainMenu')).to.have.lengthOf(1);
});

it('should mount 7 Tab inside MainMenu', () => {
expect(wrapper.find('Tab')).to.have.lengthOf(6);
it('should mount 5 Tab inside MainMenu', () => {
expect(wrapper.find('Tab')).to.have.lengthOf(5);
});
});
4 changes: 4 additions & 0 deletions src/components/mainMenu/mainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,22 @@ class MainMenu extends React.Component {
id: 'transactions',
image: menuLogos.wallet,
}, {
/* TODO: uncomment when the page is updated
label: t('Buy Lisk'),
id: 'butLisk',
image: menuLogos.buyLisk,
}, {
*/
label: t('Delegates'),
id: 'voting',
image: menuLogos.delegates,
}, {
/* TODO: uncomment when the page is updated
label: t('Forging'),
id: 'forging',
image: menuLogos.sidechains,
}, {
*/
label: t('Sidechains'),
id: 'sidechains',
image: menuLogos.sidechains,
Expand Down
9 changes: 5 additions & 4 deletions src/components/mainMenu/mainMenu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,19 @@ describe('MainMenu', () => {
expect(wrapper.find(ToolboxTabs).exists()).to.equal(true);
});

it('should render 8 Button components if props.isDelegate', () => {
// TODO: re-enable if the functionality is re-enabled
it.skip('should render 6 Button components if props.isDelegate', () => {
const wrapper = mount(<MemoryRouter>
<MainMenu store={store} isDelegate={true} history={history} t={t} />
</MemoryRouter>, options);
expect(wrapper.find(Tab)).to.have.lengthOf(7);
expect(wrapper.find(Tab)).to.have.lengthOf(6);
});

it('should render 7 menu item components if !props.isDelegate', () => {
it('should render 5 menu item components if !props.isDelegate', () => {
const wrapper = mount(<MemoryRouter>
<MainMenu store={store} isDelegate={false} history={history} t={t} />
</MemoryRouter>, options);
expect(wrapper.find(Tab)).to.have.lengthOf(6);
expect(wrapper.find(Tab)).to.have.lengthOf(5);
});

it('should allow to change active menu item', () => {
Expand Down
7 changes: 3 additions & 4 deletions src/components/setting/setting.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React from 'react';
import ReactSwipe from 'react-swipe';
import styles from './setting.css';
import languageSwitcherTheme from './languageSwitcher.css';
// eslint-disable-next-line import/no-named-as-default
import SliderCheckbox from '../toolbox/checkbox';
import RelativeLink from '../relativeLink';
import i18n from '../../i18n';
import { FontIcon } from '../fontIcon';

class Setting extends React.Component {
constructor() {
Expand All @@ -33,7 +30,7 @@ class Setting extends React.Component {

render() {
this.language = (i18n.language === 'de');
const { t, hasSecondPassphrase } = this.props;
const { t } = this.props;
return <footer className={styles.wrapper}>
<ReactSwipe
className={styles.carousel}
Expand Down Expand Up @@ -70,6 +67,7 @@ class Setting extends React.Component {
<p>{t('Delegate section will be displayed.')}</p>
</article>
</div>
{/* TODO: will be re-enabled when the functionality is updated
<div>
<SliderCheckbox
theme={languageSwitcherTheme}
Expand Down Expand Up @@ -109,6 +107,7 @@ class Setting extends React.Component {
<p>{t('Register 2nd passphrase')}</p>
</article>
</div>
*/}
</ReactSwipe>
<ul className={ styles.carouselNav } id='carouselNav'>
{[...Array(4)].map((x, i) =>
Expand Down
6 changes: 4 additions & 2 deletions src/components/setting/setting.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ describe('Setting', () => {
expect(wrapper.find('#carouselNav li').at(2).props().className).to.be.include('activeSlide');
});

it('should click on "languageSwitcher" change the language to "de"', () => {
// TODO: will be re-enabled when the functionality is re-enabled
it.skip('should click on "languageSwitcher" change the language to "de"', () => {
// const languageSpy = sinon.spy(i18n, 'changeLanguage');
wrapper.find('.language-switcher .circle').simulate('click');
wrapper.update();
expect(i18n.language).to.be.equal('de');
});

it('should second click on "languageSwitcher" change the language to "en"', () => {
// TODO: will be re-enabled when the functionality is re-enabled
it.skip('should second click on "languageSwitcher" change the language to "en"', () => {
wrapper.find('.language-switcher .circle').simulate('click');
wrapper.update();
expect(i18n.language).to.be.equal('de');
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/forging.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Forging page
Scenario: should allow to view forging center if account is delegate and should show more blocks on scroll
Given I'm logged in as "delegate"
When I click "forging" menu
When I go to "main/forging/"
Then I should see forging center
And I should see table with 20 lines
And I scroll to the bottom of "forging"
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/registerDelegate.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Register delegate
Scenario: should allow to register a delegate
Given I'm logged in as "delegate candidate"
When I click "register as delegate" in main menu
When I go to "main/dashboard/register-delegate"
And I fill in "test" to "username" field
And I click "register button"
Then I should see alert dialog with title "Success" and text "Delegate registration was successfully submitted with username: "test". It can take several seconds before it is processed."
Expand All @@ -12,7 +12,7 @@ Feature: Register delegate

Scenario: should allow to register a delegate with second passphrase
Given I'm logged in as "second passphrase account"
When I click "register as delegate" in main menu
When I go to "main/dashboard/register-delegate"
And I fill in "test2" to "username" field
And I fill in second passphrase of "second passphrase account" to "second passphrase" field
And I click "register button"
Expand All @@ -21,14 +21,14 @@ Feature: Register delegate
@integration
Scenario: should allow to exit delegate registration dialog
Given I'm logged in as "genesis"
When I click "register as delegate" in main menu
When I go to "main/dashboard/register-delegate"
And I click "cancel button"
Then I should see no "modal dialog"

@integration
Scenario: should not allow to register delegate if not enough funds for the fee
Given I'm logged in as "empty account"
When I click "register as delegate" in main menu
When I go to "main/dashboard/register-delegate"
Then I should see "Insufficient funds for 25 LSK fee" error message
And "register button" should be disabled

Expand Down
22 changes: 6 additions & 16 deletions test/e2e/registerSecondPassphrase.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Feature: Register second passphrase
# TODO: will be re-enabled when the functionality is re-enabled
@pending
Scenario: should allow to set 2nd passphrase
Given I'm logged in as "second passphrase candidate"
When I click "more menu"
Expand Down Expand Up @@ -30,11 +32,7 @@ Feature: Register second passphrase
And I wait 1 seconds
And I refresh the page
And I wait 2 seconds
When I click "more menu"
And I wait 0.4 seconds
And I click 4 item in setting carousel
And I wait 0.4 seconds
And I click "register second passphrase"
When I go to "main/dashboard/register-second-passphrase"
And I fill in passphrase of "empty account" to "passphrase" field
And I click "authenticate button"
Then I should see "Insufficient funds for 5 LSK fee" error message
Expand All @@ -43,21 +41,13 @@ Feature: Register second passphrase
@integration
Scenario: should not allow to set 2nd passphrase if not enough funds for the fee
Given I'm logged in as "empty account"
When I click "more menu"
And I wait 0.4 seconds
And I click 4 item in setting carousel
And I wait 0.4 seconds
And I click "register second passphrase"
When I go to "main/dashboard/register-second-passphrase"
Then I should see "Insufficient funds for 5 LSK fee" error message
And "next button" should be disabled

@integration
Scenario: should allow to exit 2nd passphrase registration dialog
Given I'm logged in as "genesis"
When I click "more menu"
And I wait 0.4 seconds
And I click 4 item in setting carousel
And I wait 0.4 seconds
And I click "register second passphrase"
When I go to "main/dashboard/register-second-passphrase"
And I click "cancel button"
Then I should see no "modal dialog"
Then I should see no "modal dialog"
2 changes: 2 additions & 0 deletions test/e2e/settings.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Feature: Settings dialog
# TODO: will be re-enabled when the functionality is re-enabled
@pending
Scenario: should allow to change language
Given I'm logged in as "any account"
When I click "more menu"
Expand Down

0 comments on commit c9eb37a

Please sign in to comment.