1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/multichain/account-picker/account-picker.test.js
David Walsh ba307d7258
UX: Multichain: Account Picker (#18177)
* UX: Multichain: Account Picker

* Update ui/components/multichain/account-picker/index.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/account-picker/index.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/account-picker/index.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/account-picker/index.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Cleanup

* Move file names to DS standard

* Add index for export

* Add MULTICHAIN flag

* Fix hover color

* Fix lint

* Use BackgroundColor instead of Color

* Add comments for propTypes

* Provide args properly

* Implement onClick arg

* Fix alignment

* Update ui/components/multichain/account-picker/account-picker.js

* Update ui/components/multichain/account-picker/account-picker.js

* Update ui/components/multichain/account-picker/account-picker.js

* Update ui/components/multichain/account-picker/account-picker.js

* Update ui/components/multichain/account-picker/account-picker.js

* Only use account name and address, account for blockies or jazzicons

* Add test

* Fix jest change

* Fix CSS locations

* Update ui/components/multichain/account-picker/account-picker.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/account-picker/account-picker.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/account-picker/account-picker.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update snapshot

* Update border radius

* Fix jest

* Switch to using Button

---------

Co-authored-by: Garrett Bear <gwhisten@gmail.com>
2023-03-30 13:11:13 -05:00

48 lines
1.3 KiB
JavaScript

/* eslint-disable jest/require-top-level-describe */
import React from 'react';
import 'jest-canvas-mock';
import { renderWithProvider } from '../../../../test/jest';
import configureStore from '../../../store/store';
import mockState from '../../../../test/data/mock-state.json';
import { AccountPicker } from '.';
const DEFAULT_PROPS = {
name: 'Account 1',
address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc',
onClick: () => undefined,
};
const render = (props = {}, state = {}) => {
const store = configureStore({
metamask: {
...mockState.metamask,
provider: {
chainId: '0x99',
},
...state,
},
});
return renderWithProvider(
<AccountPicker {...DEFAULT_PROPS} {...props} />,
store,
);
};
describe('AccountPicker', () => {
it('renders properly', () => {
const { container } = render({}, { useBlockie: true });
expect(container).toMatchSnapshot();
});
it('displays a blockie per the setting', () => {
const { container } = render({}, { useBlockie: true });
expect(container.querySelector('canvas')).toBeDefined();
expect(container.querySelector('img')).toBeDefined();
});
it('displays a jazzicon per the setting', () => {
const { container } = render({}, { useBlockie: false });
expect(container.querySelector('svg')).toBeDefined();
});
});