Skip to content

Commit

Permalink
test(cart): 触发事件后等待内容更新
Browse files Browse the repository at this point in the history
  • Loading branch information
twinh committed Jun 15, 2024
1 parent cdf1dc5 commit 2b7852a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pages/m/carts/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('Index', () => {
expect(checkboxes[2].checked).toBeTruthy();
expect(checkboxes[2].disabled).toBeUndefined();

expect(checkout.textContent).toBe('结算(2)');
await waitFor(() => expect(checkout.textContent).toBe('结算(2)'));
expect(amount.textContent).toBe('合计:¥' + (9 * 9 + 12 * 9));

// 取消选择1
Expand All @@ -199,7 +199,7 @@ describe('Index', () => {
expect(checkboxes[1].checked).toBeUndefined();
expect(checkboxes[2].checked).toBeTruthy();

expect(checkout.textContent).toBe('结算(1)');
await waitFor(() => expect(checkout.textContent).toBe('结算(1)'));
expect(amount.textContent).toBe('合计:¥' + (12 * 9));

// 全选
Expand All @@ -208,7 +208,7 @@ describe('Index', () => {
expect(checkboxes[1].checked).toBeUndefined();
expect(checkboxes[2].checked).toBeTruthy();

expect(checkout.textContent).toBe('结算(2)');
await waitFor(() => expect(checkout.textContent).toBe('结算(2)'));
expect(amount.textContent).toBe('合计:¥' + (9 * 9 + 12 * 9));

// 取消全选
Expand All @@ -217,7 +217,7 @@ describe('Index', () => {
expect(checkboxes[1].checked).toBeUndefined();
expect(checkboxes[2].checked).toBeUndefined();

expect(checkout.textContent).toBe('结算(0)');
await waitFor(() => expect(checkout.textContent).toBe('结算(0)'));
expect(amount.textContent).toBe('合计:¥0');

// 选择1
Expand All @@ -230,7 +230,7 @@ describe('Index', () => {
expect(checkboxes[1].checked).toBeUndefined();
expect(checkboxes[2].checked).toBeUndefined();

expect(checkout.textContent).toBe('结算(1)');
await waitFor(() => expect(checkout.textContent).toBe('结算(1)'));
expect(amount.textContent).toBe('合计:¥' + (9 * 9));

// 提交
Expand Down

0 comments on commit 2b7852a

Please sign in to comment.