Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type = fType.contentType || 'file';
}
if (!widgetName || widgetName === 'default') {
this._widgetName = widgetName = registry.defaultWidgetFactory(ext).name;
}
// Handle the kernel preferences.
let preference = registry.getKernelPreference(
ext, widgetName, { name: kernelName }
);
if (!preference.canStart) {
this.node.removeChild(this.kernelDropdownNode.previousSibling);
this.node.removeChild(this.kernelDropdownNode);
} else {
let services = this._manager.services;
ClientSession.populateKernelSelect(this.kernelDropdownNode, {
specs: services.specs,
sessions: services.sessions.running(),
preference
});
}
let path = container.path;
return manager.newUntitled({ ext, path, type }).then(contents => {
let value = this.inputNode.value = contents.name;
this.inputNode.setSelectionRange(0, value.length - ext.length);
this._orig = contents;
});
}
type = fType.contentType || 'file';
}
if (!widgetName || widgetName === 'default') {
this._widgetName = widgetName = registry.defaultWidgetFactory(ext).name;
}
// Handle the kernel preferences.
let preference = registry.getKernelPreference(
ext, widgetName, { name: kernelName }
);
if (!preference.canStart) {
this.node.removeChild(this.kernelDropdownNode.previousSibling);
this.node.removeChild(this.kernelDropdownNode);
} else {
let services = this._manager.services;
ClientSession.populateKernelSelect(this.kernelDropdownNode, {
specs: services.specs,
sessions: services.sessions.running(),
preference
});
}
return model.newUntitled({ ext, type }).then(contents => {
let value = this.inputNode.value = contents.name;
this.inputNode.setSelectionRange(0, value.length - ext.length);
this._orig = contents;
});
}
it('should populate the select div', () => {
const div = document.createElement('select');
ClientSession.populateKernelSelect(div, {
specs: manager.specs,
preference: {}
});
expect(div.firstChild).to.be.ok;
expect(div.value).to.not.equal('null');
});
it('should select the null option', () => {
const div = document.createElement('select');
ClientSession.populateKernelSelect(div, {
specs: manager.specs,
preference: { shouldStart: false }
});
expect(div.firstChild).to.be.ok;
expect(div.value).to.equal('null');
});
protected widgetChanged(): void {
let widgetName = this.widgetDropdown.value;
let preference = this._manager.registry.getKernelPreference(
this._ext, widgetName
);
let services = this._manager.services;
ClientSession.populateKernelSelect(this.kernelDropdownNode, {
specs: services.specs,
sessions: services.sessions.running(),
preference
});
}
protected widgetDropdownChanged(): void {
let ext = this.ext;
let widgetName = this.widgetDropdown.value;
let manager = this._manager;
let preference = manager.registry.getKernelPreference(ext, widgetName);
let services = this._manager.services;
ClientSession.populateKernelSelect(this.kernelDropdownNode, {
specs: services.specs,
sessions: services.sessions.running(),
preference
});
}