Skip to content

Commit

Permalink
Update Hareactive, fix a few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paldepind committed Aug 16, 2019
1 parent 5d8842a commit 5177ae4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"homepage": "https://github.com/funkia/turbine#readme",
"devDependencies": {
"@funkia/hareactive": "^0.3.2",
"@funkia/hareactive": "^0.3.3",
"@types/chai": "^4.1.7",
"@types/chai-dom": "0.0.7",
"@types/jest": "^24.0.15",
Expand Down
16 changes: 9 additions & 7 deletions test/component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,21 @@ describe("component specs", () => {
const { available, output } = testComponent(comp);
assert.deepEqual(Object.keys(output), []);
assert.deepEqual(Object.keys(available), ["foo"]);
// expect(H.at(b!)).to.equal(2);
expect(H.at(b!)).to.equal(2);
});
it("works with selected fgo and looped behavior", () => {
const comp = loop(
fgo(function*({ name }: Looped): IterableIterator<Component<any, any>> {
yield div(name);
({ value: name } = yield input({ props: { value: "Foo" } }));
({ name } = yield input({ props: { value: "Foo" } }).output({
name: "value"
}));
return { name };
})
);
const { dom } = testComponent(comp);
expect(dom).to.have.length(2);
// FIXME: Seems to be a bug in Hareactive
// expect(dom.firstChild).to.have.text("Foo");
expect(dom.firstChild).to.have.text("Foo");
});
it("can be told to destroy", () => {
let toplevel = false;
Expand All @@ -258,14 +259,15 @@ describe("component specs", () => {
}: Looped): IterableIterator<Component<any, any>> {
yield div(name);
destroyed.subscribe((b) => (toplevel = b));
({ value: name } = yield input({ props: { value: "Foo" } }));
({ name } = yield input({ props: { value: "Foo" } }).output({
name: "value"
}));
return { name };
})
);
const { dom, destroy } = testComponent(comp);
expect(dom).to.have.length(2);
// FIXME: Seems to be a bug in Hareactive
// expect(dom.firstChild).to.have.text("Foo");
expect(dom.firstChild).to.have.text("Foo");
destroy(true);
expect(dom).to.have.length(0);
expect(toplevel).to.equal(true);
Expand Down

0 comments on commit 5177ae4

Please sign in to comment.