summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoranderklander <anderklander@gmail.com>2018-03-01 07:29:08 +0100
committerAndrej Mihajlov <and@mullvad.net>2018-03-26 14:22:10 +0200
commitc8b78c79eaf33b4a29adedaddab18ba0a95cdb40 (patch)
tree5bdbb847de23e7d8166514258d8c6ce19bd51fc7
parent08c93c5e7cfd8e236b5c0cf70e6ba413625400de (diff)
downloadmullvadvpn-c8b78c79eaf33b4a29adedaddab18ba0a95cdb40.tar.xz
mullvadvpn-c8b78c79eaf33b4a29adedaddab18ba0a95cdb40.zip
Footer visibility test
-rw-r--r--app/components/Login.js2
-rw-r--r--test/components/Login.spec.js17
2 files changed, 13 insertions, 6 deletions
diff --git a/app/components/Login.js b/app/components/Login.js
index d8827959d4..2c5d30034f 100644
--- a/app/components/Login.js
+++ b/app/components/Login.js
@@ -87,7 +87,7 @@ export default class Login extends React.Component<LoginPropTypes, State> {
</View>}
</View>
- <Animated.View onLayout={this._onFooterLayout} style={[styles.login_footer, this.state.footerAnimationStyle]} testName='footer'>
+ <Animated.View onLayout={this._onFooterLayout} style={[styles.login_footer, this.state.footerAnimationStyle]} testName={'footerVisibility ' + this._shouldShowFooter(this.props).toString()}>
{ this._createFooter() }
</Animated.View>
</View>
diff --git a/test/components/Login.spec.js b/test/components/Login.spec.js
index 04bc6bd896..f8f4af54de 100644
--- a/test/components/Login.spec.js
+++ b/test/components/Login.spec.js
@@ -33,20 +33,27 @@ describe('components/Login', () => {
it('does not show the footer when logging in', () => {
const component = renderLoggingIn();
- const footer = getComponent(component, 'footer');
- //TODO: add footer check
- expect(footer.length).to.not.equal(0);
+ const visibleFooters = getComponent(component, 'footerVisibility true');
+ const invisibleFooters = getComponent(component, 'footerVisibility false');
+ expect(visibleFooters.length).to.equal(0);
+ expect(invisibleFooters.length).to.equal(1);
});
it('shows the footer and account input when not logged in', () => {
const component = renderNotLoggedIn();
- //TODO: add footer check
+ const visibleFooters = getComponent(component, 'footerVisibility true');
+ const invisibleFooters = getComponent(component, 'footerVisibility false');
+ expect(visibleFooters.length).to.equal(1);
+ expect(invisibleFooters.length).to.equal(0);
expect(getComponent(component, 'AccountInput').length).to.be.above(0);
});
it('does not show the footer nor account input when logged in', () => {
const component = renderLoggedIn();
- //TODO: add footer check
+ const visibleFooters = getComponent(component, 'footerVisibility true');
+ const invisibleFooters = getComponent(component, 'footerVisibility false');
+ expect(visibleFooters.length).to.equal(0);
+ expect(invisibleFooters.length).to.equal(1);
expect(getComponent(component, 'AccountInput').length).to.equal(0);
});