1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

fix: confirm page header should show address in fullscreen (#10467)

fixes #9920
This commit is contained in:
Shane 2021-02-16 18:06:54 -08:00 committed by GitHub
parent 1f79250285
commit f4819e408b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 1 deletions

View File

@ -25,7 +25,7 @@ export default function ConfirmPageContainerHeader({
windowType !== ENVIRONMENT_TYPE_POPUP;
if (!showEdit && isFullScreen) {
return null;
return children;
}
return (
<div className="confirm-page-container-header">

View File

@ -0,0 +1,63 @@
import assert from 'assert';
import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import { Provider } from 'react-redux';
import ConfirmPageContainerHeader from '../confirm-page-container-header.component';
import configureStore from '../../../../../store/store';
import testData from '../../../../../../../.storybook/test-data';
const util = require('../../../../../../../app/scripts/lib/util');
describe('Confirm Detail Row Component', function () {
describe('render', function () {
it('should render a div with a confirm-page-container-header class', function () {
const stub = sinon
.stub(util, 'getEnvironmentType')
.callsFake(() => 'popup');
const wrapper = shallow(
<Provider store={configureStore(testData)}>
<ConfirmPageContainerHeader
showEdit={false}
onEdit={() => {
// noop
}}
showAccountInHeader={false}
accountAddress="0xmockAccountAddress"
/>
</Provider>,
);
assert.strictEqual(
wrapper.html().includes('confirm-page-container-header'),
true,
);
stub.restore();
});
it('should only render children when fullscreen and showEdit is false', function () {
const stub = sinon
.stub(util, 'getEnvironmentType')
.callsFake(() => 'fullscreen');
const wrapper = shallow(
<Provider store={configureStore(testData)}>
<ConfirmPageContainerHeader
showEdit={false}
onEdit={() => {
// noop
}}
showAccountInHeader={false}
accountAddress="0xmockAccountAddress"
>
<div className="nested-test-class" />
</ConfirmPageContainerHeader>
</Provider>,
);
assert.strictEqual(wrapper.html().includes('nested-test-class'), true);
assert.strictEqual(
wrapper.html().includes('confirm-page-container-header'),
false,
);
stub.restore();
});
});
});