Revert "fixing unit test with custom attribute"

This reverts commit 66729cfc60.
This commit is contained in:
Roland Osborne 2024-05-02 15:16:16 -07:00
parent 89217cd441
commit d38d60119b
9 changed files with 23 additions and 26 deletions

View File

@ -20,7 +20,7 @@ function CardView() {
<div
key={entry.id}
data-testid="card"
data-offsync={entry.offsync.toString()}
offsync={entry.offsync.toString()}
>
<span data-testid="name">{entry.data.cardProfile.name}</span>
<span data-testid="status">{entry.data.cardDetail.status}</span>
@ -36,8 +36,8 @@ function CardView() {
//@ts-ignore
<div
data-testid="cards"
data-count={renderCount}
data-offsync={card.state.offsync.toString()}
count={renderCount}
offsync={card.state.offsync.toString()}
>
{cards}
</div>
@ -137,7 +137,7 @@ test('resync cards', async () => {
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('cards').attributes['data-offsync'].value).toBe('true');
expect(screen.getByTestId('cards').attributes.offsync.value).toBe('true');
});
statusCards = 200;
@ -148,7 +148,7 @@ test('resync cards', async () => {
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('cards').attributes['data-offsync'].value).toBe('false');
expect(screen.getByTestId('cards').attributes.offsync.value).toBe('false');
});
act(() => {
@ -216,7 +216,7 @@ test('resync contact', async () => {
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('card').attributes['data-offsync'].value).toBe('true');
expect(screen.getByTestId('card').attributes.offsync.value).toBe('true');
});
statusMessage = 200;
@ -227,7 +227,7 @@ test('resync contact', async () => {
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('card').attributes['data-offsync'].value).toBe('false');
expect(screen.getByTestId('card').attributes.offsync.value).toBe('false');
});
act(() => {

View File

@ -33,8 +33,8 @@ function ChannelView() {
//@ts-ignore
<div
data-testid="channels"
data-count={renderCount}
data-offsync={channel.state.offsync.toString()}
count={renderCount}
offsync={channel.state.offsync.toString()}
>
{channels}
</div>
@ -204,7 +204,7 @@ test('add, update and remove channel', async () => {
await channelContext.actions.setRevision(1);
});
//screen.getByTestId('count').attributes['data-count'].value
//screen.getByTestId('count').attributes.count.value
//console.log(prettyDOM(screen.getByTestId('channels')));
await waitFor(async () => {
@ -213,11 +213,8 @@ test('add, update and remove channel', async () => {
expect(screen.getByTestId('summary').textContent).toBe('testdata');
});
console.log("GET CHANNELS");
console.log(screen.getByTestId('channels'));
//@ts-ignore
const count = parseInt(screen.getByTestId('channels').attributes['data-count'].value) + 1;
const count = parseInt(screen.getByTestId('channels').attributes.count.value) + 1;
fetchChannels = [
{
@ -239,7 +236,7 @@ console.log(screen.getByTestId('channels'));
expect(screen.getByTestId('channels').children).toHaveLength(1);
expect(screen.getByTestId('detail').textContent).toBe('testdata2');
//@ts-ignore
expect(screen.getByTestId('channels').attributes['data-count'].value).toBe(count.toString());
expect(screen.getByTestId('channels').attributes.count.value).toBe(count.toString());
});
fetchChannels = [{ id: '123', revision: 3 }];
@ -262,7 +259,7 @@ console.log(screen.getByTestId('channels'));
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('channels').attributes['data-offsync'].value).toBe('false');
expect(screen.getByTestId('channels').attributes.offsync.value).toBe('false');
});
await act(async () => {
@ -288,7 +285,7 @@ test('resync', async () => {
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('channels').attributes['data-offsync'].value).toBe('true');
expect(screen.getByTestId('channels').attributes.offsync.value).toBe('true');
});
await act(async () => {
@ -298,6 +295,6 @@ test('resync', async () => {
await waitFor(async () => {
//@ts-ignore
expect(screen.getByTestId('channels').attributes['data-offsync'].value).toBe('false');
expect(screen.getByTestId('channels').attributes.offsync.value).toBe('false');
});
});

View File

@ -45,7 +45,7 @@ function ContactsView() {
//@ts-ignore
<div
data-testid="cards"
data-count={renderCount}
count={renderCount}
>
{cards}
</div>

View File

@ -42,8 +42,8 @@ function ConversationView() {
//@ts-ignore
<div
data-testid="topics"
data-count={renderCount}
data-offsync={card.state.offsync.toString()}
count={renderCount}
offsync={card.state.offsync.toString()}
>
{topics}
</div>

View File

@ -27,7 +27,7 @@ function InfoView() {
//@ts-ignore
<div
data-testid="info"
data-count={renderCount}
count={renderCount}
>
{state.title}
</div>

View File

@ -37,7 +37,7 @@ function ListingView() {
//@ts-ignore
<div
data-testid="contacts"
data-count={renderCount}
count={renderCount}
>
{contacts}
</div>

View File

@ -43,7 +43,7 @@ function ThreadView() {
//@ts-ignore
<div
data-testid="thread"
data-count={renderCount}
count={renderCount}
>
{topics}
</div>

View File

@ -48,7 +48,7 @@ function TopicsView() {
//@ts-ignore
<div
data-testid="channels"
data-count={renderCount}
count={renderCount}
>
{channels}
</div>

View File

@ -29,7 +29,7 @@ function ProfileView() {
//@ts-ignore
<div
data-testid="name"
data-count={renderCount}
count={renderCount}
>
{name}
</div>