mirror of
https://github.com/pezkuwichain/pezkuwi-extension.git
synced 2026-11-13 02:37:08 +00:00
- @pezkuwi/dev, dev-test, dev-ts ^0.86.3 in the root and in every workspace package (they still asked for 0.84.3) - tsconfig.base target ES2022, the @pezkuwi/dev default; it carries the ErrorOptions type for `cause` - rethrown errors carry the original as `cause`; rejections are normalised to Error - page/messaging: the typed subscriber is called directly, not as `Function` - chrome mock: constant results through Promise.resolve - useLedger: drop a construction every branch below repeated - InputWithLabel: onKeyDown instead of the deprecated onKeyPress - Account: toggleActions + 1 instead of a pre-increment of a parameter - optional chains where a guard tested the same value - specs: mount<React.Component> so the wrappers are not `any`-typed - AccountsStore.set keeps its async override of KeyringStore.set: BaseStore.set handles its own failure, so it never rejects - extension-chains keeps its ChainProperties assertion: the package's own build does not load the type augmentation - the existing React Compiler findings (37, react-hooks rules only) are recorded in eslint-suppressions.json; a new one fails lint
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
// Copyright 2019-2026 @pezkuwi/extension-ui authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import '@pezkuwi/extension-mocks/chrome';
|
|
|
|
import type { ReactWrapper } from 'enzyme';
|
|
import type * as _ from '@pezkuwi/dev-test/globals.d.ts';
|
|
|
|
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
|
import enzyme from 'enzyme';
|
|
import React from 'react';
|
|
import { MemoryRouter } from 'react-router';
|
|
|
|
import Header from './Header.js';
|
|
import Settings from './MenuSettings.js';
|
|
|
|
const { configure, mount } = enzyme;
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
configure({ adapter: new Adapter() });
|
|
|
|
describe('Header component', () => {
|
|
let wrapper: ReactWrapper;
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
const mountHeader = (props: React.ComponentProps<typeof Header> = {}): ReactWrapper => mount(
|
|
<MemoryRouter>
|
|
<Header {...props} />
|
|
</MemoryRouter>);
|
|
|
|
it('gear icon is not highlighted when settings are hidden', () => {
|
|
wrapper = mountHeader({ showSettings: true });
|
|
|
|
expect(wrapper.find(Settings).length).toBe(0);
|
|
expect(wrapper.find('.cogIcon').first().hasClass('selected')).toBe(false);
|
|
});
|
|
|
|
it('highlights gear icon when settings are toggled', () => {
|
|
wrapper = mountHeader({ showSettings: true });
|
|
|
|
wrapper.find('div[data-toggle-settings]').simulate('click');
|
|
|
|
expect(wrapper.find(Settings).length).toBe(1);
|
|
expect(wrapper.find('.cogIcon').first().hasClass('selected')).toBe(true);
|
|
});
|
|
});
|