Skip to content

Commit

Permalink
finished fixing unittests for virtualdom pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Jan 26, 2020
1 parent ccd3b10 commit 6282805
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/virtualdom/tests/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('@lumino/virtualdom', () => {

it('should be `element`', () => {
let vnode = new VirtualElement('div', {}, [], mockRenderer);
expect(vnode.type).to.equal('passthru');
expect(vnode.type).to.equal('element');
});

});
Expand Down Expand Up @@ -345,7 +345,7 @@ describe('@lumino/virtualdom', () => {

});

describe('hpass()', () => {
describe('h() with IRenderer param', () => {
let tag = 'div';
let attrs = { className: 'baz' };
let mockRenderer = {
Expand Down Expand Up @@ -386,7 +386,7 @@ describe('@lumino/virtualdom', () => {
expect(vnode).to.be.an.instanceof(VirtualElement);
expect(vnode.tag).to.equal(tag);
expect(vnode.attrs).to.deep.equal(attrs);
expect(vnode.renderer).to.equal(null);
expect(vnode.renderer).to.equal(undefined);
});

it('should create a virtual element without custom renderer or attrs', () => {
Expand All @@ -396,7 +396,7 @@ describe('@lumino/virtualdom', () => {
expect(vnode).to.be.an.instanceof(VirtualElement);
expect(vnode.tag).to.equal('div');
expect(vnode.attrs).to.deep.equal({});
expect(vnode.renderer).to.equal(null);
expect(vnode.renderer).to.equal(undefined);
});

});
Expand Down Expand Up @@ -533,7 +533,7 @@ describe('@lumino/virtualdom', () => {

});

describe('VirtualDOM passthru', () => {
describe('VirtualDOM with custom renderer', () => {
const rendererClosure = (record: any = {}) => {
return {
render: (host: HTMLElement) => {
Expand Down Expand Up @@ -583,11 +583,11 @@ describe('@lumino/virtualdom', () => {
let host = document.createElement('div');
let record: any = {child: undefined, cleanedUp: false};

// first pass, render the hpass children
// first pass, render the custom children
let children0 = [h.a(), h.span(), h.div(h.div(), h('span', rendererClosure(record)), h.div())];
VirtualDOM.render(children0, host);

// second pass, explicitly unrender the hpass children
// second pass, explicitly unrender the custom children
let children1 = [h.a(), h.span(), h.label()];
VirtualDOM.render(children1, host);
expect(record.cleanedUp).to.equal(true);
Expand Down

0 comments on commit 6282805

Please sign in to comment.