Es6 cmp migration (#113)

* migrate Alert component

* convert Mainlist component

* add webpack watch task

* update build script for different manifests

* add types for api responses

* convert changeExtensionIcon

* convert inArray, getDomainParts, contains to ts

* convert changeExtensionTooltip

* convert changeExtensionState to ts
This commit is contained in:
Vu Nguyen
2021-01-16 19:31:52 -06:00
committed by GitHub
parent 9ecc2144aa
commit d194bcfe60
21 changed files with 660 additions and 10 deletions

View File

@@ -0,0 +1,63 @@
import React from 'react';
import { render } from '@testing-library/react';
import MainList from './MainList';
type onClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
describe('MainList', () => {
let disableLogging: onClick;
let enableLogging: onClick;
let loggedIn: boolean;
let loggingEnabled: boolean;
let logoutUser: onClick;
let totalTimeLoggedToday: string;
beforeEach(() => {
disableLogging = jest.fn();
enableLogging = jest.fn();
loggingEnabled = false;
loggedIn = false;
logoutUser = jest.fn();
totalTimeLoggedToday = '1/1/1999';
});
it('should render properly', () => {
const { container } = render(
<MainList
disableLogging={disableLogging}
enableLogging={enableLogging}
loggingEnabled={loggingEnabled}
loggedIn={loggedIn}
logoutUser={logoutUser}
totalTimeLoggedToday={totalTimeLoggedToday}
/>,
);
expect(container).toMatchInlineSnapshot(`
<div>
<div>
<div
class="list-group"
>
<a
class="list-group-item"
href="#"
>
<i
class="fa fa-fw fa-cogs"
/>
Options
</a>
<a
class="list-group-item"
href="https://wakatime.com/login"
rel="noreferrer"
target="_blank"
>
<i
class="fa fa-fw fa-sign-in"
/>
Login
</a>
</div>
</div>
</div>
`);
});
});