Add code coverage tests for cell.ts (#8564)

This commit is contained in:
Cory Rivera
2019-12-04 14:45:48 -08:00
committed by GitHub
parent a7f5741608
commit 9691fab917
4 changed files with 429 additions and 21 deletions

View File

@@ -80,7 +80,7 @@ export class CellModel implements ICellModel {
}
public equals(other: ICellModel) {
return other && other.id === this.id;
return other !== undefined && other.id === this.id;
}
public get onCollapseStateChanged(): Event<boolean> {
@@ -91,10 +91,6 @@ export class CellModel implements ICellModel {
return this._onOutputsChanged.event;
}
public get onCellModeChanged(): Event<boolean> {
return this._onCellModeChanged.event;
}
public get isEditMode(): boolean {
return this._isEditMode;
}
@@ -191,17 +187,13 @@ export class CellModel implements ICellModel {
}
public get notebookModel(): NotebookModel {
return <NotebookModel>this.options.notebook;
return this._options && <NotebookModel>this._options.notebook;
}
public set cellUri(value: URI) {
this._cellUri = value;
}
public get options(): ICellModelOptions {
return this._options;
}
public get cellType(): CellType {
return this._cellType;
}
@@ -234,7 +226,7 @@ export class CellModel implements ICellModel {
if (this._language) {
return this._language;
}
return this.options.notebook.language;
return this._options.notebook.language;
}
public get cellGuid(): string {
@@ -370,7 +362,7 @@ export class CellModel implements ICellModel {
}
private async getOrStartKernel(notificationService: INotificationService): Promise<nb.IKernel> {
let model = this.options.notebook;
let model = this._options.notebook;
let clientSession = model && model.clientSession;
if (!clientSession) {
this.sendNotification(notificationService, Severity.Error, localize('notebookNotReady', "The session for this notebook is not yet ready"));
@@ -516,7 +508,7 @@ export class CellModel implements ICellModel {
try {
let result = output as nb.IDisplayResult;
if (result && result.data && result.data['text/html']) {
let model = (this as CellModel).options.notebook as NotebookModel;
let model = this._options.notebook as NotebookModel;
if (model.activeConnection) {
let gatewayEndpointInfo = this.getGatewayEndpoint(model.activeConnection);
if (gatewayEndpointInfo) {

View File

@@ -418,6 +418,8 @@ export interface INotebookModel {
* @param cell New active cell
*/
updateActiveCell(cell: ICellModel);
requestConnection(): Promise<boolean>;
}
export interface NotebookContentChange {
@@ -491,6 +493,7 @@ export interface ICellModel {
isCollapsed: boolean;
readonly onCollapseStateChanged: Event<boolean>;
modelContentChangedEvent: IModelContentChangedEvent;
isEditMode: boolean;
}
export interface FutureInternal extends nb.IFuture {