Skip to content

Commit

Permalink
Fix console error.
Browse files Browse the repository at this point in the history
I think the handler wasn’t getting removed after the check, so it was failing on the next signal emission. testEmission automatically removes the handler after the check, taking care of this issue.
  • Loading branch information
jasongrout committed May 13, 2019
1 parent b9f2f15 commit 7d31d6a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/test-docregistry/src/mimedocument.spec.ts
Expand Up @@ -17,7 +17,11 @@ import {

import { RenderedText, IRenderMime } from '@jupyterlab/rendermime';

import { createFileContext, defaultRenderMime } from '@jupyterlab/testutils';
import {
createFileContext,
defaultRenderMime,
testEmission
} from '@jupyterlab/testutils';

const RENDERMIME = defaultRenderMime();

Expand Down Expand Up @@ -111,10 +115,10 @@ describe('docregistry/mimedocument', () => {
it('should change the document contents', async () => {
RENDERMIME.addFactory(fooFactory);
await dContext.initialize(true);
let called = false;
dContext.model.contentChanged.connect(() => {
expect(dContext.model.toString()).to.equal('bar');
called = true;
const emission = testEmission(dContext.model.contentChanged, {
test: () => {
expect(dContext.model.toString()).to.equal('bar');
}
});
const renderer = RENDERMIME.createRenderer('text/foo');
const widget = new LogRenderer({
Expand All @@ -125,7 +129,7 @@ describe('docregistry/mimedocument', () => {
dataType: 'string'
});
await widget.ready;
expect(called).to.equal(true);
await emission;
});
});
});
Expand Down

0 comments on commit 7d31d6a

Please sign in to comment.