Skip to content

Commit

Permalink
fix attributes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Varixo committed Aug 23, 2024
1 parent 2417c15 commit ddfe999
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
27 changes: 11 additions & 16 deletions packages/qwik/src/core/v2/shared/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,8 @@ function choreComparator(a: Chore, b: Chore, shouldThrowOnHostMismatch: boolean)
const aHost = a.$host$;
const bHost = b.$host$;

const aHostIsQrlResolve = a.$type$ === ChoreType.QRL_RESOLVE;
const bHostIsQrlResolve = b.$type$ === ChoreType.QRL_RESOLVE;

// QRL_RESOLVE does not have a host.
if (aHost !== bHost && !aHostIsQrlResolve && !bHostIsQrlResolve) {
if (aHost !== bHost && aHost !== null && bHost !== null) {
if (vnode_isVNode(aHost) && vnode_isVNode(bHost)) {
// we are running on the client.
const hostDiff = vnode_documentPosition(aHost, bHost);
Expand All @@ -449,22 +446,20 @@ function choreComparator(a: Chore, b: Chore, shouldThrowOnHostMismatch: boolean)
return microTypeDiff;
}

/**
* QRL_RESOLVE is a special case. It does not have a host nor $idx$. We want to process
* QRL_RESOLVE chores as FIFO, so we need to return 1.
*/
if (
aHostIsQrlResolve &&
bHostIsQrlResolve &&
(a.$target$ as QRLInternal<any>).$symbol$ !== (b.$target$ as QRLInternal<any>).$symbol$
) {
return 1;
}

const idxDiff = toNumber(a.$idx$) - toNumber(b.$idx$);
if (idxDiff !== 0) {
return idxDiff;
}

// If the host is the same, we need to compare the target.
if (
a.$target$ !== b.$target$ &&
((a.$type$ === ChoreType.QRL_RESOLVE && b.$type$ === ChoreType.QRL_RESOLVE) ||
(a.$type$ === ChoreType.NODE_PROP && b.$type$ === ChoreType.NODE_PROP))
) {
// 1 means that we are going to process chores as FIFO
return 1;
}
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik/src/core/v2/tests/component.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Error.stackTraceLimit = 100;

describe.each([
{ render: ssrRenderToDom }, //
// { render: domRender }, //
{ render: domRender }, //
])('$render.name: component', ({ render }) => {
it('should render component', async () => {
const MyComp = component$(() => {
Expand Down
4 changes: 2 additions & 2 deletions starters/e2e/e2e.attributes.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ test.describe("attributes", () => {
test("should update required", async ({ page }) => {
const input = page.locator("#input");
const renders = page.locator("#renders");
const countBtn = page.locator("#required");
await countBtn.click();
const requiredBtn = page.locator("#required");
await requiredBtn.click();

await expect(input).toHaveAttribute("aria-hidden", "true");
await expect(input).toHaveAttribute("aria-label", "even");
Expand Down

0 comments on commit ddfe999

Please sign in to comment.