Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #59 from aidenybai/fix-compile-tests
Browse files Browse the repository at this point in the history
Fix compile tests
  • Loading branch information
aidenybai authored Feb 6, 2021
2 parents 5013097 + a965186 commit 88b8919
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Status**

- [ ] Code changes have been tested against eslint, or there are no code changes
- [ ] Code changes have been tested against prettier, or there are no code changes
- [ ] I know how to update typings and have done so, or typings don't need updating

**Semantic versioning classification:**
Expand Down
26 changes: 7 additions & 19 deletions src/core/__test__/compile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ describe('.compile', () => {
JSON.stringify([createASTNode(el1, state)])
);
const referenceEl2ASTNode = createASTNode(el2, {});
expect(JSON.stringify(compile(el2, {}))).toEqual(JSON.stringify(referenceEl2ASTNode ? [referenceEl2ASTNode] : []));
expect(JSON.stringify(compile(el2, {}))).toEqual(
JSON.stringify(referenceEl2ASTNode ? [referenceEl2ASTNode] : [])
);
done();
}, 0);
});
Expand Down Expand Up @@ -117,29 +119,15 @@ describe('.compile', () => {
layer1El.appendChild(forLoopEl);

setTimeout(() => {
// const normalCollection = extractNodeChildrenAsCollection(layer1El);
const normalCollection = extractNodeChildrenAsCollection(layer1El);
const compiledNormalCollection = compile(layer1El, {});
const listCollection = extractNodeChildrenAsCollection(forLoopEl, false);
// const listCollectionAsListGroup = extractNodeChildrenAsCollection(forLoopEl, true);
const listCollectionAsListGroup = extractNodeChildrenAsCollection(forLoopEl, true);

expect(compiledNormalCollection.length).toEqual(1);
expect(listCollection).toEqual([]);
// expect(listCollectionAsListGroup).toEqual([
// forLoopEl,
// forLoopChild1,
// forLoopChild2,
// forLoopChild3,
// ]);
// expect(normalCollection).toEqual([
// layer1El,
// layer2El,
// layer3El,
// layer4El,
// forLoopEl,
// forLoopChild1,
// forLoopChild2,
// forLoopChild3,
// ]);
expect(listCollectionAsListGroup).toEqual([forLoopChild1, forLoopChild2, forLoopChild3]);
expect(normalCollection).toEqual([layer1El, layer2El, layer3El, layer4El, forLoopEl]);
done();
}, 0);
});
Expand Down
4 changes: 3 additions & 1 deletion src/core/utils/__test__/computeExpression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ describe('.compute', () => {
it('should emit and access an event', () => {
const el = document.createElement('div');

expect(computeExpression(`$emit('customEvent', $el); return $event`, el, false)({}, 'foo')).toEqual('foo');
expect(
computeExpression(`$emit('customEvent', $el); return $event`, el, false)({}, 'foo')
).toEqual('foo');
});
});

0 comments on commit 88b8919

Please # to comment.