How to use the @jupyterlab/testutils.defaultRenderMime function in @jupyterlab/testutils

To help you get started, we’ve selected a few @jupyterlab/testutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-console / src / foreign.spec.ts View on Github external
// If the message was not injected but otherwise would have been, emit
      // a rejected signal. This should only happen if `enabled` is `false`.
      const session = (msg.parent_header as KernelMessage.IHeader).session;
      const msgType = msg.header.msg_type;
      if (
        session !== this.session.kernel.clientId &&
        relevantTypes.has(msgType)
      ) {
        this.rejected.emit(msg);
      }
    }
    return injected;
  }
}

const rendermime = defaultRenderMime();

const relevantTypes = [
  'execute_input',
  'execute_result',
  'display_data',
  'stream',
  'error',
  'clear_output'
].reduce((acc, val) => {
  acc.add(val);
  return acc;
}, new Set());

describe('@jupyterlab/console', () => {
  describe('ForeignHandler', () => {
    let local: Session.ISession;
github jupyterlab / jupyterlab-data-explorer / tests / test-console / src / foreign.spec.ts View on Github external
// If the message was not injected but otherwise would have been, emit
      // a rejected signal. This should only happen if `enabled` is `false`.
      const session = (msg.parent_header as KernelMessage.IHeader).session;
      const msgType = msg.header.msg_type;
      if (
        session !== this.session.kernel.clientId &&
        relevantTypes.has(msgType)
      ) {
        this.rejected.emit(msg);
      }
    }
    return injected;
  }
}

const rendermime = defaultRenderMime();

const relevantTypes = [
  'execute_input',
  'execute_result',
  'display_data',
  'stream',
  'error',
  'clear_output'
].reduce((acc, val) => {
  acc.add(val);
  return acc;
}, new Set());

describe('@jupyterlab/console', () => {
  describe('ForeignHandler', () => {
    let local: Session.ISession;
github jupyterlab / jupyterlab-data-explorer / tests / test-outputarea / src / widget.spec.ts View on Github external
import {
  IOutputAreaModel,
  OutputAreaModel,
  OutputArea
} from '@jupyterlab/outputarea';

import {
  createClientSession,
  defaultRenderMime,
  NBTestUtils
} from '@jupyterlab/testutils';

/**
 * The default rendermime instance to use for testing.
 */
const rendermime = defaultRenderMime();

const CODE = 'print("hello")';

class LogOutputArea extends OutputArea {
  methods: string[] = [];

  protected onUpdateRequest(msg: Message): void {
    super.onUpdateRequest(msg);
    this.methods.push('onUpdateRequest');
  }

  protected onModelChanged(
    sender: IOutputAreaModel,
    args: IOutputAreaModel.ChangedArgs
  ) {
    super.onModelChanged(sender, args);
github jupyterlab / jupyterlab / tests / test-outputarea / src / widget.spec.ts View on Github external
import {
  IOutputAreaModel,
  OutputAreaModel,
  OutputArea
} from '@jupyterlab/outputarea';

import {
  createClientSession,
  defaultRenderMime,
  NBTestUtils
} from '@jupyterlab/testutils';

/**
 * The default rendermime instance to use for testing.
 */
const rendermime = defaultRenderMime();

const CODE = 'print("hello")';

class LogOutputArea extends OutputArea {
  methods: string[] = [];

  protected onUpdateRequest(msg: Message): void {
    super.onUpdateRequest(msg);
    this.methods.push('onUpdateRequest');
  }

  protected onModelChanged(
    sender: IOutputAreaModel,
    args: IOutputAreaModel.ChangedArgs
  ) {
    super.onModelChanged(sender, args);
github jupyterlab / jupyterlab / tests / test-docregistry / src / mimedocument.spec.ts View on Github external
DocumentRegistry,
  Context,
  MimeContent,
  MimeDocument,
  MimeDocumentFactory
} from '@jupyterlab/docregistry';

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

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

const RENDERMIME = defaultRenderMime();

class LogRenderer extends MimeContent {
  methods: string[] = [];

  protected onAfterAttach(msg: Message): void {
    super.onAfterAttach(msg);
    this.methods.push('onAfterAttach');
  }

  protected onUpdateRequest(msg: Message): void {
    super.onUpdateRequest(msg);
    this.methods.push('onUpdateRequest');
  }
}

class FooText extends RenderedText {
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / mimedocument.spec.ts View on Github external
DocumentRegistry,
  Context,
  MimeContent,
  MimeDocument,
  MimeDocumentFactory
} from '@jupyterlab/docregistry';

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

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

const RENDERMIME = defaultRenderMime();

class LogRenderer extends MimeContent {
  methods: string[] = [];

  protected onAfterAttach(msg: Message): void {
    super.onAfterAttach(msg);
    this.methods.push('onAfterAttach');
  }

  protected onUpdateRequest(msg: Message): void {
    super.onUpdateRequest(msg);
    this.methods.push('onUpdateRequest');
  }
}

class FooText extends RenderedText {